Files
stack/tests/cli/test_bib_exercise.py
kert d69d5fb3aa fix(cli): don't drop unresolvable-docket rules; close extract-ocr's bib connection (refs #680)
- fetch-pfs-comments upserts the rule item before the per-docket
  resolve loop, so a CMS id that never resolves to a reg.gov docket no
  longer loses the rule entirely (the upsert used to live only inside
  the per-docket loop, guarded by a successful resolve).
- --docket's help text and the command docstring now say precisely
  when the "no API calls" guarantee holds: only once a dockets row
  already exists for the CMS id. A CMS id with no row yet still costs
  one FR rule-metadata fetch plus one resolve_docket call.
- extract_ocr closes the read connection _bib_lookup_factory opens
  (via the same `.close` attribute contract extract() already honours
  in its own finally), instead of leaking it.

Adds coverage: the unresolvable-docket upsert (and rewires test_no_docket
off a MagicMock rule, now that the rule is upserted unconditionally),
--reattach's repair behavior at the CLI level, and the extract_ocr
connection close.
2026-09-11 17:31:57 -04:00

20 KiB