Skip to content

feat(triage): keep every candidate's transcript and list the queue locally - #80

Merged
stephen-masters merged 1 commit into
mainfrom
feat/triage-queue
Oct 25, 2026
Merged

stephen-masters merged 1 commit into
mainfrom
feat/triage-queue

Conversation

@stephen-masters

@stephen-masters stephen-masters commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Closes #26. Closes #27.

The first two build stories of brief 001, in one PR because the list view reads what the record writes.

Keep every candidate's full transcript (#26)

When the quality gate diverts a file, batch now writes three kinds of file into workspace/triage/:

File What it holds
<stem>.md The manifest, byte for byte what it was: scores and 500-character excerpts, for reading
<stem>.json The record: every candidate's score, the reason the file was held, when, the backend the run asked for, and where each full transcript is
<stem>.<backend>.txt Each candidate's transcript, whole

The writing lives in a new tetrak_ocr.triage module; batch._send_to_triage calls it beside the manifest it already wrote. The CSV manifest's outputs column for a triaged row still names the .md alone, deliberately, so that beta format does not change under this.

List the queue (#27)

tetrak-ocr triage prints the queue as a table; tetrak-ocr triage --serve serves the same as a page on http://127.0.0.1:8321/ (--port to change it, --dir to point elsewhere). Each row: file, best score, engine, reason held, when, and how many candidates.

  • Loopback only. HOST is a constant, there is no flag to bind elsewhere, and two tests pin it: one on the bound address, one that --host is rejected.
  • Read-only and minimal: GET / only, no files served, no authentication because there is nothing remote. The directory is re-read on every request, so the page follows a batch still running.
  • An empty or missing directory is a plain message, not an error; a directory written by a release before this one lists its manifests by name with a note to read the manifest, so nothing already in the queue vanishes from the view.
  • Plain HTML with inline styling from the stdlib server, so the package gains no dependency.

Tests

tests/ocr/test_triage.py covers the record and transcripts, the queue reader (including the older manifest-only case), rendering and escaping, and the server (loopback address, the page, 404 elsewhere, the empty case, on a free port). test_batch.py covers a diverted file with three backends end to end, including that the Markdown manifest is unchanged byte for byte. test_cli.py covers the subcommand wiring. Fast suite: 452 passed; ruff, Sphinx -W and markdownlint clean.

Notes for the product side

  • tetrak-product#112 (Hugo or a single HTML file) is answered in practice by List queued triage items with best score and reason held #27's own wording: a small stdlib server from the CLI, the same shape brief 005's serve would take. Worth recording in brief 001's decision log; I have not touched the product repo for this.
  • tetrak-product#109 (does the excerpt lose decisions?) can now be answered from the .txt files rather than by re-running anything.

🤖 Generated with Claude Code

…cally

A file held by the quality gate kept only a 500-character excerpt of each
candidate transcript in its Markdown manifest, so the decision about it
was often made on a fragment and a view of the queue could not show what
was never saved (brief 001). `batch` now writes, beside the unchanged
manifest, a `<stem>.json` record -- every candidate's score, the reason
the file was held, when, and where each transcript is -- and each
candidate's full transcript as `<stem>.<backend>.txt`.

`tetrak-ocr triage` lists the queue from those records, and `--serve`
serves it as a page: each file, its best score, the engine and the reason
held. The server binds to the loopback address and nothing else, with no
flag to bind elsewhere, answers GET for `/` only and serves no files. A
directory written by an older release lists its manifests by name, and
an empty or missing directory is reported as empty rather than failing.

Closes #26
Closes #27

Co-authored-by: Yvette Mankerian <yvettekm@gmail.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying tetrak with  Cloudflare Pages  Cloudflare Pages

Latest commit: 6e0dc16
Status: ✅  Deploy successful!
Preview URL: https://a94de96c.tetrak.pages.dev
Branch Preview URL: https://feat-triage-queue.tetrak.pages.dev

View logs

@stephen-masters
stephen-masters merged commit c10f000 into main Oct 25, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

List queued triage items with best score and reason held Keep every candidate's full transcript when a file goes to triage

1 participant