Skip to content

fix: preserve schedule partition keys#17

Merged
mnbuhl merged 1 commit into
mainfrom
fix/preserve-schedule-partition-keys
May 4, 2026
Merged

fix: preserve schedule partition keys#17
mnbuhl merged 1 commit into
mainfrom
fix/preserve-schedule-partition-keys

Conversation

@mnbuhl
Copy link
Copy Markdown
Owner

@mnbuhl mnbuhl commented May 4, 2026

Summary

  • Persist schedule partition keys in the EF Core schedule entity, mapper, provider-specific upsert SQL, and sample migrations/snapshots.
  • Add regression coverage that scheduled jobs inherit the schedule partition key and that EF schedule persistence round-trips it.
  • Stabilize the flaky RunAsync_WhenReaderThrowsUnexpected_ShouldLogAndContinueToNextJob test with deterministic reader failures.

Root cause

Recurring schedule options and the schedule domain model already exposed PartitionKey, and ScheduleProcessor already forwarded it to generated jobs. EF-backed storage lost the value because AtomizerScheduleEntity and its provider upsert SQL did not persist the schedule partition key.

Recurring schedules already exposed a partition key and the processor forwarded it to jobs, but EF storage did not persist that value on schedule rows. Add schedule partition-key persistence across mappings, provider SQL, and sample migrations so EF-backed schedules can enqueue partitioned jobs after reload.

The flaky reader test used a custom reader whose read index was advanced from TryRead, which made the expected retry count timing-dependent. Make the reader deterministically fail through the retry threshold before returning the next job.

Constraint: EF upsert SQL is provider-specific and must include the new nullable schedule column for inserts and updates.

Rejected: Only patch ScheduleProcessor | processor propagation already existed; EF persistence was the missing path.

Confidence: high

Scope-risk: moderate

Directive: Keep schedule entity, dialect upserts, and sample migration snapshots in sync when adding schedule columns.

Tested: dotnet test tests/Atomizer.Tests/Atomizer.Tests.csproj -f net8.0 --filter FullyQualifiedName~ScheduleProcessorTests|FullyQualifiedName~JobWorkerTests.RunAsync_WhenReaderThrowsUnexpected_ShouldLogAndContinueToNextJob

Tested: dotnet test tests/Atomizer.EntityFrameworkCore.Tests/Atomizer.EntityFrameworkCore.Tests.csproj -f net8.0 --filter FullyQualifiedName~Providers|FullyQualifiedName~SqliteStorageTestsExecutor.UpsertScheduleAsync

Tested: dotnet build

Tested: csharpier check .

Not-tested: full dotnet test across net6.0 runtime because local machine does not have Microsoft.NETCore.App 6.0 installed
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 4, 2026

Code Coverage

Package Line Rate Health
Atomizer 72%
Atomizer 72%
Atomizer 12%
Atomizer.EntityFrameworkCore 89%
Atomizer 72%
Atomizer 12%
Atomizer.EntityFrameworkCore 89%
Atomizer 12%
Atomizer.EntityFrameworkCore 89%
Summary 59% (7371 / 13215)

@mnbuhl mnbuhl marked this pull request as ready for review May 4, 2026 20:28
@mnbuhl mnbuhl merged commit 94a6ce9 into main May 4, 2026
1 check passed
@mnbuhl mnbuhl deleted the fix/preserve-schedule-partition-keys branch May 5, 2026 06:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant