P47 follow-ups: deferred minors from the seal-and-skip reviews #680
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Deferred minors from the P47 seal-and-skip reviews (branch
p47-seal-skip, specdocs/superpowers/specs/2026-09-08-comment-pipeline-seal-and-skip-design.md). None affect data safety; all are polish or small costs.llm/index.py: items whoseload()yields no text never get a fingerprint stamped, so they are re-loaded (one stat + one SQL read) on every run.bib/store.py::_init_schema: the duplicate-attachments GROUP BY scan runs on everyStore()open even after the unique index exists — short-circuit onsqlite_master.cli/comments.py::dockets:docket_countsruns twourl LIKEscans per docket (SQLiteLIKEcan't useidx_items_url); fine for an operator command, could be one grouped query.cli/bib.py::fetch-pfs-comments --docket: still costs one FR fetch + oneresolve_docketcall for CMS ids with nodocketsrow (documented in help; only true "no API calls" once known).cli/bib.py::fetch-pfs-comments: rule items whose docket cannot be resolved are no longer upserted to bib (the upsert moved inside the per-docket loop) — decide whether that is wanted.bib/store.py::upsert_status:extra_jsonis exempt from the empty-keeps-stored merge; a Rule re-upserted from a thinner payload can still lose extra fields — consider a per-key merge of the decoded dict.bib/dockets.py::fingerprint_filescatches onlyFileNotFoundError;cli/comments.py::extract_ocropens a read connection it never closes;regulations_gov.pysealed-guard block duplicated across both backfills;llm/source.pysection markers misplaced,_loadshadowsrow, per-item_attachment_pathsquery for rule/corpus fingerprints; Zotero snapshot never contains WAL-only rows (pre-existing).attach_file;--reattachat the CLI level; dedupe conflict path with a missing kept file.Refs #615.
Residuals parked from the final fix-wave re-review (all minor):
<target>: N sealed docket(s) already complete — not listedline incli/llm.py_delete_old_chunks, then it is fingerprint-skipped forever (pre-existing orphan made permanent; near-impossible for comments)walk_docketnow runsdocket_counts(twoCOUNT … LIKEscans) on every clean walk, not only pre-seal — compute lazily aftershould_sealstack comments sealcan seal a docket with zero stored comments (auto path is guarded)ZoteroPdfIndex.snapshot()has no production caller any more (lazy path only); keep for tests or dropDone (
f61eae8,d69d5fb, e154451; merged to main ase476050). Item 1 was already fixed on main (ed55a8f, refs #615). Items 2–7 landed: Store open skips the duplicate scan once the unique index exists; docket_counts is one query (in bib/regulations_gov.py, where the scans actually lived); --docket help text corrected; the rule is upserted before the per-docket resolve loop so an unresolvable docket never drops it; upsert_status merges extra_json per key instead of replacing the column; fingerprint_files catches OSError; extract-ocr closes its bib connection; sealed-guard duplication factored into _sealed_backfill_skip; llm/source.py batches attachment-path lookups (one attachments scan per run instead of one query per item). Tests added for the explicit-title dedupe in attach_file, --reattach at the CLI, the dedupe-migration missing-kept-file conflict and the schema short-circuit. Two of these are real behaviour changes, not cosmetic: item 5 persists rules it previously dropped, and item 6 changes what a re-ingest stores when a subclass extra_json field is blank (a no-op payload now reports unchanged). Left alone, pre-existing and out of scope: the lazy Zotero snapshot copies zotero.sqlite without its -wal sidecar, so a PDF attached since Zotero's last checkpoint is invisible to pdfs_for() until Zotero checkpoints.