00957bf384
Adds a lease-loss/reacquire integration rehearsal and fixes Dapper due-schedule materialization with an explicit row DTO. Evidence: PostgreSQL test 1/1 passed; TRX SHA256 49627FF0180034D2A7A1E4393448C73D337D918E7CE47EA9FC2BDB144FBBA833.
24 lines
2.7 KiB
Markdown
24 lines
2.7 KiB
Markdown
# AEG-V15-036 — Dispatcher next-due CAS
|
|
|
|
## Scope
|
|
|
|
- **WBS ID:** `AEG-V15-036`; **Requirement / API / DB / Job / UI / Test:** `REQ-V15-SCH-04` / `V15-SCH-API` / `MIG-0020` / `J31~J40` / `Cross` / `T-V15-SCH-04`.
|
|
- **Dependency / Gate:** `AEG-V15-035` (completed, commit `d18f6a7`) / `G3`.
|
|
- **Acceptance:** a lost lease or stale dispatcher must make zero next-due advances.
|
|
|
|
## Source / Assumption / Unknown / Decision Required
|
|
|
|
- **Source:** `MIG-0020` supplies `dispatch_revision`; acquisition increments it, but the returned due-operation contract and both advance queries currently omit it.
|
|
- **Assumption:** the acquisition revision is an optimistic-concurrency token. A transition may mutate `next_due_at` only when both the lease owner and acquired revision match.
|
|
- **Unknown:** a live PostgreSQL runner is unavailable in this session, so a concurrent integration rehearsal cannot be asserted.
|
|
- **Decision Required:** `DEC-083` transactionality between enqueue and mark is separate. This Slice prevents stale state advance but does not make Hangfire enqueue transactional.
|
|
|
|
## Actual evidence and remaining acceptance
|
|
|
|
- `dotnet test tests/KArtSell.ModelOperations.UnitTests/KArtSell.ModelOperations.UnitTests.csproj -c Release --filter "FullyQualifiedName~DapperModelScheduleRepositoryContractTests|FullyQualifiedName~ScheduleOccurrencePlannerTests|FullyQualifiedName~ModelOperationRequestServiceTests" --logger "trx;LogFileName=DispatcherCasContractTests_20260809.trx" --results-directory evidence/AEG-V15-036`
|
|
- Result: passed `8/8`; artifact: `evidence/AEG-V15-036/DispatcherCasContractTests_20260809.trx`; SHA-256: `148FF7904CAE7372DD4728C24B845E280CEEE3116E5787BE621EC8E2E9005921`.
|
|
- The test locks the repository contract: dispatched, no-dispatch advance, and release SQL must all match both the lease owner and the acquired `dispatch_revision`.
|
|
- **PostgreSQL integration:** `dotnet test tests/KArtSell.Integration.Tests/KArtSell.Integration.Tests.csproj -c Release --filter FullyQualifiedName~ModelScheduleCasTests --no-restore --logger "trx;LogFileName=ModelScheduleCasTests_20260809.trx" --results-directory evidence/AEG-V15-036` passed `1/1`; artifact SHA-256: `49627FF0180034D2A7A1E4393448C73D337D918E7CE47EA9FC2BDB144FBBA833`.
|
|
- The test inserts one isolated test-db schedule, acquires it twice after expiring the first lease, and proves the stale owner/revision cannot advance it while the reacquired owner/revision and original `next_due_at` remain intact. It cleans up that row in `finally`.
|
|
- The first integration execution exposed a real Dapper positional-record materialization failure. `DapperModelScheduleRepository` now maps a private SQL row DTO explicitly to the immutable `DueModelOperation` contract; the successful rerun is the preserved evidence.
|