docs(dn): record task 8 fix round 4

This commit is contained in:
DEls 2026-09-19 17:34:05 +02:00
parent b5ba219d10
commit 919124facb

View file

@ -258,3 +258,45 @@ concurrent legacy run proceeded instead of returning `batch_locked`.
- The additive staged-ingestion migration remains a release prerequisite; it
must be applied before deployment. No production apply or PocketBase writes
were performed.
## Fix Round 4
Status: complete.
### RED evidence
The new fencing regressions recorded **17 intended failures** before the
implementation: protected business mutations could occur outside the lease
transaction, allowing a reclaimed owner to write after ownership loss.
### GREEN evidence
- Focused fencing, lock, page, promotion, legacy-run, staged-run, tick, and
assembly suites: **164 passed** across 9 files.
- `npm run typecheck`: passed.
- `git diff --check`: passed.
- No production PocketBase writes were performed.
### Fixes and files
- `src/lib/dn-pipeline/batch-mutations.ts` and `test-batch.ts` provide the
PocketBase batch mutation adapter and test fixture.
- `src/lib/dn-pipeline/lock.ts` exposes the fenced lease mutation helpers and
rejects SDKs without transactional batch support.
- `src/lib/dn-pipeline/page-store.ts`, `promote.ts`, `run.ts`, and
`run-staged.ts` route protected writes through the lease fence.
- `src/app/api/dn-batches/tick/route.ts` and
`src/app/api/dn-batches/[id]/assembly/route.ts` use the same protected path.
- Regression coverage is in `batch-mutations.test.ts`, `fencing.test.ts`, and
the focused lock/page/promotion/run/staged/tick/assembly test updates.
### Decision
Each business mutation shares a PocketBase batch transaction with the current
lease-record update. If the lease fence is stale or reclaimed, PocketBase
rejects the transaction and rolls back the business mutation.
### Code commit
`b5ba219d10cb2760c4776fe6751b8800e67684c6` —
`fix(dn): transactionally fence protected writes`