From 6ff5b597d9cdd468020ee4228788a3c42ab84811 Mon Sep 17 00:00:00 2001 From: DEls Date: Sat, 19 Sep 2026 12:20:48 +0200 Subject: [PATCH] docs: record task 7 fix round 3 --- .../task-7-report.md | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/.superpowers/sdd/2026-09-18-hybrid-delivery-note-ingestion/task-7-report.md b/.superpowers/sdd/2026-09-18-hybrid-delivery-note-ingestion/task-7-report.md index 00798c7..b19d788 100644 --- a/.superpowers/sdd/2026-09-18-hybrid-delivery-note-ingestion/task-7-report.md +++ b/.superpowers/sdd/2026-09-18-hybrid-delivery-note-ingestion/task-7-report.md @@ -295,3 +295,59 @@ Persisted-page overlap uses the batch's stored page-number membership as the deterministic fallback after durable keys and unique printed numbers. Equal overlap scores deliberately remain unmatched and review-visible, prioritising non-overwrite safety over automatic reconciliation. + +## Fix Round 3 + +Code commit: `05eaa1f` — `fix: preserve terminal staged candidates`. + +### Review fix + +- Existing-candidate reads now include the `delivery_note` relation. Terminal + detection recognises legacy `status: promoted` and any non-empty + `delivery_note`, in addition to the existing dismissed/posted markers. + Consequently, surplus review handling cannot rewrite commercial rows that + have already promoted, even when older rows lack a modern status/stage or + `posted_at` marker. Matched terminal rows retain the existing metadata-only + reindex behavior. + +### RED evidence + +```text +pnpm exec vitest run src/lib/dn-pipeline/run-staged.test.ts +2 failed (before implementation): +- unmatched status=promoted row was rewritten to status=blocked, + stage=needs_review; +- unmatched row with delivery_note but no status/stage/posted_at was likewise + rewritten to status=blocked, stage=needs_review. +``` + +### GREEN evidence + +```text +pnpm exec vitest run src/lib/dn-pipeline/run-staged.test.ts +13 passed + +pnpm exec vitest run src/lib/dn-pipeline src/app/api/dn-batches +21 files passed; 297 tests passed + +pnpm typecheck +passed + +python3 scripts/pb-add-dn-staged-ingestion.py --self-test +passed + +python3 scripts/pb-add-dn-staged-ingestion.py --dry-run +passed; offline preview only and no schema changes written + +git diff --check +passed +``` + +### Self-review + +- The regression tests run the staged runner, not the helper in isolation: + unmatched legacy-promoted and delivery-note-related rows retain their exact + status/stage absence and note indices. The existing matched-terminal test + still proves metadata-only reindexing for a real recovered sibling. +- No promotion writes, migration apply, lease/tick/route changes, or unrelated + files were changed.