generated from john/python-template
This commit is contained in:
@@ -103,9 +103,8 @@ Responsibilities:
|
||||
|
||||
## Status Semantics
|
||||
|
||||
- **Job statuses:** `queued`, `processing`, `transcribed`, `completed`, `partial_success`, `failed`
|
||||
- Operational success path currently resolves to `transcribed`.
|
||||
- `completed` remains a recognized legacy-compatible status value.
|
||||
- **Job statuses:** `queued`, `processing`, `transcribed`, `partial_success`, `failed`
|
||||
- Operational success path resolves to `transcribed`.
|
||||
- **JobSource statuses:** `pending`, `transcribed`, `failed`, `cancelled`
|
||||
|
||||
## Security and Path Handling Boundaries
|
||||
@@ -123,6 +122,45 @@ Responsibilities:
|
||||
- Non-retriable worker-loop faults are surfaced and stop loop spin.
|
||||
- Per-page outcomes are durably persisted before processing next page.
|
||||
|
||||
## Design Decisions and Rationale
|
||||
|
||||
### Why `transcribed` is the success terminal state
|
||||
|
||||
- The worker and job orchestration resolve successful completion to `JobStatus.TRANSCRIBED`, with mixed and failure outcomes represented by `partial_success` and `failed`.
|
||||
- This keeps terminal status vocabulary aligned with what the pipeline actually produces: transcribed page content and evidence, not a generic completion marker.
|
||||
|
||||
### Why evidence history is append-only while page text is a projection
|
||||
|
||||
- `ExecutionAttempt` stores immutable per-call evidence and preserves full attempt history across retries.
|
||||
- `Source.raw_transcription` is intentionally a mutable projection so UI and exports can show a selected current machine text without mutating historical evidence.
|
||||
- This split keeps auditability and UX both first-class: history is durable, presentation is editable.
|
||||
|
||||
### Why orchestration modules own cross-service workflows
|
||||
|
||||
- Service modules do not import each other; aggregate ownership remains local to each service.
|
||||
- Multi-aggregate writes are coordinated in orchestration modules (`store.py`, `workflows.py`) so transaction boundaries are explicit and testable.
|
||||
- This avoids circular dependencies and keeps cross-cutting workflow logic centralized.
|
||||
|
||||
### Why explicit eager loading is required
|
||||
|
||||
- ORM relationships are configured with `lazy="raise"` in key paths, so code must request needed relationships up front.
|
||||
- This prevents hidden query behavior in UI/service code and makes read shape deterministic and reviewable.
|
||||
|
||||
### Why canonical source bytes may be ingest-normalized
|
||||
|
||||
- Ingest normalization can correct orientation before persistence so provider calls, evidence hashes, and rendered processing source are consistent.
|
||||
- The canonical stored bytes, digest, and size become the durable processing identity for that source.
|
||||
|
||||
### Why media access uses controlled routes/helpers
|
||||
|
||||
- Print/export media uses record-validated API endpoints to avoid direct filesystem path exposure.
|
||||
- General UI media URLs are generated through shared resolver helpers to keep path handling consistent and centralized.
|
||||
|
||||
## Historical Context Boundary
|
||||
|
||||
Superseded V4.x scope/plan/review documents were intentionally removed from the active tree and archived at git tag `docs-v4x-archive`.
|
||||
Current architecture rules live only in `docs/ver4/*`; historical files are reference material only.
|
||||
|
||||
## Related References
|
||||
|
||||
- [System Requirements](requirements_v4.md)
|
||||
|
||||
Reference in New Issue
Block a user