docs: record task 7 fix round 3

This commit is contained in:
DEls 2026-09-19 12:20:48 +02:00
parent 05eaa1fa3e
commit 6ff5b597d9

View file

@ -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.