generated from john/python-template
3.8 KiB
3.8 KiB
Implementation Plan (Version 4)
Goal
Implement the Version 4 project definition from the current repository state while preserving existing data by default.
Migration Policy
- Database changes are non-destructive by default.
- Exception: the legacy
document_typetext field may be replaced by adocument_type_idreference without migrating existing text values. - Exception:
document_personlinks may be recreated manually.
Current Project Impact
src/transcription/db/models.pyrequires full schema alignment with the V4 core documents.src/transcription/services/documents.pyrequires set-based document-person sync, exclusivity checks, and document-type resolution.- API modules require additive role-aware relationship behavior and document-type selection behavior.
- UI pages require grouped role displays, multi-role editing, and registry-backed document-type selection.
- Existing tests require updates for role enforcement, document-type selection, and regression safety.
Implementation Phases
1. Finalize the Transition Documents
- Confirm the reset scope.
- Confirm the database exception policy.
- Keep core V4 documents as the only authoritative product definition.
2. Align the Persistence Layer
- Update SQLModel definitions to match the final V4 schema.
- Add
person_role,role_exclusivity, anddocument_typesupport. - Replace legacy document-type storage with
document_type_id. - Apply the accepted manual exception strategy for
document_typeanddocument_persondata. - Preserve all other data structures non-destructively.
3. Update Services and Write Semantics
- Implement set-based synchronization for document-person updates.
- Implement deterministic exclusivity conflict checks.
- Remove suggestion-related service behavior.
- Add document-type resolution and validation by stable code or id.
4. Update API Contracts
- Keep API evolution additive.
- Add role-aware relationship retrieval and write behavior.
- Add document-type catalog retrieval and code-based selection for document writes.
- Remove suggestion-related API surfaces from the V4 target state.
5. Update UI Workflows
- Replace single-person link editing with grouped multi-role editing.
- Render grouped role links on document and person detail views.
- Replace free-text document type entry with registry-backed selection.
- Preserve clear validation and conflict messaging.
6. Verification and Hardening
- Add or update service tests for many-per-role behavior, exclusivity enforcement, and set-based sync correctness.
- Add API tests for relationship behavior and document-type selection.
- Add UI tests or walkthrough coverage for grouped roles and type selection.
- Add regression coverage for delete and cleanup semantics.
Done When
- Core V4 documents and code paths agree on the final project definition.
- Relationship-role writes are deterministic and non-destructive.
- Exclusivity rules are enforced consistently.
- Document type selection is registry-backed.
- The accepted manual exceptions for
document_typeanddocument_personare completed. - The focused test coverage passes.
Out of Scope
- Suggested/asserted relationship state.
- Suggestion review or extraction workflows.
- Global person entity-resolution engine.
- Automated semantic document-type classification.
Delivery Order Recommendation
- Freeze scope boundary and implementation plan.
- Freeze core V4 documents.
- Align persistence models.
- Align services and API behavior.
- Align UI behavior.
- Run focused verification and regression checks.