fix: repair chained imports and track blocked evidence dependencies
All checks were successful
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 2s

Assistant: codex
Assistant-Model: gpt-6.1-sol
Assistant-Session: 01a1046e-465c-7d43-8c4c-d10f0a1feadd
This commit is contained in:
tegwick 2026-10-04 11:36:06 +02:00
parent 28b567e588
commit 146f4e1dd3
21 changed files with 869 additions and 95 deletions

View file

@ -290,3 +290,27 @@ The historical SQLite importer has five PostgreSQL test failures tracked by
AUDIT-IN-0004. It is outside the live receiver path; do not use it as a recovery
procedure until that record closes. The release test result must state this
exclusion explicitly, never describe the entire suite as green.
### Historical SQLite import
`python -m audit_core migrate-store --from-sqlite <file> --source-id <stable-id>`
uses PostgreSQL custody with schema migration `0007-import-receipts`. Run this
with the migration owner's database authority, not a runtime writer identity.
Keep `source-id` unchanged across file relocation and retries; its default is
the absolute file path. Replacing a source at that path requires a new identity.
No source content is copied into the receipt table: it holds hashed source and
row identities, content fingerprints and previously imported finding counts.
Import reads one SQLite snapshot and writes under the native append advisory
lock. Historical events extend the stored link chain with original IDs, hashes,
records and exact acceptance timestamps. Existing differing evidence is reported
as a conflict and retained; no trigger is disabled and no existing chain link
is rewritten. Retries skip imported dead letters and add only the incremental
source finding count. Decreasing counts or changed historical dead letters are
conflicts. Verification checks events and the resulting chain independently.
The new PostgreSQL receiver and attestor follow links rather than sorting by
historical timestamps. Deploy that code to all PostgreSQL append/verify workers
before importing historical rows into a populated destination; older workers
still use timestamp order. Source tests do not authorize a production import.