feat: fence scheduler next-due updates (AEG-V15-036)

Adds dispatch revision CAS to dispatched, skip, and release schedule mutations. Targeted Release evidence: 8/8 passed. PostgreSQL concurrency rehearsal remains required; WBS stays IN_PROGRESS.
This commit is contained in:
2026-08-09 02:06:37 +09:00
parent d18f6a7a67
commit 5a1570790c
8 changed files with 144 additions and 11 deletions
@@ -0,0 +1,21 @@
# 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`.
- **Not complete:** a PostgreSQL concurrency test must acquire/reacquire the same schedule and show the stale revision updates zero rows. Until that artifact exists, the WBS remains `IN_PROGRESS`.
+1 -1
View File
@@ -514,7 +514,7 @@ AEG-V15-032,S6,W13-14,Cross,Cross-cutting,UX/Layout,LAY,REQ-V15-LAY-08,Cross,Cro
AEG-V15-033,S8,W17-18,VS-18,BacktestingEvaluation,Scheduler,SCH,REQ-V15-SCH-01,V15-SCH-API,MIG-0020,J31~J40,Cross,T-V15-SCH-01,Schedule anchor 계산기,ScheduleOccurrencePlanner,dispatch 지연이 cadence drift를 만들지 않음,BE Lead,SRE/QA,3,AEG-X-001,G3,SOURCE+DESIGN_PROPOSAL,P0,COMPLETED
AEG-V15-034,S8,W17-18,VS-18,BacktestingEvaluation,Scheduler,SCH,REQ-V15-SCH-02,V15-SCH-API,MIG-0020,J31~J40,Cross,T-V15-SCH-02,Catch-up policy 구현,LATEST/SKIP/ALL_LIMIT,장애 복구 후 job storm 0,BE Lead,SRE/QA,5,AEG-V15-033,G3,SOURCE+DESIGN_PROPOSAL,P0,COMPLETED
AEG-V15-035,S8,W17-18,VS-18,BacktestingEvaluation,Scheduler,SCH,REQ-V15-SCH-03,V15-SCH-API,MIG-0020,J31~J40,Cross,T-V15-SCH-03,Due operation 계약 확장,DueModelOperation v15,scheduledFor/catchUp/maxCatchUp 추적,BE Lead,SRE/QA,5,AEG-V15-034,G3,SOURCE+DESIGN_PROPOSAL,P1,COMPLETED
AEG-V15-036,S8,W17-18,VS-18,BacktestingEvaluation,Scheduler,SCH,REQ-V15-SCH-04,V15-SCH-API,MIG-0020,J31~J40,Cross,T-V15-SCH-04,Dispatcher nextDue CAS,schedule repository,lease 상실·중복 advance 0,BE Lead,SRE/QA,6,AEG-V15-035,G3,SOURCE+DESIGN_PROPOSAL,P0,PLANNED
AEG-V15-036,S8,W17-18,VS-18,BacktestingEvaluation,Scheduler,SCH,REQ-V15-SCH-04,V15-SCH-API,MIG-0020,J31~J40,Cross,T-V15-SCH-04,Dispatcher nextDue CAS,schedule repository,lease 상실·중복 advance 0,BE Lead,SRE/QA,6,AEG-V15-035,G3,SOURCE+DESIGN_PROPOSAL,P0,IN_PROGRESS
AEG-V15-037,S8,W17-18,VS-18,BacktestingEvaluation,Scheduler,SCH,REQ-V15-SCH-05,V15-SCH-API,MIG-0020,J31~J40,Cross,T-V15-SCH-05,BusinessHold와 기술실패 분리,execution state machine,"blind retry 0, reason/holdUntil 기록",BE Lead,SRE/QA,5,AEG-V15-036,G3,SOURCE+DESIGN_PROPOSAL,P1,PLANNED
AEG-V15-038,S8,W17-18,VS-18,BacktestingEvaluation,Scheduler,SCH,REQ-V15-SCH-06,V15-SCH-API,MIG-0020,J31~J40,Cross,T-V15-SCH-06,Schedule heartbeat/aging,execution heartbeat,stuck request 탐지와 Owner alert,BE Lead,SRE/QA,6,AEG-V15-037,G3,SOURCE+DESIGN_PROPOSAL,P0,PLANNED
AEG-V15-039,S8,W17-18,VS-18,BacktestingEvaluation,Scheduler,SCH,REQ-V15-SCH-07,V15-SCH-API,MIG-0020,J31~J40,Cross,T-V15-SCH-07,시장 timezone/calendar 계약,calendar/timezone contract,UTC 저장·시장세션 계산·DST 테스트,BE Lead,SRE/QA,4,AEG-V15-038,G3,SOURCE+DESIGN_PROPOSAL,P1,PLANNED
1 WBS_ID Sprint Weeks Slice_ID Slice Module Workstream Requirement_ID API_ID DB_Migration_ID Job_Event_ID UI_ID Test_ID Task Artifact Acceptance_Evidence Primary_Owner Secondary PD Dependency Gate Evidence_Class Risk Status
514 AEG-V15-033 S8 W17-18 VS-18 BacktestingEvaluation Scheduler SCH REQ-V15-SCH-01 V15-SCH-API MIG-0020 J31~J40 Cross T-V15-SCH-01 Schedule anchor 계산기 ScheduleOccurrencePlanner dispatch 지연이 cadence drift를 만들지 않음 BE Lead SRE/QA 3 AEG-X-001 G3 SOURCE+DESIGN_PROPOSAL P0 COMPLETED
515 AEG-V15-034 S8 W17-18 VS-18 BacktestingEvaluation Scheduler SCH REQ-V15-SCH-02 V15-SCH-API MIG-0020 J31~J40 Cross T-V15-SCH-02 Catch-up policy 구현 LATEST/SKIP/ALL_LIMIT 장애 복구 후 job storm 0 BE Lead SRE/QA 5 AEG-V15-033 G3 SOURCE+DESIGN_PROPOSAL P0 COMPLETED
516 AEG-V15-035 S8 W17-18 VS-18 BacktestingEvaluation Scheduler SCH REQ-V15-SCH-03 V15-SCH-API MIG-0020 J31~J40 Cross T-V15-SCH-03 Due operation 계약 확장 DueModelOperation v15 scheduledFor/catchUp/maxCatchUp 추적 BE Lead SRE/QA 5 AEG-V15-034 G3 SOURCE+DESIGN_PROPOSAL P1 COMPLETED
517 AEG-V15-036 S8 W17-18 VS-18 BacktestingEvaluation Scheduler SCH REQ-V15-SCH-04 V15-SCH-API MIG-0020 J31~J40 Cross T-V15-SCH-04 Dispatcher nextDue CAS schedule repository lease 상실·중복 advance 0 BE Lead SRE/QA 6 AEG-V15-035 G3 SOURCE+DESIGN_PROPOSAL P0 PLANNED IN_PROGRESS
518 AEG-V15-037 S8 W17-18 VS-18 BacktestingEvaluation Scheduler SCH REQ-V15-SCH-05 V15-SCH-API MIG-0020 J31~J40 Cross T-V15-SCH-05 BusinessHold와 기술실패 분리 execution state machine blind retry 0, reason/holdUntil 기록 BE Lead SRE/QA 5 AEG-V15-036 G3 SOURCE+DESIGN_PROPOSAL P1 PLANNED
519 AEG-V15-038 S8 W17-18 VS-18 BacktestingEvaluation Scheduler SCH REQ-V15-SCH-06 V15-SCH-API MIG-0020 J31~J40 Cross T-V15-SCH-06 Schedule heartbeat/aging execution heartbeat stuck request 탐지와 Owner alert BE Lead SRE/QA 6 AEG-V15-037 G3 SOURCE+DESIGN_PROPOSAL P0 PLANNED
520 AEG-V15-039 S8 W17-18 VS-18 BacktestingEvaluation Scheduler SCH REQ-V15-SCH-07 V15-SCH-API MIG-0020 J31~J40 Cross T-V15-SCH-07 시장 timezone/calendar 계약 calendar/timezone contract UTC 저장·시장세션 계산·DST 테스트 BE Lead SRE/QA 4 AEG-V15-038 G3 SOURCE+DESIGN_PROPOSAL P1 PLANNED
@@ -9,6 +9,7 @@ AEG-X-007,S0,Cross,Serilog/OTel correlation 고도화,COMPLETED,2026-08-06,"test
AEG-V15-033,S8,VS-18,Schedule anchor 계산기,COMPLETED,2026-08-09,"docs/CURRENT/AEG-V15-033_SCHEDULE_ANCHOR_SLICE_NOTE.md; src/KArtSell.Modules.ModelOperations/Domain/ScheduleOccurrencePlanner.cs; tests/KArtSell.ModelOperations.UnitTests/ScheduleOccurrencePlannerTests.cs; evidence/AEG-V15-033/ScheduleOccurrencePlannerTests_20260809.trx",BE Lead,"Actual Release run: dotnet test tests/KArtSell.ModelOperations.UnitTests/KArtSell.ModelOperations.UnitTests.csproj -c Release --filter FullyQualifiedName~ScheduleOccurrencePlannerTests; 2/2 passed. Characterizes the approved scheduledFor anchor and missed-occurrence skip behavior. No schedule was enabled; market-calendar/timezone (DEC-079), dispatch enqueue/mark atomicity (DEC-083), leases, database integration, and later scheduler WBS evidence remain out of scope."
AEG-V15-034,S8,VS-18,Catch-up policy 구현,COMPLETED,2026-08-09,"docs/CURRENT/AEG-V15-034_CATCH_UP_POLICY_SLICE_NOTE.md; src/KArtSell.Modules.ModelOperations/Domain/ScheduleOccurrencePlanner.cs; src/KArtSell.Modules.ModelOperations/Scheduling/ModelOperationsDispatcherJob.cs; src/KArtSell.Modules.ModelOperations/Infrastructure/DapperModelScheduleRepository.cs; tests/KArtSell.ModelOperations.UnitTests/ScheduleOccurrencePlannerTests.cs; evidence/AEG-V15-034/ScheduleOccurrencePlannerTests_20260809.trx",BE Lead,"Actual Release run: targeted ScheduleOccurrencePlannerTests 4/4 passed. LATEST_ONLY dispatches only the latest anchored occurrence; SKIP_MISSED advances the lease-held schedule without enqueueing stale work; ALL_WITH_LIMIT dispatches only the configured most-recent occurrences, each with an occurrence-specific UTC idempotency key. Schedules remain disabled. Database integration, lease CAS, and DEC-083 enqueue/mark atomicity are not claimed and remain owned by later WBS items."
AEG-V15-035,S8,VS-18,Due operation 계약 확장,COMPLETED,2026-08-09,"docs/CURRENT/AEG-V15-035_DUE_OPERATION_CONTRACT_SLICE_NOTE.md; src/KArtSell.Modules.ModelOperations/Application/ModelOperationsContracts.cs; src/KArtSell.Modules.ModelOperations/Application/ModelOperationRequestService.cs; src/KArtSell.Modules.ModelOperations/Scheduling/ScheduledModelOperationJob.cs; src/KArtSell.Modules.ModelOperations/Infrastructure/DapperModelOperationRequestRepository.cs; tests/KArtSell.ModelOperations.UnitTests/ModelOperationRequestServiceTests.cs; evidence/AEG-V15-035/DueModelOperationContractTests_20260809.trx",BE Lead,"Actual Release run: 5/5 targeted unit tests passed. The scheduler occurrence, catch-up policy, and max catch-up flow from due schedule through the serialized job and validated application request; scheduled_for is inserted in the normalized request model and all three values are retained in the transactional outbox payload. Schedules remain disabled. No new migration or PostgreSQL integration evidence is claimed: MIG-0020 already provides scheduled_for; policy and limit provenance is immutable in the event payload, while schedule configuration remains the normalized source referenced by schedule_id/version."
AEG-V15-036,S8,VS-18,Dispatcher nextDue CAS,IN_PROGRESS,TBD,"docs/CURRENT/AEG-V15-036_DISPATCH_CAS_SLICE_NOTE.md; src/KArtSell.Modules.ModelOperations/Application/ModelOperationsContracts.cs; src/KArtSell.Modules.ModelOperations/Infrastructure/DapperModelScheduleRepository.cs; src/KArtSell.Modules.ModelOperations/Scheduling/ModelOperationsDispatcherJob.cs; tests/KArtSell.ModelOperations.UnitTests/DapperModelScheduleRepositoryContractTests.cs; evidence/AEG-V15-036/DispatcherCasContractTests_20260809.trx",BE Lead,"Implemented acquired dispatch_revision as an optimistic CAS token across dispatched, no-dispatch advance, and release paths; dispatcher passes the acquired revision. Actual targeted Release evidence: 8/8 passed. Remains IN_PROGRESS: PostgreSQL concurrent lease-loss/reacquire integration proof (stale revision affects 0 rows) is required before Acceptance_Evidence 'duplicate advance 0' can be claimed. Schedules remain disabled; DEC-083 remains unresolved."
AEG-V16-017,S6,Cross,FieldShell 표준,IN_PROGRESS,TBD,"docs/CURRENT/AEG-V16-017_FIELDSHELL_SLICE_NOTE.md; frontend/src/shared/ui/components/FieldShell.vue; frontend/src/shared/ui/components/tests/FieldShell.spec.ts","FE Lead","2026-08-08: FieldShell now owns label/error/help/ARIA relationships for KsTextField, KsTextArea, KsSelect, KsDateField, and KsNumberField. Actual evidence: frontend pnpm typecheck PASS; pnpm test PASS (19 files, 42 tests); pnpm build PASS. Build emitted unrelated tracked .js drift, excluded from this Slice. COMPLETED is blocked pending WBS Master/tracker reconciliation and AEG-V16-016 vendor-boundary acceptance evidence."
AEG-V16-016,S0,VS-00,Vendor boundary fitness,IN_PROGRESS,TBD,"docs/CURRENT/AEG-V16-016_VENDOR_BOUNDARY_SLICE_NOTE.md; tools/validate_v16.py; frontend/src/shared/ui/adapter/tests/uiAdapter.contract.spec.ts; evidence/AEG-V16-016/validate_v16_20260808.log; evidence/AEG-V16-016/ui-adapter-tests_20260808.log; evidence/AEG-V16-016/frontend-typecheck_20260808.log","FE Lead","2026-08-08: Removed stale fixed WBS row-count assertion; validator now verifies WBS ID integrity and reports vendor imports outside the approved adapter boundary. Re-executed actual evidence: python tools/validate_v16.py PASS=1 WARN=2 FAIL=0; targeted adapter tests 4/4 PASS; frontend typecheck PASS. COMPLETED is blocked because dependency AEG-V16-015 has no approved acceptance evidence in the tracker."
AEG-V16-015,S0,VS-00,Adapter rollback runbook,BLOCKED,-,"docs/CURRENT/ui-provider-switch.md","FE Lead","2026-08-08: Runbook exists, but status is BLOCKED before completion: acceptance requires visual/a11y/performance rollback rehearsal evidence, which is not present; direct dependency AEG-V16-014 has no tracker evidence. A runbook does not substitute for an approved visual baseline, keyboard/focus and accessible-name report, state-matrix result, agreed performance budget, immutable-artifact rollback rehearsal, and append-only release evidence. No build/test/migration claimed by this status correction."
1 WBS_ID Sprint Slice_ID Task Status Completion_Date Evidence_Link Owner Notes
9 AEG-V15-033 S8 VS-18 Schedule anchor 계산기 COMPLETED 2026-08-09 docs/CURRENT/AEG-V15-033_SCHEDULE_ANCHOR_SLICE_NOTE.md; src/KArtSell.Modules.ModelOperations/Domain/ScheduleOccurrencePlanner.cs; tests/KArtSell.ModelOperations.UnitTests/ScheduleOccurrencePlannerTests.cs; evidence/AEG-V15-033/ScheduleOccurrencePlannerTests_20260809.trx BE Lead Actual Release run: dotnet test tests/KArtSell.ModelOperations.UnitTests/KArtSell.ModelOperations.UnitTests.csproj -c Release --filter FullyQualifiedName~ScheduleOccurrencePlannerTests; 2/2 passed. Characterizes the approved scheduledFor anchor and missed-occurrence skip behavior. No schedule was enabled; market-calendar/timezone (DEC-079), dispatch enqueue/mark atomicity (DEC-083), leases, database integration, and later scheduler WBS evidence remain out of scope.
10 AEG-V15-034 S8 VS-18 Catch-up policy 구현 COMPLETED 2026-08-09 docs/CURRENT/AEG-V15-034_CATCH_UP_POLICY_SLICE_NOTE.md; src/KArtSell.Modules.ModelOperations/Domain/ScheduleOccurrencePlanner.cs; src/KArtSell.Modules.ModelOperations/Scheduling/ModelOperationsDispatcherJob.cs; src/KArtSell.Modules.ModelOperations/Infrastructure/DapperModelScheduleRepository.cs; tests/KArtSell.ModelOperations.UnitTests/ScheduleOccurrencePlannerTests.cs; evidence/AEG-V15-034/ScheduleOccurrencePlannerTests_20260809.trx BE Lead Actual Release run: targeted ScheduleOccurrencePlannerTests 4/4 passed. LATEST_ONLY dispatches only the latest anchored occurrence; SKIP_MISSED advances the lease-held schedule without enqueueing stale work; ALL_WITH_LIMIT dispatches only the configured most-recent occurrences, each with an occurrence-specific UTC idempotency key. Schedules remain disabled. Database integration, lease CAS, and DEC-083 enqueue/mark atomicity are not claimed and remain owned by later WBS items.
11 AEG-V15-035 S8 VS-18 Due operation 계약 확장 COMPLETED 2026-08-09 docs/CURRENT/AEG-V15-035_DUE_OPERATION_CONTRACT_SLICE_NOTE.md; src/KArtSell.Modules.ModelOperations/Application/ModelOperationsContracts.cs; src/KArtSell.Modules.ModelOperations/Application/ModelOperationRequestService.cs; src/KArtSell.Modules.ModelOperations/Scheduling/ScheduledModelOperationJob.cs; src/KArtSell.Modules.ModelOperations/Infrastructure/DapperModelOperationRequestRepository.cs; tests/KArtSell.ModelOperations.UnitTests/ModelOperationRequestServiceTests.cs; evidence/AEG-V15-035/DueModelOperationContractTests_20260809.trx BE Lead Actual Release run: 5/5 targeted unit tests passed. The scheduler occurrence, catch-up policy, and max catch-up flow from due schedule through the serialized job and validated application request; scheduled_for is inserted in the normalized request model and all three values are retained in the transactional outbox payload. Schedules remain disabled. No new migration or PostgreSQL integration evidence is claimed: MIG-0020 already provides scheduled_for; policy and limit provenance is immutable in the event payload, while schedule configuration remains the normalized source referenced by schedule_id/version.
12 AEG-V15-036 S8 VS-18 Dispatcher nextDue CAS IN_PROGRESS TBD docs/CURRENT/AEG-V15-036_DISPATCH_CAS_SLICE_NOTE.md; src/KArtSell.Modules.ModelOperations/Application/ModelOperationsContracts.cs; src/KArtSell.Modules.ModelOperations/Infrastructure/DapperModelScheduleRepository.cs; src/KArtSell.Modules.ModelOperations/Scheduling/ModelOperationsDispatcherJob.cs; tests/KArtSell.ModelOperations.UnitTests/DapperModelScheduleRepositoryContractTests.cs; evidence/AEG-V15-036/DispatcherCasContractTests_20260809.trx BE Lead Implemented acquired dispatch_revision as an optimistic CAS token across dispatched, no-dispatch advance, and release paths; dispatcher passes the acquired revision. Actual targeted Release evidence: 8/8 passed. Remains IN_PROGRESS: PostgreSQL concurrent lease-loss/reacquire integration proof (stale revision affects 0 rows) is required before Acceptance_Evidence 'duplicate advance 0' can be claimed. Schedules remain disabled; DEC-083 remains unresolved.
13 AEG-V16-017 S6 Cross FieldShell 표준 IN_PROGRESS TBD docs/CURRENT/AEG-V16-017_FIELDSHELL_SLICE_NOTE.md; frontend/src/shared/ui/components/FieldShell.vue; frontend/src/shared/ui/components/tests/FieldShell.spec.ts FE Lead 2026-08-08: FieldShell now owns label/error/help/ARIA relationships for KsTextField, KsTextArea, KsSelect, KsDateField, and KsNumberField. Actual evidence: frontend pnpm typecheck PASS; pnpm test PASS (19 files, 42 tests); pnpm build PASS. Build emitted unrelated tracked .js drift, excluded from this Slice. COMPLETED is blocked pending WBS Master/tracker reconciliation and AEG-V16-016 vendor-boundary acceptance evidence.
14 AEG-V16-016 S0 VS-00 Vendor boundary fitness IN_PROGRESS TBD docs/CURRENT/AEG-V16-016_VENDOR_BOUNDARY_SLICE_NOTE.md; tools/validate_v16.py; frontend/src/shared/ui/adapter/tests/uiAdapter.contract.spec.ts; evidence/AEG-V16-016/validate_v16_20260808.log; evidence/AEG-V16-016/ui-adapter-tests_20260808.log; evidence/AEG-V16-016/frontend-typecheck_20260808.log FE Lead 2026-08-08: Removed stale fixed WBS row-count assertion; validator now verifies WBS ID integrity and reports vendor imports outside the approved adapter boundary. Re-executed actual evidence: python tools/validate_v16.py PASS=1 WARN=2 FAIL=0; targeted adapter tests 4/4 PASS; frontend typecheck PASS. COMPLETED is blocked because dependency AEG-V16-015 has no approved acceptance evidence in the tracker.
15 AEG-V16-015 S0 VS-00 Adapter rollback runbook BLOCKED - docs/CURRENT/ui-provider-switch.md FE Lead 2026-08-08: Runbook exists, but status is BLOCKED before completion: acceptance requires visual/a11y/performance rollback rehearsal evidence, which is not present; direct dependency AEG-V16-014 has no tracker evidence. A runbook does not substitute for an approved visual baseline, keyboard/focus and accessible-name report, state-matrix result, agreed performance budget, immutable-artifact rollback rehearsal, and append-only release evidence. No build/test/migration claimed by this status correction.
@@ -0,0 +1,76 @@
<?xml version="1.0" encoding="utf-8"?>
<TestRun id="e8ba3fd9-5f8c-4350-906d-f8c2663d9f25" name="kjh20@KIMJAEHYUN-NOTE 2026-08-09 02:05:58" runUser="KIMJAEHYUN-NOTE\kjh20" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
<Times creation="2026-08-09T02:05:58.4874475+09:00" queuing="2026-08-09T02:05:58.4874481+09:00" start="2026-08-09T02:05:57.3784500+09:00" finish="2026-08-09T02:05:58.4952065+09:00" />
<TestSettings name="default" id="f687f642-76bc-400a-93b7-5083d12ad6b1">
<Deployment runDeploymentRoot="kjh20_KIMJAEHYUN-NOTE_2026-08-09_02_05_58" />
</TestSettings>
<Results>
<UnitTestResult executionId="37ed0979-46cf-4c56-9819-333e2703dff1" testId="4a0acb4c-da35-f6d9-1253-fba8b2ec4ae4" testName="KArtSell.ModelOperations.UnitTests.ScheduleOccurrencePlannerTests.Missed_occurrences_are_skipped_without_dispatch_storm" computerName="KIMJAEHYUN-NOTE" duration="00:00:00.0002713" startTime="2026-08-09T02:05:58.3903311+09:00" endTime="2026-08-09T02:05:58.3903744+09:00" testType="13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b" outcome="Passed" testListId="8c84fa94-04c1-424b-9868-57a2d4851a1d" relativeResultsDirectory="37ed0979-46cf-4c56-9819-333e2703dff1" />
<UnitTestResult executionId="c1187da7-890a-4e22-a97e-c655cf36e40d" testId="0a21da25-b516-7b73-6e2d-51090a81fb76" testName="KArtSell.ModelOperations.UnitTests.DapperModelScheduleRepositoryContractTests.Every_next_due_mutation_requires_the_acquired_dispatch_revision(fieldName: &quot;DispatchedSql&quot;)" computerName="KIMJAEHYUN-NOTE" duration="00:00:00.0000108" startTime="2026-08-09T02:05:58.3875147+09:00" endTime="2026-08-09T02:05:58.3875534+09:00" testType="13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b" outcome="Passed" testListId="8c84fa94-04c1-424b-9868-57a2d4851a1d" relativeResultsDirectory="c1187da7-890a-4e22-a97e-c655cf36e40d" />
<UnitTestResult executionId="913a6cb9-441c-4fbe-a98e-fc2b1c35ff95" testId="42622f9c-8837-0fa6-cb49-0be424719bcd" testName="KArtSell.ModelOperations.UnitTests.ScheduleOccurrencePlannerTests.Skip_missed_advances_without_dispatching_a_stale_occurrence" computerName="KIMJAEHYUN-NOTE" duration="00:00:00.0088669" startTime="2026-08-09T02:05:58.3583397+09:00" endTime="2026-08-09T02:05:58.3798095+09:00" testType="13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b" outcome="Passed" testListId="8c84fa94-04c1-424b-9868-57a2d4851a1d" relativeResultsDirectory="913a6cb9-441c-4fbe-a98e-fc2b1c35ff95" />
<UnitTestResult executionId="f309f89c-31d4-4b91-9811-1288f7a6606f" testId="4cc4638d-542d-f501-1295-718da6fcbfd1" testName="KArtSell.ModelOperations.UnitTests.ScheduleOccurrencePlannerTests.Daily_anchor_does_not_drift_to_dispatch_time" computerName="KIMJAEHYUN-NOTE" duration="00:00:00.0002333" startTime="2026-08-09T02:05:58.3901511+09:00" endTime="2026-08-09T02:05:58.3902066+09:00" testType="13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b" outcome="Passed" testListId="8c84fa94-04c1-424b-9868-57a2d4851a1d" relativeResultsDirectory="f309f89c-31d4-4b91-9811-1288f7a6606f" />
<UnitTestResult executionId="9090de1a-1f5e-46dc-bea4-0eaf726c9c08" testId="782313a2-91d4-3e53-1365-894664840aa6" testName="KArtSell.ModelOperations.UnitTests.DapperModelScheduleRepositoryContractTests.Every_next_due_mutation_requires_the_acquired_dispatch_revision(fieldName: &quot;AdvanceSql&quot;)" computerName="KIMJAEHYUN-NOTE" duration="00:00:00.0002417" startTime="2026-08-09T02:05:58.3865306+09:00" endTime="2026-08-09T02:05:58.3874268+09:00" testType="13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b" outcome="Passed" testListId="8c84fa94-04c1-424b-9868-57a2d4851a1d" relativeResultsDirectory="9090de1a-1f5e-46dc-bea4-0eaf726c9c08" />
<UnitTestResult executionId="fc0c9f88-0017-4bf4-8fe8-6ad61fe47459" testId="b5368be1-af87-7993-926e-d1aab98e87f9" testName="KArtSell.ModelOperations.UnitTests.DapperModelScheduleRepositoryContractTests.Every_next_due_mutation_requires_the_acquired_dispatch_revision(fieldName: &quot;ReleaseSql&quot;)" computerName="KIMJAEHYUN-NOTE" duration="00:00:00.0058250" startTime="2026-08-09T02:05:58.3600173+09:00" endTime="2026-08-09T02:05:58.3756292+09:00" testType="13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b" outcome="Passed" testListId="8c84fa94-04c1-424b-9868-57a2d4851a1d" relativeResultsDirectory="fc0c9f88-0017-4bf4-8fe8-6ad61fe47459" />
<UnitTestResult executionId="480f1b06-875a-44c6-b6d0-f40b82317b03" testId="734f2a89-2b23-0864-3bdc-dd5d2c1e065a" testName="KArtSell.ModelOperations.UnitTests.ScheduleOccurrencePlannerTests.All_with_limit_dispatches_only_the_most_recent_configured_occurrences" computerName="KIMJAEHYUN-NOTE" duration="00:00:00.0139334" startTime="2026-08-09T02:05:58.3873812+09:00" endTime="2026-08-09T02:05:58.3898958+09:00" testType="13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b" outcome="Passed" testListId="8c84fa94-04c1-424b-9868-57a2d4851a1d" relativeResultsDirectory="480f1b06-875a-44c6-b6d0-f40b82317b03" />
<UnitTestResult executionId="dcdfe078-1407-4689-ad2f-5d4bed21b110" testId="60773dbd-c959-2ad9-4ce3-ac2f4b7149da" testName="KArtSell.ModelOperations.UnitTests.ModelOperationRequestServiceTests.Persists_the_scheduled_occurrence_and_catch_up_provenance" computerName="KIMJAEHYUN-NOTE" duration="00:00:00.0122406" startTime="2026-08-09T02:05:58.3599669+09:00" endTime="2026-08-09T02:05:58.3893117+09:00" testType="13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b" outcome="Passed" testListId="8c84fa94-04c1-424b-9868-57a2d4851a1d" relativeResultsDirectory="dcdfe078-1407-4689-ad2f-5d4bed21b110" />
</Results>
<TestDefinitions>
<UnitTest name="KArtSell.ModelOperations.UnitTests.ScheduleOccurrencePlannerTests.All_with_limit_dispatches_only_the_most_recent_configured_occurrences" storage="d:\jobroomz\kartsell.aegis\tests\kartsell.modeloperations.unittests\bin\release\net10.0\kartsell.modeloperations.unittests.dll" id="734f2a89-2b23-0864-3bdc-dd5d2c1e065a">
<Execution id="480f1b06-875a-44c6-b6d0-f40b82317b03" />
<TestMethod codeBase="D:\JobRoomz\KArtSell.Aegis\tests\KArtSell.ModelOperations.UnitTests\bin\Release\net10.0\KArtSell.ModelOperations.UnitTests.dll" adapterTypeName="executor://xunit/VsTestRunner3/netcore/" className="KArtSell.ModelOperations.UnitTests.ScheduleOccurrencePlannerTests" name="All_with_limit_dispatches_only_the_most_recent_configured_occurrences" />
</UnitTest>
<UnitTest name="KArtSell.ModelOperations.UnitTests.DapperModelScheduleRepositoryContractTests.Every_next_due_mutation_requires_the_acquired_dispatch_revision(fieldName: &quot;ReleaseSql&quot;)" storage="d:\jobroomz\kartsell.aegis\tests\kartsell.modeloperations.unittests\bin\release\net10.0\kartsell.modeloperations.unittests.dll" id="b5368be1-af87-7993-926e-d1aab98e87f9">
<Execution id="fc0c9f88-0017-4bf4-8fe8-6ad61fe47459" />
<TestMethod codeBase="D:\JobRoomz\KArtSell.Aegis\tests\KArtSell.ModelOperations.UnitTests\bin\Release\net10.0\KArtSell.ModelOperations.UnitTests.dll" adapterTypeName="executor://xunit/VsTestRunner3/netcore/" className="KArtSell.ModelOperations.UnitTests.DapperModelScheduleRepositoryContractTests" name="Every_next_due_mutation_requires_the_acquired_dispatch_revision" />
</UnitTest>
<UnitTest name="KArtSell.ModelOperations.UnitTests.ScheduleOccurrencePlannerTests.Skip_missed_advances_without_dispatching_a_stale_occurrence" storage="d:\jobroomz\kartsell.aegis\tests\kartsell.modeloperations.unittests\bin\release\net10.0\kartsell.modeloperations.unittests.dll" id="42622f9c-8837-0fa6-cb49-0be424719bcd">
<Execution id="913a6cb9-441c-4fbe-a98e-fc2b1c35ff95" />
<TestMethod codeBase="D:\JobRoomz\KArtSell.Aegis\tests\KArtSell.ModelOperations.UnitTests\bin\Release\net10.0\KArtSell.ModelOperations.UnitTests.dll" adapterTypeName="executor://xunit/VsTestRunner3/netcore/" className="KArtSell.ModelOperations.UnitTests.ScheduleOccurrencePlannerTests" name="Skip_missed_advances_without_dispatching_a_stale_occurrence" />
</UnitTest>
<UnitTest name="KArtSell.ModelOperations.UnitTests.ScheduleOccurrencePlannerTests.Missed_occurrences_are_skipped_without_dispatch_storm" storage="d:\jobroomz\kartsell.aegis\tests\kartsell.modeloperations.unittests\bin\release\net10.0\kartsell.modeloperations.unittests.dll" id="4a0acb4c-da35-f6d9-1253-fba8b2ec4ae4">
<Execution id="37ed0979-46cf-4c56-9819-333e2703dff1" />
<TestMethod codeBase="D:\JobRoomz\KArtSell.Aegis\tests\KArtSell.ModelOperations.UnitTests\bin\Release\net10.0\KArtSell.ModelOperations.UnitTests.dll" adapterTypeName="executor://xunit/VsTestRunner3/netcore/" className="KArtSell.ModelOperations.UnitTests.ScheduleOccurrencePlannerTests" name="Missed_occurrences_are_skipped_without_dispatch_storm" />
</UnitTest>
<UnitTest name="KArtSell.ModelOperations.UnitTests.ScheduleOccurrencePlannerTests.Daily_anchor_does_not_drift_to_dispatch_time" storage="d:\jobroomz\kartsell.aegis\tests\kartsell.modeloperations.unittests\bin\release\net10.0\kartsell.modeloperations.unittests.dll" id="4cc4638d-542d-f501-1295-718da6fcbfd1">
<Execution id="f309f89c-31d4-4b91-9811-1288f7a6606f" />
<TestMethod codeBase="D:\JobRoomz\KArtSell.Aegis\tests\KArtSell.ModelOperations.UnitTests\bin\Release\net10.0\KArtSell.ModelOperations.UnitTests.dll" adapterTypeName="executor://xunit/VsTestRunner3/netcore/" className="KArtSell.ModelOperations.UnitTests.ScheduleOccurrencePlannerTests" name="Daily_anchor_does_not_drift_to_dispatch_time" />
</UnitTest>
<UnitTest name="KArtSell.ModelOperations.UnitTests.DapperModelScheduleRepositoryContractTests.Every_next_due_mutation_requires_the_acquired_dispatch_revision(fieldName: &quot;DispatchedSql&quot;)" storage="d:\jobroomz\kartsell.aegis\tests\kartsell.modeloperations.unittests\bin\release\net10.0\kartsell.modeloperations.unittests.dll" id="0a21da25-b516-7b73-6e2d-51090a81fb76">
<Execution id="c1187da7-890a-4e22-a97e-c655cf36e40d" />
<TestMethod codeBase="D:\JobRoomz\KArtSell.Aegis\tests\KArtSell.ModelOperations.UnitTests\bin\Release\net10.0\KArtSell.ModelOperations.UnitTests.dll" adapterTypeName="executor://xunit/VsTestRunner3/netcore/" className="KArtSell.ModelOperations.UnitTests.DapperModelScheduleRepositoryContractTests" name="Every_next_due_mutation_requires_the_acquired_dispatch_revision" />
</UnitTest>
<UnitTest name="KArtSell.ModelOperations.UnitTests.ModelOperationRequestServiceTests.Persists_the_scheduled_occurrence_and_catch_up_provenance" storage="d:\jobroomz\kartsell.aegis\tests\kartsell.modeloperations.unittests\bin\release\net10.0\kartsell.modeloperations.unittests.dll" id="60773dbd-c959-2ad9-4ce3-ac2f4b7149da">
<Execution id="dcdfe078-1407-4689-ad2f-5d4bed21b110" />
<TestMethod codeBase="D:\JobRoomz\KArtSell.Aegis\tests\KArtSell.ModelOperations.UnitTests\bin\Release\net10.0\KArtSell.ModelOperations.UnitTests.dll" adapterTypeName="executor://xunit/VsTestRunner3/netcore/" className="KArtSell.ModelOperations.UnitTests.ModelOperationRequestServiceTests" name="Persists_the_scheduled_occurrence_and_catch_up_provenance" />
</UnitTest>
<UnitTest name="KArtSell.ModelOperations.UnitTests.DapperModelScheduleRepositoryContractTests.Every_next_due_mutation_requires_the_acquired_dispatch_revision(fieldName: &quot;AdvanceSql&quot;)" storage="d:\jobroomz\kartsell.aegis\tests\kartsell.modeloperations.unittests\bin\release\net10.0\kartsell.modeloperations.unittests.dll" id="782313a2-91d4-3e53-1365-894664840aa6">
<Execution id="9090de1a-1f5e-46dc-bea4-0eaf726c9c08" />
<TestMethod codeBase="D:\JobRoomz\KArtSell.Aegis\tests\KArtSell.ModelOperations.UnitTests\bin\Release\net10.0\KArtSell.ModelOperations.UnitTests.dll" adapterTypeName="executor://xunit/VsTestRunner3/netcore/" className="KArtSell.ModelOperations.UnitTests.DapperModelScheduleRepositoryContractTests" name="Every_next_due_mutation_requires_the_acquired_dispatch_revision" />
</UnitTest>
</TestDefinitions>
<TestEntries>
<TestEntry testId="4a0acb4c-da35-f6d9-1253-fba8b2ec4ae4" executionId="37ed0979-46cf-4c56-9819-333e2703dff1" testListId="8c84fa94-04c1-424b-9868-57a2d4851a1d" />
<TestEntry testId="0a21da25-b516-7b73-6e2d-51090a81fb76" executionId="c1187da7-890a-4e22-a97e-c655cf36e40d" testListId="8c84fa94-04c1-424b-9868-57a2d4851a1d" />
<TestEntry testId="42622f9c-8837-0fa6-cb49-0be424719bcd" executionId="913a6cb9-441c-4fbe-a98e-fc2b1c35ff95" testListId="8c84fa94-04c1-424b-9868-57a2d4851a1d" />
<TestEntry testId="4cc4638d-542d-f501-1295-718da6fcbfd1" executionId="f309f89c-31d4-4b91-9811-1288f7a6606f" testListId="8c84fa94-04c1-424b-9868-57a2d4851a1d" />
<TestEntry testId="782313a2-91d4-3e53-1365-894664840aa6" executionId="9090de1a-1f5e-46dc-bea4-0eaf726c9c08" testListId="8c84fa94-04c1-424b-9868-57a2d4851a1d" />
<TestEntry testId="b5368be1-af87-7993-926e-d1aab98e87f9" executionId="fc0c9f88-0017-4bf4-8fe8-6ad61fe47459" testListId="8c84fa94-04c1-424b-9868-57a2d4851a1d" />
<TestEntry testId="734f2a89-2b23-0864-3bdc-dd5d2c1e065a" executionId="480f1b06-875a-44c6-b6d0-f40b82317b03" testListId="8c84fa94-04c1-424b-9868-57a2d4851a1d" />
<TestEntry testId="60773dbd-c959-2ad9-4ce3-ac2f4b7149da" executionId="dcdfe078-1407-4689-ad2f-5d4bed21b110" testListId="8c84fa94-04c1-424b-9868-57a2d4851a1d" />
</TestEntries>
<TestLists>
<TestList name="목록에 없는 결과" id="8c84fa94-04c1-424b-9868-57a2d4851a1d" />
<TestList name="로드된 모든 결과" id="19431567-8539-422a-85d7-44ee4e166bda" />
</TestLists>
<ResultSummary outcome="Completed">
<Counters total="8" executed="8" passed="8" failed="0" error="0" timeout="0" aborted="0" inconclusive="0" passedButRunAborted="0" notRunnable="0" notExecuted="0" disconnected="0" warning="0" completed="0" inProgress="0" pending="0" />
<Output>
<StdOut>[xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v3.1.5+1b188a7b0a (64-bit .NET 10.0.10)&#xD;
[xUnit.net 00:00:00.43] Discovering: KArtSell.ModelOperations.UnitTests&#xD;
[xUnit.net 00:00:00.49] Discovered: KArtSell.ModelOperations.UnitTests&#xD;
[xUnit.net 00:00:00.52] Starting: KArtSell.ModelOperations.UnitTests&#xD;
[xUnit.net 00:00:00.58] Finished: KArtSell.ModelOperations.UnitTests&#xD;
</StdOut>
</Output>
</ResultSummary>
</TestRun>
@@ -17,6 +17,7 @@ public sealed record DueModelOperation(
string Queue,
string IdempotencyKey,
int ScheduleVersion,
int DispatchRevision,
DateTimeOffset ScheduledFor,
string CatchUpPolicy,
int MaxCatchUp);
@@ -52,6 +53,7 @@ public interface IModelScheduleRepository
Task MarkDispatchedAsync(
Guid scheduleId,
string leaseOwner,
int expectedDispatchRevision,
string backgroundJobId,
DateTimeOffset dispatchedAt,
DateTimeOffset nextDueAt,
@@ -60,6 +62,7 @@ public interface IModelScheduleRepository
Task AdvanceWithoutDispatchAsync(
Guid scheduleId,
string leaseOwner,
int expectedDispatchRevision,
DateTimeOffset advancedAt,
DateTimeOffset nextDueAt,
CancellationToken cancellationToken);
@@ -67,6 +70,7 @@ public interface IModelScheduleRepository
Task ReleaseAsync(
Guid scheduleId,
string leaseOwner,
int expectedDispatchRevision,
string reasonCode,
DateTimeOffset releasedAt,
CancellationToken cancellationToken);
@@ -32,6 +32,7 @@ public sealed class DapperModelScheduleRepository(IDbConnectionFactory connectio
s.queue_name as Queue,
concat(s.operation_code, ':', s.scope_key, ':', s.schedule_version, ':', to_char(s.next_due_at at time zone 'UTC', 'YYYYMMDDHH24MISS')) as IdempotencyKey,
s.schedule_version as ScheduleVersion,
s.dispatch_revision as DispatchRevision,
s.next_due_at as ScheduledFor,
s.catch_up_policy as CatchUpPolicy,
s.max_catch_up as MaxCatchUp;
@@ -46,7 +47,9 @@ public sealed class DapperModelScheduleRepository(IDbConnectionFactory connectio
lease_until = null,
last_error_code = null,
updated_at = @DispatchedAt
where schedule_id = @ScheduleId and lease_owner = @LeaseOwner;
where schedule_id = @ScheduleId
and lease_owner = @LeaseOwner
and dispatch_revision = @ExpectedDispatchRevision;
""";
private const string ReleaseSql = """
@@ -56,7 +59,9 @@ public sealed class DapperModelScheduleRepository(IDbConnectionFactory connectio
last_error_code = @ReasonCode,
next_due_at = greatest(next_due_at, @ReleasedAt) + interval '1 hour',
updated_at = @ReleasedAt
where schedule_id = @ScheduleId and lease_owner = @LeaseOwner;
where schedule_id = @ScheduleId
and lease_owner = @LeaseOwner
and dispatch_revision = @ExpectedDispatchRevision;
""";
private const string AdvanceSql = """
@@ -66,7 +71,9 @@ public sealed class DapperModelScheduleRepository(IDbConnectionFactory connectio
lease_until = null,
last_error_code = null,
updated_at = @AdvancedAt
where schedule_id = @ScheduleId and lease_owner = @LeaseOwner;
where schedule_id = @ScheduleId
and lease_owner = @LeaseOwner
and dispatch_revision = @ExpectedDispatchRevision;
""";
public async Task<IReadOnlyList<DueModelOperation>> AcquireDueAsync(DateTimeOffset now, string leaseOwner, TimeSpan leaseDuration, int limit, CancellationToken cancellationToken)
@@ -76,23 +83,23 @@ public sealed class DapperModelScheduleRepository(IDbConnectionFactory connectio
return items.AsList();
}
public async Task MarkDispatchedAsync(Guid scheduleId, string leaseOwner, string backgroundJobId, DateTimeOffset dispatchedAt, DateTimeOffset nextDueAt, CancellationToken cancellationToken)
public async Task MarkDispatchedAsync(Guid scheduleId, string leaseOwner, int expectedDispatchRevision, string backgroundJobId, DateTimeOffset dispatchedAt, DateTimeOffset nextDueAt, CancellationToken cancellationToken)
{
await using var connection = await connectionFactory.OpenAsync(cancellationToken);
var affected = await connection.ExecuteAsync(new CommandDefinition(DispatchedSql, new { ScheduleId = scheduleId, LeaseOwner = leaseOwner, BackgroundJobId = backgroundJobId, DispatchedAt = dispatchedAt, NextDueAt = nextDueAt }, cancellationToken: cancellationToken));
var affected = await connection.ExecuteAsync(new CommandDefinition(DispatchedSql, new { ScheduleId = scheduleId, LeaseOwner = leaseOwner, ExpectedDispatchRevision = expectedDispatchRevision, BackgroundJobId = backgroundJobId, DispatchedAt = dispatchedAt, NextDueAt = nextDueAt }, cancellationToken: cancellationToken));
if (affected != 1) throw new InvalidOperationException("Schedule lease was lost before dispatch completion.");
}
public async Task AdvanceWithoutDispatchAsync(Guid scheduleId, string leaseOwner, DateTimeOffset advancedAt, DateTimeOffset nextDueAt, CancellationToken cancellationToken)
public async Task AdvanceWithoutDispatchAsync(Guid scheduleId, string leaseOwner, int expectedDispatchRevision, DateTimeOffset advancedAt, DateTimeOffset nextDueAt, CancellationToken cancellationToken)
{
await using var connection = await connectionFactory.OpenAsync(cancellationToken);
var affected = await connection.ExecuteAsync(new CommandDefinition(AdvanceSql, new { ScheduleId = scheduleId, LeaseOwner = leaseOwner, AdvancedAt = advancedAt, NextDueAt = nextDueAt }, cancellationToken: cancellationToken));
var affected = await connection.ExecuteAsync(new CommandDefinition(AdvanceSql, new { ScheduleId = scheduleId, LeaseOwner = leaseOwner, ExpectedDispatchRevision = expectedDispatchRevision, AdvancedAt = advancedAt, NextDueAt = nextDueAt }, cancellationToken: cancellationToken));
if (affected != 1) throw new InvalidOperationException("Schedule lease was lost before advance completion.");
}
public async Task ReleaseAsync(Guid scheduleId, string leaseOwner, string reasonCode, DateTimeOffset releasedAt, CancellationToken cancellationToken)
public async Task ReleaseAsync(Guid scheduleId, string leaseOwner, int expectedDispatchRevision, string reasonCode, DateTimeOffset releasedAt, CancellationToken cancellationToken)
{
await using var connection = await connectionFactory.OpenAsync(cancellationToken);
await connection.ExecuteAsync(new CommandDefinition(ReleaseSql, new { ScheduleId = scheduleId, LeaseOwner = leaseOwner, ReasonCode = reasonCode, ReleasedAt = releasedAt }, cancellationToken: cancellationToken));
await connection.ExecuteAsync(new CommandDefinition(ReleaseSql, new { ScheduleId = scheduleId, LeaseOwner = leaseOwner, ExpectedDispatchRevision = expectedDispatchRevision, ReasonCode = reasonCode, ReleasedAt = releasedAt }, cancellationToken: cancellationToken));
}
}
@@ -36,7 +36,7 @@ public sealed class ModelOperationsDispatcherJob(
var plan = ScheduleOccurrencePlanner.Plan(item.ScheduledFor, item.Cadence, item.CatchUpPolicy, item.MaxCatchUp, now);
if (plan.OccurrencesToDispatch.Count == 0)
{
await schedules.AdvanceWithoutDispatchAsync(item.ScheduleId, leaseOwner, now, plan.NextDueAt, CancellationToken.None);
await schedules.AdvanceWithoutDispatchAsync(item.ScheduleId, leaseOwner, item.DispatchRevision, now, plan.NextDueAt, CancellationToken.None);
continue;
}
@@ -59,6 +59,7 @@ public sealed class ModelOperationsDispatcherJob(
await schedules.MarkDispatchedAsync(
item.ScheduleId,
leaseOwner,
item.DispatchRevision,
backgroundJobId,
now,
plan.NextDueAt,
@@ -70,6 +71,7 @@ public sealed class ModelOperationsDispatcherJob(
await schedules.ReleaseAsync(
item.ScheduleId,
leaseOwner,
item.DispatchRevision,
"DISPATCH_FAILED",
now,
CancellationToken.None);
@@ -0,0 +1,22 @@
using System.Reflection;
using KArtSell.Modules.ModelOperations.Infrastructure;
namespace KArtSell.ModelOperations.UnitTests;
public sealed class DapperModelScheduleRepositoryContractTests
{
[Theory]
[InlineData("DispatchedSql")]
[InlineData("AdvanceSql")]
[InlineData("ReleaseSql")]
public void Every_next_due_mutation_requires_the_acquired_dispatch_revision(string fieldName)
{
var sql = (string?)typeof(DapperModelScheduleRepository)
.GetField(fieldName, BindingFlags.NonPublic | BindingFlags.Static)
?.GetRawConstantValue();
Assert.NotNull(sql);
Assert.Contains("dispatch_revision = @ExpectedDispatchRevision", sql, StringComparison.Ordinal);
Assert.Contains("lease_owner = @LeaseOwner", sql, StringComparison.Ordinal);
}
}