Skip to content

Measure curation_history where the gap actually is (#325) - #527

Open
realmarcin wants to merge 1 commit into
mainfrom
curation-history-325
Open

Measure curation_history where the gap actually is (#325)#527
realmarcin wants to merge 1 commit into
mainfrom
curation-history-325

Conversation

@realmarcin

Copy link
Copy Markdown
Contributor

The reframing

#325 counted curation_history on 2 of 311 records and read it as a coverage gap. That framing does not survive reading the two entries. Both record a cross-reference between two ANME/SRB records — same community type, different studies, candidates for consolidation — which is a fact about the corpus that git cannot express and no other field holds.

curation_history is an event log, not a coverage metric. A record that has had no such event correctly has none, and backfilling 310 records would mean inventing events. So threshold: 0.0 is the right target, not a lenient one, and conf/qc_config.yaml now says so rather than reading as a capitulation.

Where the gap really is, measured

scripts/audit_writers.py — which already existed — reports it directly:

26 tools write record YAML. 16 append nothing.

A script that rewrites 300 records in place and leaves no trace is what #325 was pointing at. The low record count is the symptom.

What this PR does

Not fix those 16 — stop the set growing silently, and split it into the two groups a fix treats differently:

  • 7 exempt, each with a written reason: writes research/ or data/ingredients/ rather than records; creates records rather than editing them (git shows a creation in full, which is not true of an in-place edit); or is the mechanism a caller records through (write_validated.py, batch_reporter.py — the latter would double-log, since llm_repair.py:244 already records).
  • 9 owed, named individually so the backlog is itemised rather than a headline number.

A new writer in neither list fails, forcing the call when the tool is written instead of at the next audit. The test reads audit_writers.py's own output rather than re-deriving "does this write YAML" — two answers to one question means the one nobody runs is the one that drifts.

Why the 9 are not fixed here

Structural, not effort. record_curation_event appends to a parsed dict; these nine are line editors working on splitlines() + regex + write_text. That is deliberate — a YAML round-trip would reflow every record they touch, which is why term_remap describes itself as "text-only edits".

The text-append version already exists as _append_curation_event in gtdb_ground.py, private, and it already solves the parts that are easy to get wrong: the insertion point (- timestamp: is itself column-0, so an early version inserted above the existing history), idempotence (an unconditional append grew the history every re-run), and a write guard that permits at most one appended entry. Lifting it into curate/ is #526 — worth its own PR, and worth confirming outside its original caller before nine call sites depend on it.

Checks

  • uv run pytest tests/ — 2381 passed, 16 skipped
  • just lint, just validate-scalars — exit 0
  • Mutation-checked: a temporary script that writes a record and records nothing reddens test_every_writer_is_classified; removing it restores green

Closes #325. Filed #526.

🤖 Generated with Claude Code

#325 counted curation_history on 2 of 311 records and read it as coverage. That
framing does not survive reading the two entries: both record a cross-reference
between two ANME/SRB records — same community type, different studies,
candidates for consolidation — which git cannot express and no other field
holds. It is an event log. A record that has had no such event correctly has
none, and backfilling 310 would mean inventing them.

So 0.0 is the right threshold rather than a lenient one, and the config now says
why instead of reading as a capitulation.

The gap is on the writing side, and it is measurable. scripts/audit_writers.py
already reports it: 26 tools write record YAML and 16 append nothing. A script
that rewrites 300 records in place and leaves no trace is what #325 was pointing
at; the low record count is the symptom.

This does not fix those 16. It stops the set growing silently and splits it into
the two groups a fix treats differently — 7 exempt, each with a written reason
(writes research/ or data/, creates rather than edits, or is the mechanism a
caller records through), and 9 owed, named individually so the backlog is
itemised rather than implied. A new writer in neither list fails, which forces
the call when the tool is written.

Wiring the 9 needs a shared text-append helper: they are line editors, not YAML
round-trippers, so record_curation_event does not reach them. gtdb_ground.py has
one, privately. Lifting it into curate/ is the follow-up, deliberately not done
here.

Mutation-checked: a new script that writes a record and records nothing reddens
the gate.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.

curation_history is present on 2 of 311 community records

1 participant