Prepare Specs UI for Windows review
This commit is contained in:
Executable
+74
@@ -0,0 +1,74 @@
|
||||
# Task 012.3 — Repair UI runtime errors and verify Purchase–Specification M:N
|
||||
|
||||
## Goal
|
||||
|
||||
Repair the defects recorded in `doc/audits/012.2-project-state-audit-v1.md` with the smallest justified changes, then verify the application and full test suite. This is an implementation task, not another audit.
|
||||
|
||||
Repository: `/mnt/nas/hermes-test/Specs`
|
||||
|
||||
## Starting evidence
|
||||
|
||||
The audit reports:
|
||||
- `python -c "from main import app; print('APP OK')"` succeeds.
|
||||
- `python -m pytest -q`: 102 passed, 6 failed.
|
||||
- UI failures include missing names `Contract` and `PurchaseSpecification` in `app/routers/ui.py`.
|
||||
- Resource/specification detail templates access `SpecificationItem.module`, which is not present on the current model.
|
||||
- `tests/test_implementation.py::test_purchase_specification_m2m` fails.
|
||||
- The resource allocation route exists and calls `ResourceAllocationService`.
|
||||
- No legacy entities were found in runtime code.
|
||||
|
||||
Treat the audit as a starting point, not as proof of the current state. Inspect the actual code and reproduce the failures before editing.
|
||||
|
||||
## Scope
|
||||
|
||||
### 1. Repair UI runtime errors
|
||||
|
||||
- Add or correct imports in `app/routers/ui.py` for models actually used by the routes, including `Contract`, `PurchaseSpecification`, and `SpecificationItem`, where appropriate.
|
||||
- Correct resource/specification detail templates so they use the actual current model relationships and field names. Do not add compatibility properties or legacy models merely to satisfy a template.
|
||||
- Check the project detail, system detail, resource detail, specification detail, and purchase detail routes.
|
||||
- Preserve server-rendered FastAPI/Jinja/Bootstrap architecture and the existing `ResourceAllocationService` integration.
|
||||
|
||||
### 2. Diagnose and repair the Purchase–Specification M:N test
|
||||
|
||||
- Inspect the association table/model relationships, SQLAlchemy relationship configuration, and `tests/test_implementation.py::test_purchase_specification_m2m`.
|
||||
- Determine whether the defect is in the model mapping, test setup, or test expectations by reproducing and examining actual behavior.
|
||||
- Fix the underlying issue with the smallest justified change.
|
||||
- Do not weaken, delete, skip, or rewrite assertions merely to make the test pass. If an assertion is genuinely inconsistent with the agreed domain model, explain why in the report before changing it.
|
||||
- Do not modify database schema or migrations unless the code and reproduced failure demonstrate that a schema change is essential. If it appears essential, stop and report the evidence rather than making that broader change in this task.
|
||||
|
||||
### 3. Verification
|
||||
|
||||
Run the full test suite in the existing Hermes environment; do not install dependencies. Also run:
|
||||
|
||||
- `python -c "from main import app; print('APP OK')"`
|
||||
- `alembic upgrade head` **only against a disposable/test database**, never the working database. If a safe disposable database is not already available, do not run migrations; report that limitation.
|
||||
- Targeted tests for the repaired UI routes and the Purchase–Specification M:N relationship.
|
||||
|
||||
The audit baseline is 102 passed and 6 failed. The expected result is that all existing tests pass (currently 108 total, if the test set has not changed). Report the actual collected/passed/failed/error/skipped counts; do not claim success if the command exits unsuccessfully.
|
||||
|
||||
## Constraints
|
||||
|
||||
- Work in the existing repository at `/mnt/nas/hermes-test/Specs`; do not use or substitute a local copy.
|
||||
- Preserve the current working tree and all pre-existing changes. Inspect `git status` and the relevant diff first.
|
||||
- Do not reset, clean, restore, or discard unrelated changes or generated/untracked files.
|
||||
- Do not reintroduce legacy entities such as `Key`, `License`, `LicenseType`, `Product`, `ResourcePool`, `PoolResource`, `PoolReceipt`, or `PoolAllocation`.
|
||||
- Do not change the agreed domain model, business rules, or core services except where a reproduced defect proves a change is necessary. Prefer fixes in imports, relationship configuration only if genuinely defective, and templates.
|
||||
- Do not install packages or alter the environment.
|
||||
- Do not commit or push.
|
||||
- Do not start another task after this one.
|
||||
|
||||
## Report
|
||||
|
||||
Create `doc/audits/012.3-ui-and-m2m-repair-v1.md` containing:
|
||||
|
||||
1. Initial Git branch, commit, and working-tree state.
|
||||
2. Each reproduced failure and its root cause, with file/function/template references.
|
||||
3. Files changed and a concise explanation of each change.
|
||||
4. Exact commands run and their exit statuses.
|
||||
5. Full test summary and targeted test results.
|
||||
6. Application import result.
|
||||
7. Migration check result, or a clear statement that it was not run because a disposable database was unavailable.
|
||||
8. Confirmation that assertions were not weakened and legacy entities were not reintroduced.
|
||||
9. Any remaining failures or limitations.
|
||||
|
||||
Stop after writing the report and provide a concise summary in chat. Do not commit or push.
|
||||
Reference in New Issue
Block a user