Skip to content

feat: add singleton-row scheduler_config model#66

Merged
Theauxm merged 3 commits intomainfrom
feat/scheduler-config-model
May 8, 2026
Merged

feat: add singleton-row scheduler_config model#66
Theauxm merged 3 commits intomainfrom
feat/scheduler-config-model

Conversation

@Theauxm
Copy link
Copy Markdown
Member

@Theauxm Theauxm commented May 8, 2026

Summary

Adds a singleton-row `scheduler_config` table that persists the dashboard-editable subset of `SchedulerConfiguration`, `LocalWorkerOptions`, and `MetadataCleanupConfiguration`. Settings written through this table survive app restarts and are re-applied to the in-memory `SchedulerConfiguration` singleton at startup by a hosted service in Trax.Scheduler.

The table is intentionally a singleton (id always = 1, enforced by a CHECK constraint) since there is exactly one runtime configuration per deployment.

Files

  • SchedulerConfig implements `IModel` with the dashboard-relevant fields as typed columns (TimeSpan, int?, bool, double).
  • PersistentSchedulerConfig wires the EF mapping (no `ValueGeneratedOnAdd` since the id is fixed).
  • New `SchedulerConfigs` DbSet on `IDataContext` and `DataContext`.
  • Migration 034 for Postgres, migration 002 for Sqlite.

Coordinated changes

This PR is the foundation. Consumers in:

  • Trax.Scheduler (`feat/dashboard-api-parity-service`) add the `IOperationsService` methods that read/write this row, plus a hosted service that loads it on startup.
  • Trax.Api (`feat/dashboard-api-parity-graphql`) exposes `operations.config.scheduler` and `operations.config.updateScheduler`.
  • Trax.Dashboard (`feat/dashboard-api-parity-dashboard`) refactors `ServerSettingsPage` to call the shared service.

Merge order: this PR first.

Test plan

  • Postgres CI run executes migration 034 cleanly on a fresh DB.
  • Sqlite CI run executes migration 002 cleanly on a fresh DB.
  • Existing model coverage tests still pass with the new entity discovered by reflection (`ApplyEntityOnModelCreating`).
  • Verify `OperationsServiceConfigTests` in Trax.Scheduler exercise the table end-to-end.

…settings

Introduces SchedulerConfig (Trax.Effect) and PersistentSchedulerConfig
(Trax.Effect.Data) to hold the dashboard-editable subset of
SchedulerConfiguration / LocalWorkerOptions / MetadataCleanupConfiguration
in a single-row table (id always 1, enforced by CHECK constraint).
Postgres migration 034 and Sqlite migration 002 create the table; the
table is consumed by the IOperationsService persistence layer in
Trax.Scheduler and exposed through the operations.config GraphQL surface
in Trax.Api so React and Blazor dashboards see the same values.
@codecov
Copy link
Copy Markdown

codecov Bot commented May 8, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Theauxm added 2 commits May 8, 2026 08:47
Adds round-trip tests in both InMemoryProviderTests and
SqliteProviderTests that exercise every column on the SchedulerConfig
model through Save/Load via EF, plus a nullable-columns variant and an
update-existing-row variant for Sqlite. SqliteMigrationTests gets
scheduler_config in ExpectedTables so a missing-table regression is
caught at build time.

The tests use DbSet.Add directly rather than IDataContext.Track because
Track infers Added vs Modified from `Id > 0`, which would misclassify
the singleton (Id always = 1) as an update on first persist. Each test
deletes any prior row first since the fixture's DB is shared across
tests.
@Theauxm Theauxm merged commit 88c783f into main May 8, 2026
1 check passed
@Theauxm Theauxm deleted the feat/scheduler-config-model branch May 8, 2026 14:56
@traxsharp
Copy link
Copy Markdown

traxsharp Bot commented May 8, 2026

This PR is included in version 1.34.0

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