From d12ca92468c384b4c3fa7e4175a53268459ac213 Mon Sep 17 00:00:00 2001 From: DEls Date: Sat, 19 Sep 2026 19:26:37 +0200 Subject: [PATCH] docs: record scoped ledger totals verification --- .../final-fix-report.md | 7 +++++++ .../2026-09-18-hybrid-delivery-note-ingestion/progress.md | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/.superpowers/sdd/2026-09-18-hybrid-delivery-note-ingestion/final-fix-report.md b/.superpowers/sdd/2026-09-18-hybrid-delivery-note-ingestion/final-fix-report.md index ce9a33a..3fc2369 100644 --- a/.superpowers/sdd/2026-09-18-hybrid-delivery-note-ingestion/final-fix-report.md +++ b/.superpowers/sdd/2026-09-18-hybrid-delivery-note-ingestion/final-fix-report.md @@ -39,3 +39,10 @@ The migration remains unapplied and `DN_STAGED_INGESTION_ENABLED` remains unchan Follow-up code commit: `199dfba` Follow-up focused verification: 4 files, 92 tests passed; `npm run typecheck`; `git diff --check`. + +## Follow-up 2 + +`delivery_note_items` totals are now queried with an escaped OR filter built from the batch's site-scoped purchase-order item IDs. Rows outside that set are ignored before validation. Relevant malformed quantities, including negatives, add a failed persisted gate; zero remains valid. Added regressions for unrelated malformed rows, relevant malformed/negative rows, and cumulative over-delivery. + +Follow-up 2 code commit: `bb70f33` +Follow-up 2 focused verification: 4 files, 95 tests passed; `npm run typecheck`; `git diff --check`. diff --git a/.superpowers/sdd/2026-09-18-hybrid-delivery-note-ingestion/progress.md b/.superpowers/sdd/2026-09-18-hybrid-delivery-note-ingestion/progress.md index 9509a38..f9e71dc 100644 --- a/.superpowers/sdd/2026-09-18-hybrid-delivery-note-ingestion/progress.md +++ b/.superpowers/sdd/2026-09-18-hybrid-delivery-note-ingestion/progress.md @@ -179,3 +179,7 @@ Final fix follow-up: code complete (shared required-check policy and strict cumu Final fix follow-up: focused verification passed — 4 files, 92 tests; npm run typecheck; git diff --check Ruling: staged readiness and posting use the same exported required-check helper; required checks must be true and only explicitly optional checks may be null — cost if wrong: a document remains in review until all financial gates are proven. Ruling: delivery-note item totals are loaded once per staged run and any read/schema/quantity error adds a failed persisted gate — cost if wrong: the batch pauses for operator repair instead of comparing against an unsafe zero baseline. +Final fix follow-up 2: dispatched at base 9fafec6 +Final fix follow-up 2: code complete (ledger totals scoped to site-selected PO item IDs; malformed unrelated rows ignored; malformed relevant and negative quantities fail closed; commit bb70f33) +Final fix follow-up 2: focused verification passed — 4 files, 95 tests; npm run typecheck; git diff --check +Ruling: cumulative delivery totals are filtered to the batch's site-scoped PO item IDs before quantity validation — cost if wrong: an unrelated legacy ledger row cannot block this batch, while a malformed row attached to a relevant PO item still stops posting.