Repository navigation
run says what it is doing, and what it lost - #36
Merged
Merged
Conversation
Three pieces, no console and no clock in any of them, because the whole panel has to be testable without a terminal. `counts.render_count` refuses a count with no denominator. CLAUDE.md already said a counter left at zero because a server died must not look like a document that had nothing to process; as a sentence it was a wish, and as a ValueError it is a rule. "0 of 1 402 containers" and "0 of 0" are two different facts, and a bare integer is exactly what makes them one string. `render_phase_loss` chooses on the phase's STATE and not on whether a number is zero — which is how a zero came to mean four things in one column — and reserves the red LOST for a phase that actually lost the ground under it, with a cause and a scope or it raises. `record` splits "lost" into the three causes that have three different remedies: the source was defective, a guard withheld on purpose, an incident needs a human. Every loss carries a document, a step, and a typed locator; `Kind.DOC` is the floor and an admission the summary prints rather than hides. Never an internal index — "container 12" and "batch_start 640" are what the pipeline says today and neither is something a reader can open. A page id is worth four addresses at once, because `surface/@xml:id` IS the ALTO file stem. `digest` folds repeated warnings by shape. A real log for this corpus carries eighty WARNING lines in five shapes, which printed one by one push everything else off the screen — a run repairing a source defect looks like a run failing. The fold keeps every occurrence, sums the integers inside the messages (the measured 4 129 ids), and bounds only the number of lines, saying how many shapes that hid. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MpzP6TdBk94j1otp8pTo5f
Plain text, no markup, no colour, no clock: the dashboard and the journal print the same bytes because they call the same function on the same record. Two renderers that could disagree would be two accounts of one run and no way to tell which to believe. What it holds to, from the design: Every block prints its heading on a clean run too. A line that disappears at zero cannot be told from a phase that was never checked, so the three headings are the map of what this pipeline knows how to lose. `whole phases 3 of 27` never merges into a container count. A document written with none of a phase is damage of another kind, and averaging the two is exactly the convenient lie the project forbids — there is a test asserting the sum of the two numbers never appears. `located … 0 to a document only` prints at zero, because a blind spot has to be a visible line rather than an absence. The `next` block is chosen by what actually broke, from a fixed table. A failure state that does not say what to type has not finished reporting, and a remedy offered for a problem that did not happen teaches the reader to skip the block. The last line says what worked and why it is or is not enough: "everything converted, but 3 volumes carry no enrichment at all" only reads as a contradiction if a written file and an acceptable file are the same thing. When a gate trips it names the lines that tripped it — the block's lines, not one per record. Nothing wraps and no line carries trailing whitespace, both asserted across five widths: the panel is capped at 100 columns, and the right margin is reserved rather than padded because this string also goes into a log. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MpzP6TdBk94j1otp8pTo5f
No console, no clock, no I/O: (state, width, capabilities) in, lines out. Six moments of a four-hour run are testable in milliseconds because of it, and every number on the panel is a measurement the caller handed in — nothing here infers. Lines are sequences of (text, style), so the plain rendering is the concatenation of the text. Colour therefore cannot carry meaning on its own: strip every style and the panel says the same thing. That is structural rather than a convention someone has to remember, and `test_no_color_parity` asserts it anyway. The run bar is three measurements and never a model: pages of volumes already written, pages read in the volume still open — real work, at risk — and pages not read yet. No learned per-phase weighting, which would be the only number on the screen capable of being wrong by a factor of two. The void is a glyph and not a space, so the length of the bar can be judged without reading the percentage, and the percentage is of pages because volumes on this corpus differ by two orders of magnitude. Blocked and hung look identical without `waiting 47s/120s`: the wait of the request in flight against the timeout it will give up at. That is the state a four-hour run spends most of its time in. A service dying surfaces in three independent places — the banner, the phase line with what it refused and its denominator, and an incident line that stays until the end — because the run lasts hours and the operator was looking elsewhere. The ASCII rendering is one translation pass at the end, one character per glyph so the padding computed on the composed line still holds; that is what makes it provably the same panel. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MpzP6TdBk94j1otp8pTo5f
A design pass, and a reporter that knows when not to draw. The pipeline is named after taille-douce, copperplate engraving, and an engraver renders a value by the density of the hatching. So the bar is a hatch that fills rather than a line that grows: bitten through, half bitten, bare plate. It says what a progress bar says, in the vocabulary of the thing being made, and the bare plate stays a glyph so the length is judgeable without reading the percentage. The palette is taken from what a copperplate is made of — burnished copper, bister ink, verdigris, vermilion, graphite — rather than from what a terminal happens to offer, and it is a named table so there is one place to change how the panel looks. No background is ever painted: a panel that paints its own ground fights the theme the reader chose, and looks broken in half of them. A test holds every style used to that table. Two things were removed rather than added. The spinner is a turning quadrant and not the tone family, because one glyph carrying two meanings on the same line is worse than a duller spinner — and not braille either, which is the default of the genre. And `7 written · 1 failed · 19 to go` became three columns: a list joined with middle dots is the commonest tell of an interface nobody laid out. Rich stays where Rich is good — the live redraw, the colour-system degradation, terminal detection — and does none of the layout. Composing the lines here is what makes the width cap an assertion rather than a hope, the ASCII panel provably the same panel, and the no-colour parity structural instead of a rule someone has to remember. `select` decides which reporter a run gets. Every rule exists because getting it wrong is silent: nobody notices a dashboard that never appeared, and nobody reads the CI log that swallowed one. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MpzP6TdBk94j1otp8pTo5f
The run talks to a single object. What it says does not depend on which reporter is drawing, which is the only way the two can be guaranteed to agree — and the reason the end-of-run summary comes out byte-identical in both. Three things it holds that the pipeline currently drops. The step a document was in. `_process_document`'s return value is thrown away today, so a volume that raises loses the one thing a reader needs first; the collector keeps it, which is what lets a failure say where it happened rather than only that it did. The pages of the volume still open, counted apart from the pages written. That is the bar's middle zone: work done and not yet saved. Folding it into "written" would make the bar promise more than the disk holds, and a volume that then fails would leave the promise standing. Warnings, which go to the digest and never to the console. Eighty a volume printed one at a time push everything else off the screen, and that is how a run repairing a source defect comes to look like a run failing. A lost phase is written by `render_phase_loss` and not by a sentence of its own: the denominator is what makes the zero readable, and a second way of writing a loss is a second way of writing it wrongly. 1058 tests, coverage 91.6. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MpzP6TdBk94j1otp8pTo5f
The report module reaches a user. `run` builds the collector, feeds it as it goes, and prints the summary instead of a sentence of its own — one account of the run, not two. The accounting line every wrapper greps is taken by the report rather than recomputed, which is what keeps them from ever disagreeing. The duplicate-ALTO-id count was wrong, and it is the largest figure this corpus produces. The registry is keyed on (TEI prefix, ALTO ids), so ONE duplicated id reported under `zoneLine_`, `path_`, `line_` and `string_` counted as four — a fourfold exaggeration on the line the summary now prints as a repaired source defect, which would have made the biggest number in the report the least trustworthy one. It counts distinct ids now, and carries its denominator: "7 of 64 ids" says a defect was widespread, "7 of 7" says nothing. The count crosses the process boundary in the worker's return tuple, because that is the one measurement made inside a forkserver child that the summary needs and a logger call there never reaches the parent. Two defects that `render_count` caught by refusing to print, which is exactly what it was written for: A denominator was taken as the largest rather than summed over documents, so two volumes losing 3 of 754 pages each rendered "6 of 754" — refused outright rather than printed. And the accounting sentence was being truncated at the hundred-column cap: `(1 more held no` . The cap keeps composed blocks scannable; this line is data, and a cut number is a wrong number where a long line is only long. It is the one line never truncated, and the width test says so. The golden file is untouched. 1071 tests, coverage 91.69. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MpzP6TdBk94j1otp8pTo5f
`--fail-on {never,incident,loss}`, `--strict`, `--max-page-loss`, and the
exit codes 4 and 5. "Important" is not a threshold to invent: block 3 is
titled *this needs a human*, and that is the definition. Block 2 never
counts at any level, because punishing the chain for rejecting a
hallucination would punish it for being honest. 4 is total failure, and a
run stopped early by --fail-fast is never 4 — it did not prove the corpus
unconvertible.
The review found the gate could not fire. `--fail-on incident` was in
--help and in the guide while the only block-3 loss anything emitted was a
failed document, which already exits 1 by itself. So the counter split the
design asked for is here: `containers_failed` was one number for four
unrelated causes, incremented from four places, and it is now four lines
across two blocks — a guard refusing to anchor annotations to the wrong
characters is not the same fact as a service refusing to answer, and its
log level drops from ERROR to WARNING accordingly. A failed modernization
batch was swallowed by a `continue` and a DEBUG line, so sixty-four lines
that never reached VieuxParler were indistinguishable from sixty-four that
were already modern; both counters exist now, and a test asserts every
incident code has a producer somewhere outside the file that declares it.
The other findings, each with a test:
The headline and the verdict could disagree about how big the corpus was —
one counted `broken`, the other `failed_archives`. That is the single
disagreement the shared record exists to prevent.
A skipped page was located by its page NUMBER, but a locator's whole
promise is that the id IS the ALTO file stem: `OCR/D/12.xml` and
`//surface[@xml:id='12']` exist nowhere, and `located()` was counting
those as addresses the reader could open.
`pages_written` added the volume's total, ignoring the count that
`pages_read` exists to keep, so the summary printed "754 of 754 written"
one line above "pages unusable 3 of 754".
`Run.phase(..., LOST)` raised out of the collector on its own defaults —
after recording the loss, leaving the record holding an entry the journal
never got. A reporter must not be able to kill the run it reports on.
`located()` and the panel's source counter treated repaired ALTO ids as
losses, so a clean run reported six thousand unlocatable ones. `Code
.repaired` exists precisely to keep repairs out of loss arithmetic.
An unreadable directory was filed as a corrupt archive: wrong diagnosis,
and an address that is a directory. It has its own code now.
The panel tested a phase note against a literal taken from one sample
document, and the digest appended " ids" to whatever integers a fold
happened to carry — "8 ids" over a warning about worker counts.
1106 tests, coverage 92.1, ratchet raised to 92.0. Golden untouched.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SVwGPQx73aibsv8PeHiRQS
…reen The review's last finding was that nine hundred lines of panel had no caller: no `--plain`, no `--dashboard`, and `TDOUCE_UI` read nowhere. So the rules it ships — CI detection, the minimum window, the ASCII fallback — protected nothing. They are wired now, and a test drives a real run through each reporter and asserts the two end on the same summary, line for line. That is the property the shared record exists for. Warnings no longer print above the panel. Every WARNING+ record goes to the digest through a logging handler, which is what absorbs eighty of them a volume without a single call site changing; the file handler still receives all of it, and the console handlers come back when the panel is torn down. The bridge folds a record it cannot even format rather than dropping it — a reporter must not be the thing that ends a four-hour job. The panel redraws on every change rather than at volume boundaries, which is the only way a phase that has been waiting forty seconds on a service looks different from one that has stopped. Four things the first real run showed, each now with a test: `--fast` painted three services red. Nobody had asked for them: a service with no request is off, not down, and red says the machine is broken. The banner has the three states the rest of the report already had. `eta ` with nothing after it read as a broken template. A run that has not finished a volume cannot estimate, and saying nothing beats inventing. A warning shape too long for its line was truncated from the right, which dropped the counts — the reason the line exists — and kept the prose. It gives up its own text now. And the folded integers were shown on single occurrences, where nothing was summed: "No metadata row for 'LIV9002_reconciled'" rendered a total of 9 002. An identifier read as a count is the same confident wrong answer the invented "ids" unit was. 1122 tests, coverage 92.18. Golden untouched. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SVwGPQx73aibsv8PeHiRQS
tei_output/.teille-douce/runs/20260903-180824/
run.json argv, every setting and where it came from, and
what happened to each volume
incidents.jsonl one incident per line, appended as it happens
pipeline.log this run's log, moved in at the end
The log is the transcript and the JSONL is its index: no fact is stored
twice in two forms that could diverge. Ten runs are kept and a directory
is pruned whole, so an index cannot outlive its transcript.
Ctrl-C used to lose all of it. `execute` catches `Exception`; a
KeyboardInterrupt is a BaseException and went straight through, so the
summary — which lives outside the progress block — never ran, and four
hours of work ended with nothing said and nothing to resume from. It is
caught where the report can still be written: exit 130, what was written
stays written, the manifest lands, and the verdict says "interrupted"
rather than passing judgement on a corpus nobody finished looking at. The
quality gate is skipped for the same reason.
`--retry-failed` reads that manifest and converts only what the last run
could not. Nothing to retry exits 3 saying so — there is no selector, and
an empty retry is not a typo.
Two things the tests forced into a better shape.
The log was going to be written straight into the run directory, which
sits under the output directory — so the first log record created the
output directory, and a run that then refused to start left it behind,
breaking the exit-3 promise. The design said "moved from the repo root",
and moving it at the end is what keeps both properties.
And an output directory that cannot be written made the store raise,
which meant the report killed the run it was reporting on. It records the
problem and says so once, the way the lazy log handler already does.
The manifest needed `Settings.as_manifest()`: value and origin per config
key, coerced to JSON-safe forms — a Path surviving into the dump would
only be discovered at the end of a four-hour run.
1160 tests, coverage 92.15. Golden untouched.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SVwGPQx73aibsv8PeHiRQS
The developer guide still described `_env*` helpers in `config.py`, which moved into the declaration table in PR2a: one row per setting gating all four layers, and a flag that is refused being a usage error rather than a fallback. "Every phase must report what it lost" was a rule a new phase could forget. It says what enforces it now — `render_count` raising on a missing denominator — and the three blocks get their own section, because which block a loss belongs to is the decision a new phase actually has to make: block 3 is the definition of "important", block 2 never counts at any level, and a repaired defect stays out of loss arithmetic entirely. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SVwGPQx73aibsv8PeHiRQS
Two reviews, and both found something that made a claim in this branch false. `containers_total` was read in three places and written nowhere. Every lost phase therefore recorded `0 of 0 containers` — verbatim the sentence CLAUDE.md forbids, produced by the code written to forbid it. It stayed invisible because `whole_phases_lost()` counts document names and still looked right, so the summary read plausibly while the record, the panel totals, `located()` and `--fail-on incident` were all blind. The key is `containers_found`. `_containers_failed` read the enrichment pipeline's split keys, which modernization does not have: a container VieuxParler refused printed a console warning and reached the record not at all. It reads the split when there is one and the total when there is not. And the panel's setup was straight-line code. A signal arrives at an arbitrary instruction, not conveniently inside the one `try` the loop had, so a real Ctrl-C took the whole teardown with it: the digest handler stayed on the root logger swallowing every later warning, the console handler was gone for good, `_QUIET` stayed true, Rich's Live kept the cursor — and the summary and the manifest that the previous commit added to survive an interruption were lost anyway. It is a context manager now, and the loop is guarded whole. The tests that named this were injecting the interrupt inside the only protected region, and without a terminal, so the panel they were about was never even up. Three more from the same reviews: The denominator was keyed on the document alone, so one volume losing containers to both enrichment and modernization summed 53 against a total of 4 — which `render_count` refuses, at the very last step of a four-hour run. Keyed on (document, step). Two causes sharing `Code.CONTAINER_FAILED` kept only the first diagnosis: `2 broken + 90 refused` printed "92 containers — the pipeline raised on these". Right count, wrong cause. The exit-5 verdict said "no enrichment at all" whatever the phase was, so a run that lost modernization was told to restart PyHellen. And the digest summed the digits of the document name along with the message's own, because the prefix was stripped for the shape and not for the numbers — `LIV0044_reconciled` and `LIV0043_t1_reconciled` fold to one shape and shifted every position. 1177 tests. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SVwGPQx73aibsv8PeHiRQS
… dead Ten more findings, from the review of the run integration and the one of the panel. **Two runs started in the same second shared a run directory.** `_run_log_path` carries a pid for exactly this reason and the store reintroduced the collision, so the second run's `Path.replace` destroyed the first's log and its manifest overwrote the first's — while both exited reporting a record that was not theirs. The pid is in the stamp now, after the timestamp so `latest()` still sorts by when a run began. **One failed write cost the whole record.** `_ready()` latched on the first problem, and `adopt_log` runs before `finish`, so an ordinary layout — cwd and `-o` on different filesystems, where `Path.replace` raises EXDEV — left the directory empty: no manifest, and with it no `--retry-failed`. Failures are deduplicated rather than latched. **The remedy the summary prints did not work.** The manifest wrote `LIV9003_reconciled.zip` while every selector matches a stem, so the `--retry-failed` the report offers answered "No volume matches" and exited 3. **A corpus where nothing could be opened left no record at all** — that path exits before the store exists, so the next run was told nothing had failed. And a manifest that cannot be read now says so instead of reporting a clean previous run. **Exit 3 left a log behind.** A warning emitted during setup opens the lazy handler, and the refusal walked past it: that is how twenty-five orphan `pipeline_*.log` came to sit at the repository root. There is one refusal path now, and it removes what it created. On the panel: The LOST line — the longest one it composes, and the one whose cause the design says must be loud — was never clipped, so from 56 to 79 columns Rich cropped the cause away. Everything composed goes through one `clip` now, which measures in **cells** rather than characters (a CJK glyph is two columns for one `len()`), strips control characters (an httpx error message is two lines, and a clip by length keeps the newline: one rendered line, two on screen), and refuses a negative room — where `[:room]` used to count from the end and *lengthen* the line. The banner fused the last service into the log name, producing "NER localog", and at 56 columns dropped the third service silently — from the banner that exists to show one dying. And the incident list was unbounded while `height` was accepted and ignored: thirty volumes with both services dead is a sixty-nine-line panel, and Rich ellipsises from the bottom, so the bar, the totals and the ctrl-c foot were what disappeared. `TDOUCE_UI` was the one `TDOUCE_*` variable that bypassed the settings layer: no flag, no config key, no origin, absent from the manifest, and an empty value — a normal CI idiom — aborted the run with exit 2 after the metadata had loaded. It is a declaration like every other now. The rate read `0.0 pages/s` for seven frames in ten because the redraw callback passed no measurement, and nothing computed an `eta` at all. The estimate is a median of seconds-per-page over the volumes that finished — a median so that one volume spent against a dead service does not move the figure for the other twenty-six — and it says how many samples it rests on. `report/plain.py` is deleted rather than wired. It had no caller because what it emits is what the per-document chatter already prints: wiring it would have printed every FAILED twice. The claim that two reporters read one collector is now made only where it is true — the end-of-run report, which is byte-identical either way and tested to be. 1187 tests, coverage 92.34. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SVwGPQx73aibsv8PeHiRQS
Seen on a real run, which no test showed: a finished corpus ended on "3 written · 0 failed · 1 to go" with nothing left to do. Archives and unreadable directories are in the denominator — they are volumes the run was asked to convert — but the failed count only held documents, so the remainder absorbed them. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SVwGPQx73aibsv8PeHiRQS
The verification pass found twelve more, and the worst of them are the previous round's own work. **The denominator doubled.** Giving each cause its own step — so that two diagnoses survive — met the (document, step) key added in the same commit, and the same hundred containers were summed once per cause: `92 of 200` for a volume that has a hundred. And the fix it was meant to deliver was not delivered anyway, because the summary still grouped by code and took the first detail: `2 broken + 90 refused` still printed "the pipeline raised on these". Grouped by (code, cause) now, denominated per (document, phase). **`0 of 0 containers` is still emitted** — for modernization. The fix read `containers_found`, which only the enrichment pipeline writes, so half the phases kept producing the sentence the report exists to make impossible. The body walk counts what it was given. **The panel's height trim made the panel taller.** With no incidents it inserted " +0 more incidents" and returned one line over the height it was handed — on every frame of every clean run at the documented minimum window. Then the ones the same round missed: Two composed lines never reached `clip` after all, so a six-digit total or a three-digit volume count ran off the edge and Rich cropped the ctrl-c foot. The banner's first-fit loop dropped the *dead* service first, since `✗ NAME LOST hh:mm` is the longest label by construction — from the banner that exists to show one dying. The pid was not zero-padded, so "1234" sorted before "987" and the newer of two concurrent runs was both missed by `--retry-failed` and deleted first by the retention. `_keep_the_record` reached one of the two early-exit paths and never adopted the log, leaving an index without its transcript. `_refuse` deleted a log the operator had named with `--log-file`, contradicting the judgment the summary path makes twenty lines away. The teardown was not atomic, so a second Ctrl-C inside `Live.stop()` left the process with the digest handler, no console handler and `_QUIET` stuck true — the exact state the context manager exists to prevent, one frame inward. The ETA counted pages of failed volumes for ever. And an interrupt printed a literal `\n`, from a Python escape that survived a move. 1203 tests, coverage 92.33. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SVwGPQx73aibsv8PeHiRQS
Seen on a real run: "No metadata row for 'LIV9002_reconciled'" folded across two volumes printed `2 volumes 18 006` — 9002 plus 9004, two identifiers added together and shown beside a volume count with no unit to tell them apart. The guard added last round only covered a single occurrence, which was treating a symptom: whether the integers inside a folded message are counts or identifiers is exactly the thing the fold cannot know. It says what it does know — how many times, and in how many volumes. The one case where the sum was worth having, duplicate ALTO ids, is already a line of the summary measured against its own denominator. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SVwGPQx73aibsv8PeHiRQS
Third round in a row on the same sentence, and this time on the reason
rather than the symptom. `containers_found` is what every loss of a phase
is measured against, and both phases set it AFTER the point where a dead
service returns — enrichment after its probe, modernization inside a walk
that only runs once the service has answered. So the one case the
denominator exists for still rendered `0 of 0 containers`. Each previous
fix moved the read; this one moves the count, to the top of the phase,
before anything can fail.
The test that guarded it was hollow: it handed `_phase_lost` a literal
`{"containers_found": 900}`, a dict production could not produce on that
path, so it passed before the fix as well as after. The new ones drive
`enrich_body` and `modernize_body` with the service dead.
Two other half-deliveries from the same round:
Sorting the dead service first was not enough to keep it on the banner,
because the fill is first-fit: a `✗ NAME LOST hh:mm` too long to fit was
still skipped and a shorter live label kept its place — at 56 columns,
the width the module calls its floor. A dead service that will not fit
whole is shortened now. A truncated alarm still reads as an alarm.
And counting the failures that never opened reached corrupt archives but
not unreadable directories, which were recorded after the panel had come
down: a finished run read "1 written · 0 failed · 1 to go" beside
"incident 0", over a summary reporting one. They are recorded before the
loop, like the archives.
Also: the teardown no longer swallows in total silence — a Live that
failed to stop leaves the cursor somewhere and the operator is owed the
reason; the run-directory name in the guide and in the module docstring
had missed two format changes; and the digest's kept example is the same
stripped string as its shape.
1210 tests, coverage 92.33.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SVwGPQx73aibsv8PeHiRQS
…e is doing A visible run is what found this, and no test could have. `Run.phase()` had exactly one caller in the whole codebase — `_phase_lost` — and only ever for a phase that DIED, so every line the panel draws for a phase that is going WELL, its bar, its rate, its clock, was unreachable code. The per-container callbacks fed Rich's old `Progress` and nothing else. And `Live(auto_refresh=False)` over a snapshot renderable meant the panel only ever redrew when the collector changed, which during enrichment is never: 4 frames in fifteen minutes of real work, all of them showing `0:02`. An operator reads that as a hung run. Every panel test built its `PanelState` by hand, phases already filled in, clock already advanced. Nothing had ever driven the collector from the real pipeline. The new pty test does, and it is the only kind that could: Rich reads the mere presence of `FORCE_COLOR` — which the piped e2e harness sets on purpose — as "this is not a terminal", so a `Live` under it draws once at teardown however alive it is. Measured after: 592 frames in 150 seconds, and `enrich ◜ ██████████████░░░░░░ 826/1 198 containers` on the screen while it happens. The drawing side now runs on a thread, so the collector took a lock — one lock, held across the whole render rather than a second one of its own, because the reader also walks `digest` and `record` and two locks taken in two orders is a four-hour run hanging on a half-drawn frame. Event-driven draws are rate-limited to the same four a second, or a fourteen-hundred-container volume would spend a core on the report; the teardown forces one last frame past the limit, since the final state change lands inside the interval and the panel would freeze one frame short of the truth. Then the two review agents, and what they found: `_pad` clipped the composed line, so the RIGHT column went first — and in all five call sites the right column is the short fixed field that carries the news. An absolute `-o` path, the ordinary case, took the elapsed time and the estimate off the top line on every frame, and the path lost its own leaf as well. It keeps the right column now and shortens the left, and a path keeps the directory it names. The summary had the same function written a second time, measuring in `len()` and keeping control characters: two losses differing only in their cause rendered as the same line at eighty columns, and a two-line httpx reason split one FAILED record into two, the second a bare fragment. Both now use one `report/text.py`. The height trim only ever cut incident lines, so a clean run with the corpus' ordinary warning flood returned fifteen rows for twelve and Rich cropped the closing rule and the ctrl-c foot from the bottom — the exact outcome the trim exists to prevent, in the case it never fired for. The elastic blocks are budgeted before they are composed, there is a last-resort guarantee, and `MIN_HEIGHT` is 16 because that is what the panel measures. `Loss.count` for a lost phase stored what the phase MANAGED, which for a dead service is nought, while `RunRecord.total` sums that field as what was LOST: `incident 0` printed directly above three incident lines. `_open_read or _open_pages` could not tell "not measured" from "measured, and every page was unusable", so a volume that read nothing reported writing all 754. `failed_last_time` assumed the manifest decodes to a dict — `null` is valid JSON — and raised AttributeError past the caller's guard, out of the CLI as a traceback with exit 1. `prune` could delete the run doing the pruning. NER reported nothing at all, so a corpus whose entity recognition died everywhere exited 0 under `--fail-on incident`. A corpus nothing could be opened from exited 1 and indexed no incident. The teardown warning was logged while the digest handler was the only one left on root — written to a screen nobody would ever draw again. The summary's last line advised `teille-douce report --block incident`, which exits 2. And one of the fifth round's own tests was hollow: it passed on the pre-fix panel too. 1245 tests, coverage 92.32. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SVwGPQx73aibsv8PeHiRQS
…eep its numbers Two review agents on the whole branch. Eighteen findings, all reproduced, and the one that matters most is mine from the round before: I gave the summary the panel's rule for a two-column line and it is inverted there. On the panel the right column wins — `elapsed`, `47%`, `9.1 pages/s` against an elastic path. In the summary the LEFT wins: it holds the label and the count, and at sixty-four columns `11 of 16 pages` had become `11 of 1…`, which is not a shorter number but a wrong one. Both halves of a block entry are load-bearing, so where the width holds neither the cause moves under its own entry instead of either being cut. `pad` takes which side survives as an argument now, and clips the other rather than dropping it. Three more lines escaped that contract in the other direction and are exempt by name, because a cut one is a wrong one: the headline, the verdict, and a `next` command — `cat …/incidents.jsonl…` does not run. The test that was meant to catch all this used a fixture that never reached a phase loss, a failed volume, a gate or a next step, which is most of the lines the module can compose. **The gate blamed a repair.** `gate_verdict` computes exactly which codes tripped the run and the summary threw that away, re-deriving the lines from the blocks the LEVEL names — so `--fail-on loss` printed the repaired ALTO ids the gate deliberately skips, and a literal `nothing`, underneath NOT MET. And when both bars were crossed it named one of them while printing the other's lines. **The banner could not show a service dying**, which is the state it was drawn for: `Service.lost_at` was built nowhere but in the render tests. A run whose VieuxParler died after the probe drew a green tick beside three incident lines naming it as dead, in the same frame. **Three phases never said they had finished.** `_phase_done` was called for sourceDoc, enrich and ner; for modernize nowhere at all, so its spinner turned beside a full bar through NER, the header override and the write. `body+lang` said nothing at all — a Rich task and no reporter call — so the panel drew a finished sourceDoc over an empty gap. Enrichment was let out by `and enrich_stats`, one branch away. The guard is now a test that drives the real `_process_document`: a structural one reading the source for a call to `_phase_done` finds the failure path's and proves nothing, which is exactly how this survived. **Block 2 was structurally empty.** `READING_REJECTED` and `ENTITY_FILTERED` had no emitters at all: a divergent modernization kept as its original was counted into a local and sent to a DEBUG line, and a pruned entity to a `logger.info`. So "withheld on purpose … nothing" printed over runs that had withheld hundreds — the two cases CLAUDE.md names for that block, by name. **Ctrl-C printed a multiprocessing traceback over the report** in sixteen of thirty timings, once straight through the final verdict line. The forkserver is started before the loop now, at an instant when there is nothing to interrupt, and SIGINT is DEFERRED across the pool's birth rather than ignored: ignoring it lost three interrupts in fourteen, and a Ctrl-C that does nothing is worse than an ugly traceback. Fourteen of fourteen now: exit 130, no traceback, none swallowed. Also: `store.incident` was called inside the collector's lock, so the drawing thread waited on a filesystem write; `as_manifest` dropped one of the two settings sharing `limits.concurrency`, asserting a value the run never used; `Run.step()` had no caller, so every failed volume was filed under `"step": "run"`; `--retry-failed` said "nothing failed last time" over an output directory whose record could not be read; a 30.03 % page loss printed as `30%` against a bar documented as "more than 30"; `--no-probe --require-services` exited 3 where every other contradictory pair exits 2; and the index call I added last round for corrupt archives wrote nothing, because `ARCHIVE_CORRUPT` is block 1 by design. Two of last round's tests passed on the pre-fix code and now bite. 1260 tests, coverage 93.00, ratchet 92.9. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SVwGPQx73aibsv8PeHiRQS
Eighth round, two agents, ten findings. The one that mattered was mine
from the round before, again, and again a half-delivery.
**SIGINT was deferred across the pool's birth and restored only on the
happy path.** `Pool()` raises — too many open files, a forkserver that
will not start — and `execute` catches Exception around each document,
so the run carried on over every remaining volume with the deferring
handler still installed. Ctrl-C silently dead. Which is exactly the
outcome deferring instead of ignoring was chosen to avoid, one branch
away. It is a `finally` now, with a sentinel rather than `None` for "no
handler installed", because `signal.signal` legitimately returns None.
The two tests I wrote to guard that deferral asserted on
`inspect.getsource()` strings — the "structural test that reads the
source and proves nothing" the last commit message condemns two
paragraphs earlier. Neither would have caught the leak. They send a real
signal now.
**The summary's width fix landed on the block entries and not on the
block it was written for.** `_share` exists so the quality gate's line
proves the loss cleared the bar, and that line was still on `_columns`:
at fifty-six columns with a volume named the way this corpus names them,
the share was gone entirely; at sixty, `30.…`. And `_entry`'s two-line
form spent the second line on the cause and clipped the count —
`1 402 of 4 …`, the `11 of 16 pages` case reproduced inside its own
remedy. The order is fixed now and stated: the alignment column gives way
first, then the cause moves to its own line, then the label is shortened.
The count never gives way. `NOT MET` keeps its own line the other way
round, being the verdict of the block against an elastic list of flags.
**The verdict named a cause the level does not count.** `--fail-on never
--max-page-loss 30` is a supported pair, and a run that also lost a phase
announced it on the last line — the one wrappers grep — over a gate block
that had correctly named the one bar it failed. Same defect as the gate
blaming a repair, one function later.
**A retry the service never answered was filed as "the guards did their
job".** `still_bad` counted a reading the divergence guard refused and a
retry REQUEST that raised, and sent both to block 2 — which no
`--fail-on` level counts, by design. So a VieuxParler that died during
the retry phase produced zero incidents and the run exited 0.
**The modernize bar was measured in one unit and labelled another.** The
callback fires once per HTTP batch; the phase was declared in containers.
The bar filled to "10 of 10 containers" on a document with twenty-three
and then jumped to 23 of 23 — the denominator changing meaning mid-phase,
on the phase whose bar an operator watches longest. Enrichment had the
same shape: its callback counts requests, and a container can be several.
**`Locator.input_path` returned a path that has never existed** on this
corpus — a volume's pages live under `content/data/doc_N/` — and
`xpath()` returned `//surface`, which matches nothing in a namespaced
file. Both are the module's stated design ("a file to open, an XPath that
lands"); both were asserted by tests comparing them to a literal string.
They resolve now, against a real directory and a real tree.
Also: a Ctrl-C anywhere outside the document loop — loading the CSVs,
probing, unpacking archives, which is minutes on the real corpus — came
out as a raw traceback; `count_containers` had no None guard where its
sibling does; and every collector mutator now takes the lock its own
comment says they all take.
The ratchet goes to 92.5 and not to the last figure measured: three clean
runs on one tree gave 92.82, 93.07, 93.07, because the number of data
files the workers and E2E subprocesses leave behind varies. A bar with a
tenth of a point of headroom is a red CI once in three.
1269 tests, coverage 93.07.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SVwGPQx73aibsv8PeHiRQS
Ninth round. Same shape, three times over: the rule the last round
stated landed on the lines it was tested against and not on the ones it
was written for.
**The run's own page accounting was the line that lost its count.** "The
count never gives way" reached `_entry` and the gate's page-loss line,
and `→ <output> … N of M pages written` still went through the
block-entry rule — where the LEFT is the load-bearing half. So an
absolute `-o`, which `panel.py` rightly calls the ordinary case, dropped
the count off the summary at every width from fifty-six to ninety-five,
the default included. Every test in the suite used a short relative
path, so nothing could see it.
Two more in the same function: `{label:<22}` pads to twenty-two and
stops, so a label of exactly that ran into its own number —
`..._tome_II30.03%`, and this corpus's longest volume name is
twenty-one characters, one away. And the clamp meant to protect the
count produced `3 of 1 402 volumes · 1 699 998 containers lo…` at every
width under fifty-five. The order is stated and now holds all the way
down: alignment column, then the cause to its own line, then the label,
then the indent. The number is last, and where a composite will not fit
whole the supplement is dropped rather than cut — a shorter true
sentence over a longer false one.
**A second Ctrl-C still threw away everything the first one promised to
keep.** Wrapping the writing was not enough: the second one lands during
the panel's teardown, which is above that block's own `finally`. Four
sweeps in six still ended with one TEI file, no run directory, no
manifest, no summary. It is held from inside the interrupt handler now,
through the teardown and the report, and honoured on the way out. Six of
six.
**`warm_up` had the very bug `_UNSET` was introduced to fix**, one
function above it — and it installs SIG_IGN, so its leak would be Ctrl-C
dead for the whole run rather than for one document. A SIGINT deferred
during a `Pool()` that then raised was also dropped on the floor; the
interrupt outranks whatever the pool was complaining about.
**A retry nobody answered was labelled in batches and counted in lines.**
Block 3 was right, the arithmetic was right, and `_block_lines` honoured
a loss's own unit for `PHASE_LOST` alone — so it printed `57 of 1 402
batches` over two numbers that are lines. It has a code of its own now:
a batch that went through and a per-line retry that was never answered
are not the same event.
And the test I wrote last round for the progress units was an
`inspect.getsource` regex — the pattern the last two commit messages
both condemn. Forcing every phase back to "containers" left it passing.
It watches the reporter now. `main.py` no longer answers a Ctrl-C during
its own imports with a traceback out of pandas.
1275 tests, coverage 93.05.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SVwGPQx73aibsv8PeHiRQS
Tenth round, and the worst finding is a regression I introduced in the ninth. `HeldInterrupts.release` raised `KeyboardInterrupt` from the `finally` that restores the handler, which REPLACES whatever was already on its way out — including the `sys.exit(exit_code)` that is the run's last statement. A run whose summary printed `exit 5` and whose manifest recorded 5 handed the shell 130: the one code documented as "not a verdict on the corpus", so a wrapper retries instead of looking at what was lost. It swallowed real exceptions the same way, leaving a failed manifest write as a bare "Interrupted" with the cause in `__context__`. It does not raise now. By the time it releases, everything is written and printed; an interrupt that arrives then has stopped nothing, and the run says so in a line rather than by changing its own answer. **And the hold covered only the path it was tested on.** It sat inside the loop's `except KeyboardInterrupt`, which is reached only when a first interrupt has already arrived — so a run that finished cleanly went through the panel's teardown, the accounting and the gate unprotected, and one Ctrl-C there lost the run directory, the manifest and the summary alike. It is held from the loop's own `finally` now, on every way out, and released at the end of the run. A second interrupt during the handler's own `console.print` also went straight past, so the hold is that handler's first statement too. Sixteen triple-interrupt timings and sixteen single ones: manifest, summary and verdict every time. Three more lines were still cutting a number, and each is the same half-delivery: the rule reached the callers it was tested against. - The run's page accounting — rewritten LAST round for this very reason — cut the count below thirty-eight columns and erased the path and the arrow between thirty-two and forty-five, because `pad(keep="right")` clips the composite. It takes a second line now, like a block entry. - `_located_line` never got the rule at all: `1 699 998 precise · 2 77…`. - The panel's running phase line cut `waiting 47s/120s` down to `waiting 47s/12…` — a twelve-second timeout on a hundred-and-twenty second one, on the line whose entire job is telling slow from hung, at the panel's own minimum width. It now has a stated order too: the bar goes, then the trailing figure whole, and the numbers never. Three denominators in the retry accounting were wrong in three different ways: a retry phase that lost all six of its lines read `6 of 40` because it was measured against the first pass; `batches failed` was measured against itself, so it could only ever say a hundred per cent; and the unanswered retries were also folded into `lines_lost`, so block 3's two lines claimed twenty-two lines for sixteen. And three of the last round's claims had no regression test at all — removing the hold, reverting the builder, reverting the launcher each left the suite green. They have behavioural ones now: the launcher's is driven by an import hook rather than by a timed signal, because a signal early enough to land in the imports is also early enough to land before the interpreter has a Python handler, and the test would be measuring the race. 1281 tests, coverage 93.03. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SVwGPQx73aibsv8PeHiRQS
…hanges Eleventh round. My own change last round widened the phase-name column from twelve cells to thirteen and recomposed the RUNNING branch against it — and left PENDING and LOST clipping against a literal `room - 15`, which was right only for twelve. Every one of those lines ran a cell past the edge, and where a clock follows, that cell was the room `reserved` had just been added to set aside for it: `1:12:…`, the exact string the new docstring says `reserved` exists to prevent, now at every width from fifty-six to ninety-two where the parent produced it only below ninety- two. The budget is measured off the column now. **The hold leaked whenever the panel's teardown raised.** It is taken in the loop's `finally`, which is INSIDE `with panel_installed(...)`, and the only release is after that `with` exits — so a teardown that raised left the process deaf to Ctrl-C. Last round that needed a teardown failure AND an interrupt; taking the hold on every way out of the loop made it every teardown failure. The only way past that point now is with the signal restored. **And the raise had moved one statement over.** `release()` no longer raises, but the `console.print` it guards does — a `BrokenPipeError` out of that `finally` replaces the run's `SystemExit` with the verdict in `__context__`, which is round nine's failure mode verbatim. The note goes to the log and to stderr now, guarded: to stderr because the summary's last line is the verdict and this printed after it, and to the log because stdout is transient and an interrupt in that stretch left no trace a reader coming back on Thursday could find. Also: the page-accounting line — rewritten twice already — passed the bare room where every neighbour reserves `_MARGIN`, and called eight cells enough for a path, which is how `→ …_output` came to stand for `tei_output`. `pad(keep="left")` emitted a separator with nothing after it, so a block heading ended in a space at the widths where the aside did not fit. The three claims the last round could not guard now have tests: reverting `panel.py` and `summary.py` together used to leave the suite byte-identical, and six new tests fail against that parent. 1288 tests, coverage 93.08. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SVwGPQx73aibsv8PeHiRQS
…copy Twelfth round. Four of the last six found my previous round's fix as the defect; this makes five. **The release I added last round sits inside `with Progress(...)`, and the release has to be outside it.** `Progress.__exit__` is Rich stopping a Live and writing to the console — the `BrokenPipeError` risk the same commit message worries about two paragraphs along — and it runs between the hold taken in the loop's `finally` and any release. So a process whose progress bar failed to close was left deaf to Ctrl-C, with no summary and no manifest: the state the guard was added to make unreachable. And the hole it did close was barely reachable, because `panel_installed` already swallows everything out of the panel's own teardown. **The raise had moved one statement over again.** `release()` does not raise; the `print` it guards does, and the guard caught `OSError` alone. A closed stderr raises `ValueError` — so it escaped the `finally` and replaced the run's `SystemExit(5)`, which is the failure mode of two rounds ago inside the guard written to prevent it. And `2>&-` makes `sys.stderr` None, where `print(file=None)` falls back to stdout: the note back in the report, after the verdict, which is the placement it had just been moved away from. It was also said twice, and under `-qq` — the level whose help says the reader accepts losing warnings — only the unsuppressable copy survived. **And the literal had a third copy.** Round 10 widened the phase-name column from twelve cells to thirteen; round 11 fixed two of the three budgets that invalidated and left the third, six lines below them, in the caller of the function it had just fixed — in a commit titled "a budget written as a literal goes wrong the moment its column changes". The cause line under a lost phase sat one column short of the mark it explains. Two more the sweep found, both older than this round: The phase head was the one span on the panel that was never clipped, so a name wider than the terminal ran past the edge, trailed its column's own pad, and ate the room the clock had been promised — `1:12:…` once more, moved from the narrow case to the long-name one. And the totals row lost `incident` entirely below fifty columns and cut it mid-number up to sixty-two: `incident 9 99…`, on the row that exists so a counter is not mistaken for a document that had nothing to process. The separators give way now, then the words; the numbers never. The three places a number is printed whole even when it does not fit are named in one comment instead of being three accidents, and the test knows all three. `_short_log` measures in cells. The margin has a test of its own, because every width assertion in the suite compares against the terminal and none against the margin — which is why one line ran to a hundred cells where its neighbours stop at ninety-eight. Of the eight tests the last round added, four passed against its own parent; one of them I had weakened while rewriting it. Five new ones here all fail against theirs. 1292 tests, coverage 93.11. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SVwGPQx73aibsv8PeHiRQS
Thirteenth round, and the sixth in eight where the defect found is my own fix from the round before. Last round moved the `try:` out above `with Progress(...)`, because `Progress.__exit__` runs between the hold and the release. It left `interrupts = HeldInterrupts()` bound INSIDE. So anything that raised before that binding — `Progress()` starting a Live, the first `store.incident` write hitting a full disk — reached a handler whose first statement reads it, and came out as a raw `UnboundLocalError` with the real cause buried in `__context__`. Which is the failure this stretch is guarded against, reproduced one frame outside it, and the exact shape round eleven pinned a test for. **The round's two panel fixes disagreed with each other.** One clipped the phase head; the other measured the cause's indent off the UNCLIPPED name. So as soon as the head was shortened the cause landed past the mark it explains, and at four-and-twenty columns it was consumed whole — the line that tells a misconfiguration from a service that died. It is measured off what was actually drawn now, and a cause with no room left is not printed at all rather than printed as a row of blanks. **And `_short_log` was made to measure in cells and left cutting in characters**, with the ellipsis unpaid for: a wide-glyph `--log-file` ran the banner four cells past the edge. `_located_line` got its adaptive indent on the second line of a two-line pair and not on the first — this branch's own recurring shape, in the commit that named it. Below thirty columns the label now goes on a line of its own, because neither figure can be shortened. Three more call sites passed the bare room where every neighbour reserves `_MARGIN`. `release()` could still raise: `getsignal` answers None for a handler installed outside Python — the premise `_UNSET` exists for — and `signal(SIGINT, None)` is a TypeError out of the `finally` that calls it, replacing the run's exit code. The one thing its docstring promises it will never do. The exemption comment said three and the code had four, which is how `Interrupted: …` came to be outside the list the tests check. The fourth is a `next` command: a number and a command are each printed whole or not at all, for the same reason. And `panel.py` shipped four fixes with no test — reverting the module left the whole suite green. Its contract is a property now, stated over names and figures wider than production has, because every one of those four was a value wider than the column it was budgeted for. 1297 tests, coverage 93.12. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SVwGPQx73aibsv8PeHiRQS
Fourteenth round, and the seventh in nine where the finding is my own fix from the round before. `release()` was made not to raise. Its guard reads `except (TypeError, ValueError)`, and the statement inside it is `signal.signal(SIGINT, default_int_handler)` — the identical call. `signal.signal` raises `ValueError` for exactly one reason, not being on the main thread, so the `ValueError` arm could only ever re-raise what it caught: out of the `finally`, over the run's `SystemExit(5)`, which is the one thing the method's own docstring three lines above promises it will never do. It also skipped the two statements after it, so the object was left believing it still held and the next `hold()` did nothing. The whole method is guarded now, and it forgets it was holding whatever happened. `ValueError` is named in the comment as the one not to catch there, with the reason. **And the `finally`'s guard was one statement too narrow.** The `logging.info` sat above the `try:` whose comment explains what it is for. `logging`'s own `handleError` catches `OSError` alone, so a console handler over a closed stream raised `ValueError` out of that `finally` — verbatim the failure the comment one line below it describes. Three of the round's tests did not reach what they were named for: - the panel property test caught three of the four fixes it was written for and not `_short_log`, because the log name in its fixture is one the character cut happens to handle; - the cause-alignment test swept from forty columns, and the two indents it compares differ only from twenty-four to twenty-nine — where the head is clipped, which is the whole premise; - the margin test rendered neither a failed volume nor a `next` block, so two of the three call sites it guards were never composed. That is the round-seven "fixture that never reached a failed volume or a next step" shape, inside the test written to replace it. All three reach it now, verified by mutating the code four ways. One thing left as it is, and said rather than hidden: a Ctrl-C landing after the report is written and the handler given back still kills the process, so the shell sees 130 over a manifest that says 0. The interpreter is unwinding at that point and the report is complete and correct; a process killed by a signal reporting 130 is not a false statement, and the alternative is going deaf during the unwind. 1300 tests, coverage 93.10. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SVwGPQx73aibsv8PeHiRQS
… not
The fourteenth review round turned up no new production defect worth the
name — the interrupt path, rewritten in five consecutive rounds, came
through every timing and every injection point — and turned up
overwhelming evidence about something else: fifteen tests in two files
pass under a mutation of the line they are named for, and around fifteen
fixes from earlier rounds have no effective guard at all.
That is the honest reading of "seven of nine rounds found the previous
round's fix". The review was not finding bugs faster than they were
written; it was finding that the tests did not hold, and each round then
added a test written the same way as the ones that had failed. So this
round is the mutation pass instead of a fifteenth reading of the diff.
**One branch of `run.py` was executed by none of thirteen hundred tests.**
`spoken` asked whether any root handler was a non-file `StreamHandler` at
INFO or below — and pytest's own capture handler is exactly that, at
level 0. So under the suite the answer was always yes, the `print` behind
it never ran, and the two tests written to reach it stopped one line
short. At the default level, `-q` and `-qq`, that print is the operator's
only copy of the note. A console is now a handler on stdout or stderr.
**`release()` could still raise the exception four rounds ago was written
to stop.** The outer guard was `except Exception`, and a SIGINT delivered
between the restore and the return is a `KeyboardInterrupt` — out of the
`finally`, over the run's verdict. Two bytecodes wide and not reproducible
in two hundred timings, and one word to close. The same arm now installs
the default handler rather than only swallowing, because the line below
it forgets what was held: a restore that failed would otherwise leave the
deferring lambda in place with no record of the real handler, and the
next `hold()` saving a lambda.
**The installed `teille-douce` had no import guard.** The fix for a Ctrl-C
during pandas' quarter-second lived in `main.py` alone, and the console
script is the form every page of the documentation uses. It has a
launcher of its own now, which imports nothing expensive.
And the guards. `048ea69`'s loop-`finally` hold — the fix for a clean run
interrupted during the panel teardown — could be replaced with `pass`
with the suite still green, because the test named for it raised its
signal inside a stretch already held by something else. Two tests from
last round passed against their own parent. The margin test reached two
of its three call sites, and the third was hidden by the test's own
exemption, which excused the whole line where it should have excused only
a figure that cannot fit. The header test asserted the first field of the
right column, which is the one a clip keeps. The cause-alignment test
compared character offsets, which is the very mutation its docstring
cites. The plural test asserted `not any("1 volumes")` over a verdict that
short-circuited before composing the sentence.
Every one of those is now verified by mutating the code and watching the
test go red.
CLAUDE.md and the developer guide say what to look for, because the four
shapes are recognisable and the check takes a minute.
1303 tests, coverage 93.05.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SVwGPQx73aibsv8PeHiRQS
Ninety-six mutations run against `a8f1ab1`. Eleven of the thirteen the reviewer set as acceptance criteria were caught; thirty-seven of the eighty-three I did not aim at survived. None of the survivors is a wrong line — every one is a missing test — which is a different situation from the one that prompted the pass, where fifteen tests passed under mutations of the lines they were named for. The one criterion that failed is the word this branch's previous commit message says it verified. `release()`'s guard was widened from `except Exception` to `except BaseException` because a SIGINT between the restore and the return is a `KeyboardInterrupt`; the three tests around it inject `TypeError`, `ValueError` and `RuntimeError`. Every one exercises the mechanism and none the distinguishing case. That is a fifth shape for the guide, and the guide now has it. The six survivors that would be visible to an operator: - `RunRecord.total` counting repaired defects would put this corpus's six thousand disambiguated ALTO ids in the panel's `source` cell, turning every ordinary run into an alarm. The line that skips them was exercised by no test that had one in the record. - A lost phase whose total is `None` — Rich's own indeterminate, so it arrives from an ordinary callback — would raise a `TypeError` from inside the reporter, the one component that must never end a run. - `whole_phases_lost` counting entries rather than volumes: with both services down, one volume said "2 volumes carry no enrich and no modernize". Every test so far used one phase per volume, where a set and a list agree. - The panel's counts row could have `written` and `failed` swapped with the suite still green, on the row an operator reads first. - A block with nothing in it could stop saying `nothing`, which is the whole reason the blocks are named rather than implied. - `test_a_repaired_defect_is_not_written_as_a_loss` asserted `"repaired" in text`, satisfied by the LABEL `ALTO ids repaired` — so the marker that says nothing was lost could be deleted and the test named for it stayed green. And the headline — `Done.` against `Completed with errors`, the line every wrapper greps — is asserted where it is composed, in `execute`, rather than in a renderer that only prints what it is handed. Each is verified by mutating the line and watching the test go red. 1311 tests, coverage 93.07. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SVwGPQx73aibsv8PeHiRQS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR 2b of the CLI rebuild. A run now says what it is doing while it does it, and what it lost once it has. PR 2a gave
runits arguments; this gives it a voice.The golden file is untouched. Nothing here changes a byte of TEI — only what is said on screen and written beside the output.
The word "lost" covered three unrelated causes
They have three different remedies, so they are three blocks:
containers_failedwas one counter for four of those causes, incremented from four places, which is why blocks 2 and 3 could not be written honestly until it was split. A failed modernization batch was swallowed by acontinueand a DEBUG line, so sixty-four lines that never reached VieuxParler were indistinguishable from sixty-four already modern.A number that cannot be judged is not reported
render_count(n, denominator, unit)raises when the denominator is missing. CLAUDE.md already said a counter left at zero because a server died must not look like a document that had nothing to process; as a sentence it was a wish, as aValueErrorit is a rule. It caught two real bugs during this branch: a denominator taken as the largest rather than summed over documents (6 of 754for two volumes losing 3 each), and the accounting sentence being truncated at the hundred-column cap.Every loss carries a document, a step and a typed locator.
Kind.DOCis the floor and an admission the summary prints. Never an internal index —container 12andbatch_start 640are what the pipeline used to say, and neither is something a reader can open. A page id is worth four addresses at once, becausesurface/@xml:idis the ALTO file stem.The loudest number in this corpus was wrong. The id registry is keyed on
(TEI prefix, ALTO ids), so one duplicated id reported underzoneLine_,path_,line_andstring_counted as four. It is the line the summary now prints as a repaired source defect — a fourfold exaggeration would have made the biggest figure in the report the least trustworthy one.The panel
render_panel(state, width, …)is a pure function returning lines of(text, style), so six moments of a four-hour run are testable in milliseconds and the no-colour parity is structural: strip every style and the panel says the same thing. Rich does the live redraw, the colour degradation and the terminal detection, and none of the layout — which is what makes the hundred-column cap an assertion rather than a hope, and the ASCII fallback provably the same panel.The bar is three measurements and never a model — pages written, pages read in the volume still open, pages not read — because a learned per-phase weighting would be the only number on the screen capable of being wrong by a factor of two.
waiting 47s/120sis what tells slow from hung, which is the state a four-hour run spends most of its time in.The pipeline is named after taille-douce, and an engraver renders a value by the density of the hatching: the bar is a hatch that fills. The palette is copper, bister, verdigris, vermilion and graphite, and no background is ever painted — a panel that paints its own ground fights the theme the reader chose.
Eighty WARNING lines a volume used to push all of this off the screen. They are folded by shape through a logging handler, so no call site changed; nothing is discarded, only the number of lines is bounded, and the file handler still receives every record.
The quality gate
"Important" is not a threshold to invent — block 3 is titled this needs a human, and that is the definition.
Block 2 never counts at any level: failing a run because a guard rejected a hallucination would punish the chain for being honest. Exit 4 is total failure (and never a run stopped early by
--fail-fast, which did not prove the corpus unconvertible); exit 5 is everything converted and still not acceptable, only when nothing else failed.What a run leaves behind
The log is the transcript and the JSONL its index; no fact is stored twice in two forms that could diverge. Ten runs are kept and a directory is pruned whole, so an index cannot outlive its transcript. This also ends the twenty-one orphan logs at the repository root:
log_filewas the one setting with no home.Ctrl-C used to lose all of it.
executecatchesException; aKeyboardInterruptis aBaseExceptionand went straight through, so the summary never ran. It is caught where the report can still be written — exit 130, what was written stays written, the manifest lands, and the verdict says interrupted rather than passing judgement on a corpus nobody finished looking at.--retry-failedreads that manifest.What the reviews caught
Twelve findings across four passes, each with a test. The ones worth naming:
--fail-on incidentcould not fire. It was in--helpand in the guide while the only block-3 loss anything emitted was a failed document, which already exits 1 by itself. A test now asserts every incident code has a producer outside the file that declares it.broken, the otherfailed_archives. That single disagreement is what the shared record exists to prevent.OCR/D/12.xmland//surface[@xml:id='12']— addresses that exist nowhere — were being counted as things the reader could open.Run.phase(..., LOST)raised on its own defaults, and an unwritable output directory made the store raise.What the review rounds changed
Thirteen rounds of agent review, and the two findings that mattered most
came from watching a real run rather than from reading the code.
The panel was frozen.
Run.phase()had one caller in the wholerepository — the one that reports a phase that DIED — so every line the
panel draws for a phase that is going well was unreachable code. And
auto_refresh=Falseover a snapshot meant the clock, the estimate and thespinner only moved when the collector changed, which during enrichment is
never: 4 frames in fifteen minutes, all of them reading
0:02. Itredraws on a clock now: 592 frames in 150 seconds, with
enrich ◜ ██████████████░░░░░░ 826/1 198 containerson screen while ithappens. No test could have caught it — every panel test built its state
by hand, and the piped e2e harness sets
FORCE_COLOR, which Rich reads as"not a terminal", so a
Liveunder it draws once however alive it is.The banner could not show a service dying, which is the one state it
was drawn for:
Service.lost_atwas built nowhere but in the rendertests.
The rest, in one line each: the quality gate blamed a repair it
deliberately skips; block 2 had no emitters at all, so "withheld on
purpose … nothing" printed over runs that had withheld hundreds; a retry
the service never answered was filed as a guard doing its job, so a dead
VieuxParler produced no incident;
11 of 16 pagesrendered as11 of 1…; a Ctrl-C printed a multiprocessing traceback across thereport in sixteen timings out of thirty; a second Ctrl-C threw away the
manifest the first one had promised to keep; and a signal arriving after
the verdict replaced it, so a run whose summary said
exit 5handed theshell 130.
The recurring shape, stated because it cost eight rounds: a rule applied
to the callers it was tested against, and not to the others. Six of the
last eight rounds found the previous round's own fix — a guard one frame
too shallow and then the variable it reads one frame too deep, a literal
budget corrected in two of its three copies, an adaptive indent given to
the second line of a two-line pair.
Verification
raised from 91.0 to 92.5 — 92.5 and not the last figure measured,
because three clean runs on one tree give 92.8 to 93.1 depending on how
many data files the workers leave behind.
git diff tests/fixtures/empty;build_odd.py --checkclean.over names, paths and figures wider than this corpus produces —
because every one of the layout defects was a value wider than the
column it had been budgeted for.
manifest, summary, verdict and cursor survive every one.
🤖 Generated with Claude Code
https://claude.ai/code/session_01SVwGPQx73aibsv8PeHiRQS