69 lines
4.1 KiB
Markdown
Executable File
69 lines
4.1 KiB
Markdown
Executable File
# Task 012.3.1 — Complete UI Route Repair
|
||
|
||
## Context
|
||
|
||
This is a continuation of task 012.3. Do not restart the task or discard work already done.
|
||
|
||
Hermes' latest report says the full test suite collected 106 tests: 102 passed and 4 failed:
|
||
- `tests/test_ui_routes.py::TestUIRoutes::test_system_detail`
|
||
- `tests/test_ui_routes.py::TestUIRoutes::test_resource_detail`
|
||
- `tests/test_ui_routes.py::TestUIRoutes::test_specification_detail`
|
||
- `tests/test_ui_routes.py::TestUIRoutes::test_purchase_detail`
|
||
|
||
The report attributes the failures to template calls to `url_for('resources_list')`, `url_for('specifications_list')`, and `url_for('purchases_list')`, claiming these functions exist in `app/routers/ui.py` but are not registered as routes. The report also says imports, query joins, and a resource-allocation route were changed.
|
||
|
||
Treat that report as a hypothesis. Inspect the current working tree and reproduce the actual failures.
|
||
|
||
Repository: `/mnt/nas/hermes-test/Specs`
|
||
|
||
## Goal
|
||
|
||
Finish the UI fixes so the full test suite passes, without changing the agreed domain model or discarding existing work.
|
||
|
||
## Required investigation and fixes
|
||
|
||
1. Before editing, record `git status --short`, current branch/commit, and inspect the current diff. Preserve all existing and unrelated changes. Do not reset, clean, restore, or overwrite files wholesale.
|
||
2. Re-run the four failing tests and capture the actual exception and traceback for each.
|
||
3. Inspect the FastAPI application router registration and all relevant route declarations. `url_for()` requires a registered route name; the issue is not whether a route is an “API route.” Establish which route names are actually registered and which names the templates call.
|
||
4. For each broken template link:
|
||
- If the corresponding list page is intended and missing, implement/register the appropriate server-rendered UI route with the expected name and parameters, using existing project patterns; or
|
||
- If a suitable route already exists under another name/path, correct the template to use that registered route.
|
||
Do not add duplicate routes or invent routes without checking the intended UI flow.
|
||
5. Inspect the four detail templates and the data each route supplies. Fix any remaining template/model relationship mismatches based on actual current model fields and relationships.
|
||
6. Keep `ResourceAllocationService` as the source of allocation business rules. Do not duplicate its validation in the UI route.
|
||
7. Preserve the Purchase–Specification M:N implementation and its assertions. Do not weaken or skip tests.
|
||
|
||
## Constraints
|
||
|
||
- Work directly in `/mnt/nas/hermes-test/Specs`.
|
||
- Do not discard or overwrite pre-existing working-tree changes.
|
||
- Do not install dependencies.
|
||
- Do not change models, migrations, or core business rules unless a reproduced defect proves it necessary. If a schema/domain change appears necessary, stop and report evidence instead of making it.
|
||
- Do not reintroduce legacy entities (`Key`, `License`, `LicenseType`, `Product`, `ResourcePool`, `PoolResource`, `PoolReceipt`, `PoolAllocation`).
|
||
- Do not commit or push.
|
||
- Do not begin another task.
|
||
|
||
## Verification
|
||
|
||
Run:
|
||
- The four previously failing UI tests individually or together, capturing tracebacks if any still fail.
|
||
- `tests/test_implementation.py::test_purchase_specification_m2m`.
|
||
- The full `python -m pytest -q` suite.
|
||
- `python -c "from main import app; print('APP OK')"`.
|
||
|
||
Report actual exit codes and collected/passed/failed/error/skipped counts. Do not claim success if the command failed. Do not report a test as fixed unless it was actually rerun and passed.
|
||
|
||
## Report
|
||
|
||
Update or create `doc/audits/012.3-ui-and-m2m-repair-v1.md` with:
|
||
- initial and final Git state (branch, commit, working-tree status);
|
||
- the root cause of each failure, with exact route names, template files, and relevant functions;
|
||
- files changed and concise reasons;
|
||
- commands and actual results;
|
||
- full and targeted test results;
|
||
- application import result;
|
||
- confirmation that assertions were not weakened, legacy entities were not reintroduced, and no commit/push was made;
|
||
- remaining failures or limitations.
|
||
|
||
Stop after writing the report and provide a concise chat summary.
|