Skip to content

feat: shared IOperationsService for dashboard + GraphQL parity#60

Merged
Theauxm merged 1 commit intomainfrom
feat/operations-service
May 8, 2026
Merged

feat: shared IOperationsService for dashboard + GraphQL parity#60
Theauxm merged 1 commit intomainfrom
feat/operations-service

Conversation

@Theauxm
Copy link
Copy Markdown
Member

@Theauxm Theauxm commented May 8, 2026

Summary

Introduces `IOperationsService` in `Trax.Scheduler.Services.Operations` as the single source of truth for operations the dashboard UI performs. The Blazor dashboard and the upcoming React rebuild both call this service through the GraphQL `operations.*` namespace, so a queue/cancel/update/save from either surface produces the same DB write and the same in-memory mutation.

What it covers

Method Powers
`QueueTrainAsync` / `CancelWorkQueueEntryAsync` dashboard QueueTrainDialog, WorkQueueDetailPage; `operations.workQueue.*`
`UpdateManifestGroupAsync` / `GetManifestGroupDependencyGraphAsync` dashboard ManifestGroupDetailPage; `operations.manifestGroups.*`
`GetDashboardMetricsAsync` / `GetServerMetrics` dashboard Index page KPIs/charts; `operations.metrics.*`
`GetSchedulerConfig` / `UpdateSchedulerConfigAsync` dashboard ServerSettingsPage; `operations.config.*`

Persistence

`UpdateSchedulerConfigAsync` writes to both the in-memory `SchedulerConfiguration` singleton (immediate effect) and the persisted `trax.scheduler_config` row (survives restart). `SchedulerConfigBootstrapHostedService` re-applies the persisted row to the singleton on app start.

Bug caught during extraction

The dashboard's `QueueTrainDialog` matched user-supplied train names against `TrainRegistration.ServiceTypeName` (a friendly name like `IServiceTrain<X, Y>`) rather than `ServiceType.FullName`. The shared service compares against FullName, per the Train Type Naming Rules in `CLAUDE.md`. Same fix automatically lands in the dashboard once `feat/dashboard-api-parity` (Trax.Dashboard) merges.

Coordinated changes

Depends on Trax.Effect `feat/scheduler-config-model` for the new model and DbSet. Consumed by Trax.Api `feat/operations-namespaces` and Trax.Dashboard `feat/operations-service-integration`.

Merge order: Trax.Effect → this PR → Trax.Api / Trax.Dashboard.

Test plan

  • 64 integration tests pass (`OperationsServiceTests`, `OperationsServiceManifestGroupTests`, `OperationsServiceMetricsTests`, `OperationsServiceConfigTests`, `OperationsServiceLocalWorkerTests`)
  • Coverage on the new code stays above 95% (currently 99.9%)
  • Full Trax.Scheduler.Tests.Integration suite still passes (no existing test regressions)

Centralises the operations the dashboard UI performs (queue a train,
cancel a queued entry, update a manifest group, build the cross-group
dependency graph, compute dashboard metrics, read/update scheduler
runtime config) into a single scoped service in Trax.Scheduler.

Both the Blazor dashboard and the GraphQL operations.* namespace in
Trax.Api now go through this service, so the two surfaces have
identical validation, persistence, and result semantics by construction
rather than by convention. Surfaced (and fixed) a bug in the dashboard
where train-name lookup compared against the friendly ServiceTypeName
instead of ServiceType.FullName.

The scheduler-config side of the service writes through to the new
trax.scheduler_config row in Trax.Effect and reads back from the
in-memory singleton; SchedulerConfigBootstrapHostedService re-applies
the persisted row on startup.

64 integration tests cover the four surfaces (work queue, manifest
group, metrics, scheduler config) end-to-end against Postgres.
@codecov
Copy link
Copy Markdown

codecov Bot commented May 8, 2026

Codecov Report

❌ Patch coverage is 99.56958% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...perations/SchedulerConfigBootstrapHostedService.cs 96.49% 1 Missing and 1 partial ⚠️
...Scheduler/Services/Operations/OperationsService.cs 99.81% 0 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@Theauxm Theauxm merged commit 1eab173 into main May 8, 2026
2 of 4 checks passed
@Theauxm Theauxm deleted the feat/operations-service branch May 8, 2026 15:16
@traxsharp
Copy link
Copy Markdown

traxsharp Bot commented May 8, 2026

This PR is included in version 1.29.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