fix: audit remediation Wave 2 — identity normalization C-7, C-10 (+ T-3, ADR D-1) #13
Reference in New Issue
Block a user
No description provided.
Delete Branch "fix/audit-wave-2"
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?
Wave 2 of audit remediation — identity normalization
The un-normalized-identity root behind the audit (C-7) and its riders. Stacked on
the Wave 1 branch (
fix/audit-wave-1); the diff is the three commits below.Requires a one-time corpus re-ingest — see the migration note.
Fixes
fix(ingest)— ingest stored OpenAlex's URL-formdoi/id as
papers.id(live DB confirmed 35/36 rows URL-form), breakingbare-id lookups (
graph related/discover citing/ search-by-id) andcross-citation matching. ingest now keys
papers.idon the caller-suppliedid; OpenAlex's work id stays as
openalex_id. T-3: the OpenAlex test fixtureused a bare
doi(unlike the real API) and never assertedpaper.id, whichmasked this — fixture made representative + assertion pinned.
fix(ingest)— formulas/figures were keyed on the PDF filenamestem, violating the FK to
papers(id)on rich (.pdf) ingest; now keyed onpapers.id. The rich-ingest test is strengthened into a real regression(stem ≠ id).
docs(adr)— ADR-F15 audit addendum: the "ID-format mismatch"limitation is resolved in code (C-1 resolver + C-7); the spike numbers predate
it and are flagged for re-measurement after re-ingest.
Migration required (one-time, destructive)
papers.idchanges from URL to bare form. Existing rows are not auto-replaced(different PK), so the corpus must be wiped and rebuilt:
TRUNCATE papers CASCADE;thenbash ingest_all.sh. A helper script accompaniesthis work. After migration, C-7 is verified live (ids bare) and the ADR-F15 spike
is re-measured.
Verification
ruff+mypyclean. C-7 / C-10 covered byregression tests. Live end-to-end verification follows the re-ingest.
🤖 Generated with Claude Code