generated from john/python-template
V4.1 major revision to docs. Removed all obsolete documents, updated v4.2 implementation scope and plan.
This commit is contained in:
@@ -0,0 +1,105 @@
|
||||
# Documents Page Contract
|
||||
|
||||
## Purpose
|
||||
|
||||
Documents manages the archival record for each historical artifact independently of its source files and transcription jobs. A Document can be created first, linked to people in one or more roles, and used later as the parent for Sources and Jobs.
|
||||
|
||||
## Routes
|
||||
|
||||
| Route | Purpose |
|
||||
| --- | --- |
|
||||
| `/documents` | Searchable archival Document list. |
|
||||
| `/documents/new` | Create a Document. |
|
||||
| `/documents/{document_id}` | View one Document and its related records. |
|
||||
| `/documents/{document_id}/edit` | Edit metadata and people-by-role links. |
|
||||
| `/documents/{document_id}/delete` | Confirm or block deletion. |
|
||||
| `/documents/{document_id}/jobs` | Show Jobs belonging to the Document. |
|
||||
| `/documents/{document_id}/sources` | Redirect to the Document-filtered Sources list. |
|
||||
|
||||
## List Behavior
|
||||
|
||||
- The title is **Archival Documents**.
|
||||
- **Create new document** opens the create route.
|
||||
- The table defaults to Document Title order and supports search and column sorting.
|
||||
- Columns are Document Title, Type, Author, Document Date, and Archive Ref.
|
||||
- Document Title is left-aligned; the remaining columns are centered.
|
||||
- Author lists all linked people in the `author` role.
|
||||
- Date display prefers exact date, then approximate date, then `Unknown`.
|
||||
- Selecting a row opens Document Detail.
|
||||
- No records displays `No documents found in repository.`
|
||||
|
||||
## Create and Edit Behavior
|
||||
|
||||
Required:
|
||||
|
||||
- Document name.
|
||||
- Document type selected from the Document Type registry.
|
||||
|
||||
Optional:
|
||||
|
||||
- Exact date.
|
||||
- Approximate date.
|
||||
- Document location.
|
||||
- Archive identifier.
|
||||
- Notes.
|
||||
- Multiple people for every configured Person Role.
|
||||
|
||||
Rules:
|
||||
|
||||
- Exact date must parse as `YYYY-MM-DD`; browser presentation may follow locale.
|
||||
- Existing people appear with disambiguating labels.
|
||||
- **Create new person** opens Person creation.
|
||||
- `person_id` may preselect that Person in the author role on Document creation.
|
||||
- An invalid requested Person produces a warning rather than a broken form.
|
||||
- `return_to=jobs_new` returns a successful create to Job creation with the new Document selected.
|
||||
- Edit includes active and inactive Document Types so historical values remain maintainable.
|
||||
- Save success returns to Document Detail.
|
||||
|
||||
## Detail Behavior
|
||||
|
||||
- The heading shows name, type, and internal ID.
|
||||
- The first Source, when present, appears in the dark-room viewer.
|
||||
- Archival Metadata shows authors, compact Document date, location, and archive identifier. Notes appear in a separate archival-notes block within the same card.
|
||||
- System Logistics shows created and updated timestamps.
|
||||
- Related People are grouped by role and link to Person Detail.
|
||||
- **Sources & Pipeline Jobs** shows counts and actions for filtered Sources, Document Jobs, and adding a Job.
|
||||
- **Edit Document** and **Delete** are available from the header.
|
||||
- Invalid IDs and missing Documents produce explicit states without rendering a partial page.
|
||||
|
||||
## Document Jobs Behavior
|
||||
|
||||
- The page lists the Document's Jobs newest first with status and Job ID.
|
||||
- **Open Job** navigates to Job Detail.
|
||||
- **Create Job** opens Job creation with the Document selected.
|
||||
- No jobs displays an explicit empty state.
|
||||
|
||||
## Delete Behavior
|
||||
|
||||
- Deletion is blocked while any Source or Job belongs to the Document.
|
||||
- The blocked state names the dependency categories and provides navigation back and to Jobs.
|
||||
- An unlinked Document requires an explicit permanent-delete action.
|
||||
- Success returns to the Documents list.
|
||||
|
||||
## Acceptance Checklist
|
||||
|
||||
- List columns, alignment, search, sorting, date fallback, and row navigation match this contract.
|
||||
- Create/edit enforce name, registered type, and valid exact-date input.
|
||||
- Multiple people can be selected independently for each configured role.
|
||||
- Person-first Document creation preselects the requested Person as author.
|
||||
- Detail links people, Sources, and Jobs to the correct records.
|
||||
- Delete never removes a Document with Source or Job dependencies.
|
||||
- Service failures use the shared error presenter and never report false success.
|
||||
|
||||
## Implementation Anchors
|
||||
|
||||
- `src/transcription/ui/pages/documents_page.py`
|
||||
- `src/transcription/ui/components/table/documents.py`
|
||||
- `src/transcription/services/documents.py`
|
||||
- `src/transcription/services/people.py`
|
||||
- `tests/ui/test_documents_page.py`
|
||||
- `tests/services/test_document_service.py`
|
||||
|
||||
## Known Limitations and Deferred Work
|
||||
|
||||
- Document creation persists the Document before adding relationship links; a later link failure is surfaced but is not currently one atomic write.
|
||||
- Source ordering controls are deferred to the [draft V4.3 scope](../../ver4.3/scope_boundary_v4_3.md).
|
||||
@@ -0,0 +1,63 @@
|
||||
# Home Page Contract
|
||||
|
||||
## Purpose
|
||||
|
||||
Home provides a user-maintained landing page for the local archive. It combines one current image with Markdown text and lets the operator edit both without changing application source or prompt assets.
|
||||
|
||||
## Routes
|
||||
|
||||
| Route | Browser path | Purpose |
|
||||
| --- | --- | --- |
|
||||
| `/homepage` | `/ui/homepage` | View current homepage image and Markdown. |
|
||||
| `/homepage/edit` | `/ui/homepage/edit` | Upload an image and edit Markdown. |
|
||||
|
||||
The application root and `/ui` redirect to `/ui/homepage`.
|
||||
|
||||
## View Behavior
|
||||
|
||||
- The visible page heading is **Home**; the browser tab title is **VibeScribe Home**.
|
||||
- The latest homepage image appears in the shared dark-room viewer.
|
||||
- Saved Markdown is rendered in the **Home Text** card.
|
||||
- Missing text displays `No homepage text saved yet.`
|
||||
- Missing image displays the viewer's empty state.
|
||||
- **Edit Home Page** opens the edit route.
|
||||
|
||||
## Edit Behavior
|
||||
|
||||
- The image upload accepts JPEG, PNG, GIF, WebP, BMP, and TIFF files.
|
||||
- A successful upload immediately stores the file, updates the preview to that image, and displays a positive notification.
|
||||
- The Markdown textarea is initialized from the currently stored homepage text.
|
||||
- **Save** writes the textarea content, displays `Homepage saved`, and returns to Home.
|
||||
- **Cancel** returns to Home without saving textarea changes. An image already uploaded during the edit session remains stored.
|
||||
|
||||
## Storage Contract
|
||||
|
||||
- Homepage content is mutable application data under `data/homepage`.
|
||||
- Markdown is stored in `homepage.md`.
|
||||
- Uploaded images keep a sanitized basename.
|
||||
- The view selects the supported image with the most recent modification time.
|
||||
- Homepage files are not transcription prompts and are not database records.
|
||||
|
||||
## Acceptance Checklist
|
||||
|
||||
- `/`, `/ui`, and the application brand reach Home.
|
||||
- Home renders with or without stored Markdown and image content.
|
||||
- Edit loads existing Markdown.
|
||||
- A supported image upload updates the preview and becomes the latest homepage image.
|
||||
- Save persists Markdown and returns to Home.
|
||||
- Cancel does not save changed Markdown.
|
||||
|
||||
## Implementation Anchors
|
||||
|
||||
- `src/transcription/ui/pages/home_page.py`
|
||||
- `src/transcription/ui/homepage_store.py`
|
||||
- `src/transcription/ui/components/app_shell.py`
|
||||
- `tests/ui/test_upload_page.py`
|
||||
- `tests/ui/test_navigation_and_mounts.py`
|
||||
- `tests/ui/test_pages_registration.py`
|
||||
|
||||
## Known Limitations
|
||||
|
||||
- Homepage storage is fixed under the repository/application `data` directory rather than a configured application-data root.
|
||||
- Uploading an image is immediate and is not rolled back by Cancel.
|
||||
- The editor does not currently delete or select among previously uploaded images.
|
||||
@@ -0,0 +1,94 @@
|
||||
# Jobs Page Contract
|
||||
|
||||
## Purpose
|
||||
|
||||
Jobs manages transcription processing runs. A Job belongs to one Document, links one or more Source pages, records processing provenance, and exposes lifecycle actions without making lifecycle fields directly editable.
|
||||
|
||||
## Routes
|
||||
|
||||
| Route | Purpose |
|
||||
| --- | --- |
|
||||
| `/jobs` | Searchable processing Job list. |
|
||||
| `/jobs/new` | Create and queue a Job. |
|
||||
| `/jobs/{job_id}` | View status, execution logistics, and related records. |
|
||||
| `/jobs/{job_id}/cancel` | Confirm cancellation. |
|
||||
| `/jobs/{job_id}/resubmit` | Confirm resubmission of failed Sources. |
|
||||
| `/jobs/{job_id}/delete` | Confirm or block deletion. |
|
||||
|
||||
## List Behavior
|
||||
|
||||
- The title is **Transcription Pipeline Jobs**.
|
||||
- **Create job** opens Job creation and **Refresh** reloads the table.
|
||||
- Columns are Job ID, Status, Source Filename, Retries, Created, and Updated.
|
||||
- Search covers Job ID, filename, and status.
|
||||
- Status is displayed as a semantic status chip.
|
||||
- Selecting a row opens Job Detail.
|
||||
- No records displays `No job records found in repository.`
|
||||
|
||||
## Create Behavior
|
||||
|
||||
- A Target Document and at least one source file are required.
|
||||
- `document_id` may preselect a Target Document.
|
||||
- If no Documents exist, the page explains the prerequisite and links to Document creation with a return path.
|
||||
- Provider and Model are optional request overrides.
|
||||
- Upload accepts JPEG, PNG, TIFF, and PDF files and supports multiple/folder selection.
|
||||
- The visible upload queue is sorted alphabetically by original filename.
|
||||
- Files can be removed individually or cleared before submission.
|
||||
- Helper text explains numeric filename prefixes for page ordering.
|
||||
- Submission creates the Job, Source records, and JobSource links, notifies the worker, and opens Job Detail.
|
||||
|
||||
## Detail and Lifecycle Behavior
|
||||
|
||||
- The heading shows Job ID and a status badge.
|
||||
- Execution Logistics shows provider, model, prompt, retry count, and last update.
|
||||
- Document Links open the parent Document and Job-filtered Sources.
|
||||
- Queued and processing Jobs show an auto-refresh notice and reload every four seconds.
|
||||
- Polling stops when the Job becomes terminal or a refresh fails.
|
||||
- Queued and processing Jobs expose **Cancel**.
|
||||
- Jobs other than `transcribed` expose **Resubmit** under the current UI rule. The service blocks resubmission while processing is active or when no failed Sources exist.
|
||||
- All Jobs expose **Delete Job**, subject to delete guardrails.
|
||||
- Invalid and missing IDs produce explicit states.
|
||||
|
||||
## Cancel Behavior
|
||||
|
||||
- The confirmation explains that processing stops and remaining non-transcribed Sources become failed.
|
||||
- The service decides whether the current state permits cancellation.
|
||||
- Success updates the Job, notifies the worker, and returns to Job Detail.
|
||||
|
||||
## Resubmit Behavior
|
||||
|
||||
- The page shows current status and failed Source count.
|
||||
- The page explicitly states: `Resubmit queues only failed linked sources. New results overwrite prior page-level results.`
|
||||
- The service blocks submission while processing is active or when no failed Sources exist.
|
||||
- Current behavior updates the existing page-level result when new output arrives.
|
||||
- Success reports the number of resubmitted Sources and returns to Job Detail.
|
||||
|
||||
## Delete Behavior
|
||||
|
||||
- Deletion is blocked while status is `processing`.
|
||||
- Allowed deletion warns that related JobSource links are removed.
|
||||
- Success returns to the Jobs list.
|
||||
|
||||
## Acceptance Checklist
|
||||
|
||||
- Job creation cannot proceed without a valid Document and at least one Source.
|
||||
- Upload ordering and removal controls match the displayed queue.
|
||||
- Detail shows current status and provenance summary with correct related links.
|
||||
- Active Jobs refresh without overlapping permanent polling after terminal state.
|
||||
- Cancel, resubmit, and delete honor service guardrails and show actionable failures.
|
||||
- Lifecycle fields cannot be edited directly.
|
||||
|
||||
## Implementation Anchors
|
||||
|
||||
- `src/transcription/ui/pages/jobs_page.py`
|
||||
- `src/transcription/ui/components/table/jobs.py`
|
||||
- `src/transcription/services/jobs.py`
|
||||
- `src/transcription/services/store.py`
|
||||
- `src/transcription/services/workflows.py`
|
||||
- `tests/ui/test_jobs_page.py`
|
||||
- `tests/services/test_job_service.py`
|
||||
- `tests/services/test_store.py`
|
||||
|
||||
## Planned Change
|
||||
|
||||
V4.2 replaces update-in-place retry evidence with append-only processing attempts and adds exact transport evidence. Until implemented, the current overwrite behavior must be labeled accurately rather than described as archival history. See the [V4.2 scope](../../ver4.2/scope_boundary_v4_2.md).
|
||||
@@ -0,0 +1,90 @@
|
||||
# People Page Contract
|
||||
|
||||
## Purpose
|
||||
|
||||
People manages reusable historical-person records. A Person may appear in many Documents under different relationship roles and may optionally carry a portrait and FamilySearch identifier.
|
||||
|
||||
## Routes
|
||||
|
||||
| Route | Purpose |
|
||||
| --- | --- |
|
||||
| `/people` | Searchable People list. |
|
||||
| `/people/new` | Create a Person. |
|
||||
| `/people/{person_id}` | View one Person and linked Documents. |
|
||||
| `/people/{person_id}/edit` | Edit the Person. |
|
||||
| `/people/{person_id}/delete` | Confirm permanent deletion. |
|
||||
|
||||
## List Behavior
|
||||
|
||||
- The title is **Archival Entities: People**.
|
||||
- **Create new person** opens the create route.
|
||||
- The table defaults to Full Name order and supports search and column sorting.
|
||||
- Columns are Full Name, Display Name, Maiden Name, Birth Date, and Death Date.
|
||||
- Full Name is left-aligned; Display Name, Maiden Name, and date columns are centered.
|
||||
- Birth and death values independently prefer exact date, then approximate date, then `Unknown`.
|
||||
- Selecting a row opens Person Detail.
|
||||
- No records displays `No person records found in repository.`
|
||||
|
||||
## Create and Edit Behavior
|
||||
|
||||
Required:
|
||||
|
||||
- Full name.
|
||||
|
||||
Optional:
|
||||
|
||||
- Display name and maiden name.
|
||||
- Exact and approximate birth/death dates.
|
||||
- Birth/death places.
|
||||
- Biography.
|
||||
- Portrait path or uploaded portrait.
|
||||
- FamilySearch ID.
|
||||
|
||||
Rules:
|
||||
|
||||
- Missing Full name blocks save with a warning.
|
||||
- Exact date inputs are native browser date inputs.
|
||||
- FamilySearch IDs are normalized and validated by `PeopleService`.
|
||||
- Portrait uploads are stored under the configured upload root in a Person-specific directory and update Portrait path.
|
||||
- Metadata JSON remains hidden.
|
||||
- Save success returns to Person Detail.
|
||||
|
||||
## Detail Behavior
|
||||
|
||||
- The header provides **New Document**, **Edit Person**, and **Delete**.
|
||||
- **New Document** opens Document creation with this Person requested for author preselection.
|
||||
- The portrait viewer resolves supported relative upload paths and absolute HTTP/data URLs.
|
||||
- Biographical Record shows names, compact birth/death dates, places, and an **Open in FamilySearch** link when an ID exists.
|
||||
- Biography has an explicit empty value.
|
||||
- Linked Documents show Document name, relationship role, and an action to open Document Detail.
|
||||
- No links shows both an empty state and guidance to link from a Document workflow.
|
||||
- System Logistics shows created and updated timestamps.
|
||||
|
||||
## Delete Behavior
|
||||
|
||||
- The page warns when linked Document relationships exist.
|
||||
- Confirmed deletion removes the Person and its relationship links; it does not delete Documents.
|
||||
- Success returns to the People list.
|
||||
- Missing or already-deleted records return to a safe list state.
|
||||
|
||||
## Acceptance Checklist
|
||||
|
||||
- List fields, alignment, date fallback, search, sorting, and navigation match this contract.
|
||||
- Full name is enforced on create and edit.
|
||||
- FamilySearch ID validation and link generation use the fixed supported identifier format.
|
||||
- Portrait upload and rendering remain constrained to supported media paths.
|
||||
- New Document carries the Person context.
|
||||
- Linked Documents show the correct role and target.
|
||||
- Delete wording distinguishes removal of relationship links from deletion of Documents.
|
||||
|
||||
## Implementation Anchors
|
||||
|
||||
- `src/transcription/ui/pages/people_page.py`
|
||||
- `src/transcription/ui/components/table/people.py`
|
||||
- `src/transcription/services/people.py`
|
||||
- `tests/ui/test_people_page.py`
|
||||
- `tests/services/test_v2_crud.py`
|
||||
|
||||
## Deferred Work
|
||||
|
||||
- Structured name fields, merge/deduplication, advanced metadata editing, and Person-side relationship editing are not current behavior.
|
||||
@@ -0,0 +1,86 @@
|
||||
# Sources Page Contract
|
||||
|
||||
## Purpose
|
||||
|
||||
Sources manages individual archived page/file records. It provides source-media viewing, current processing context, provider evidence inspection, previous/next page navigation, and human revision without allowing machine output to be edited.
|
||||
|
||||
## Routes
|
||||
|
||||
| Route | Purpose |
|
||||
| --- | --- |
|
||||
| `/sources` | Global or filtered Source list. |
|
||||
| `/sources/{source_id}` | View media, transcription, revision, metadata, and evidence. |
|
||||
| `/sources/{source_id}/delete` | Confirm or block deletion. |
|
||||
|
||||
The list accepts optional `document_id` and `job_id` query parameters. Document context takes precedence if both parse successfully.
|
||||
|
||||
## List Behavior
|
||||
|
||||
- The title is **Source Asset Records**, **Sources for Document**, or **Sources for Job** according to context.
|
||||
- Global context provides **Create Job**.
|
||||
- Filtered context provides **Back to Document** or **Back to Job**.
|
||||
- Rows are ordered by page number and then upload name.
|
||||
- Columns are Document Name, Page Number, Upload Title, Status, and Error Detail.
|
||||
- Document Name, Upload Title, and Error Detail are left-aligned; Status is centered.
|
||||
- Stored Filename is intentionally absent from the list.
|
||||
- Selecting a row opens Source Detail.
|
||||
- No records displays `No source asset records found in repository.`
|
||||
|
||||
## Detail Behavior
|
||||
|
||||
- The heading shows page number, upload name, and Source ID.
|
||||
- **Back to Sources** returns to the global list.
|
||||
- **Delete Source** opens the guarded delete route.
|
||||
- Previous and Next navigate only among Sources belonging to the same Document in page order; unavailable boundary actions are disabled.
|
||||
- The media viewer resolves the stored Source path through the configured upload root.
|
||||
- Transcription Text is read-only and prefers the latest JobSource transcription, then the Source projection.
|
||||
- Editable Revision is seeded from an existing revision or the machine transcription.
|
||||
- Source Metadata shows upload name, stored filename, page number, Document Name, Document ID, and stored path. Source ID appears in the page-header subtitle.
|
||||
- SourceJob Metadata shows latest status, Job ID, execution time, provider, model, prompt, and failure detail.
|
||||
- Revision Logistics shows revised state, last-revised time, and upload time.
|
||||
|
||||
## Provider Evidence
|
||||
|
||||
- Provider Evidence is associated with the latest JobSource execution.
|
||||
- AI Metadata and the current `raw_api_response` value are displayed as expandable formatted JSON.
|
||||
- Missing evidence has an explicit empty state.
|
||||
- Under the current V4 implementation, `raw_api_response` is an OpenRouter SDK response snapshot, not an exact HTTP or native upstream-provider response.
|
||||
|
||||
## Revision Behavior
|
||||
|
||||
- Machine transcription is never edited directly.
|
||||
- A revision must contain non-whitespace text.
|
||||
- Save persists revised text and updates the saved timestamp without leaving the page.
|
||||
- Reset restores the in-memory revision from page load or the most recent successful save. When no revision exists, it restores the machine transcription; it does not re-read the database.
|
||||
- A failed latest execution displays guidance that a human revision can preserve corrected text.
|
||||
|
||||
## Delete Behavior
|
||||
|
||||
- Deletion is allowed only when the Source has no JobSource links.
|
||||
- A linked Source shows cleanup guidance and navigation to Jobs.
|
||||
- An unlinked Source requires explicit permanent deletion.
|
||||
- Success returns to the Sources list.
|
||||
|
||||
## Acceptance Checklist
|
||||
|
||||
- Global, Document-filtered, and Job-filtered lists show the correct context and return action.
|
||||
- List columns and alignments match this contract and omit Stored Filename.
|
||||
- Previous/next navigation never crosses Document boundaries.
|
||||
- Detail keeps machine output read-only and human revision separately editable.
|
||||
- Empty, failed, and missing-evidence states remain explicit.
|
||||
- JSON evidence is readable without being mislabeled as native transport evidence.
|
||||
- Delete cannot remove a Source with processing-history links.
|
||||
|
||||
## Implementation Anchors
|
||||
|
||||
- `src/transcription/ui/pages/sources_page.py`
|
||||
- `src/transcription/ui/components/table/sources.py`
|
||||
- `src/transcription/services/sources.py`
|
||||
- `tests/ui/test_sources_page.py`
|
||||
- `tests/services/test_transcription_service.py`
|
||||
- `tests/services/test_v2_crud.py`
|
||||
|
||||
## Planned Changes
|
||||
|
||||
- V4.2 will rename and separate evidence layers, add exact OpenRouter transport capture, and preserve append-only attempts. See the [V4.2 scope](../../ver4.2/scope_boundary_v4_2.md).
|
||||
- Source page reordering is deferred to the [draft V4.3 scope](../../ver4.3/scope_boundary_v4_3.md).
|
||||
Reference in New Issue
Block a user