From 61c14391caa6f612c381c37d57effa977c36aeb8 Mon Sep 17 00:00:00 2001 From: Theaux Masquelier <43664045+Theauxm@users.noreply.github.com> Date: Tue, 28 Apr 2026 12:33:57 -0600 Subject: [PATCH] feat(samples): opt samples into operations namespace where their UIs need it The operations namespace is opt-in as of Trax.Api 1.x. Samples whose UIs and E2E tests rely on operations.{health, manifests, executions, deadLetters, triggerManifest, ...} now opt in explicitly: - GameServer.Api: web UI ops dashboard + trigger/cancel from the page - EnergyHub.Hub: Next.js web UI manifest dashboard - JobHunt.Hub: phase-0 schema sanity test relies on ops being present Other samples already register [TraxQuery]/[TraxMutation] trains so their schemas have non-empty Query/Mutation roots without operations. --- .../Trax.Samples.EnergyHub.Hub/Program.cs | 10 +++++++++- samples/JobHunt/Trax.Samples.JobHunt.Hub/Program.cs | 10 +++++++++- .../Trax.Samples.GameServer.Api/Program.cs | 5 +++++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/samples/DistributedWorkers/Trax.Samples.EnergyHub.Hub/Program.cs b/samples/DistributedWorkers/Trax.Samples.EnergyHub.Hub/Program.cs index 680c67a..3336d94 100644 --- a/samples/DistributedWorkers/Trax.Samples.EnergyHub.Hub/Program.cs +++ b/samples/DistributedWorkers/Trax.Samples.EnergyHub.Hub/Program.cs @@ -185,7 +185,15 @@ // Depth 6 accommodates the dispatch → mutation → output → nested type → // field → scalar query chain. The Trax default of 4 is the conservative // production choice; raise it deliberately when your schema needs it. -builder.Services.AddTraxGraphQL(graphql => graphql.MaxExecutionDepth(6)); +builder.Services.AddTraxGraphQL(graphql => + graphql + .MaxExecutionDepth(6) + // The hub exposes operational queries and scheduler-control mutations + // so the EnergyHub web UI can render the manifest dashboard and + // trigger jobs. Both surfaces are off by default; opt in here. + .ExposeOperationQueries() + .ExposeOperationMutations() +); builder.Services.AddHealthChecks().AddTraxHealthCheck(); var app = builder.Build(); diff --git a/samples/JobHunt/Trax.Samples.JobHunt.Hub/Program.cs b/samples/JobHunt/Trax.Samples.JobHunt.Hub/Program.cs index e522e42..5f1f86b 100644 --- a/samples/JobHunt/Trax.Samples.JobHunt.Hub/Program.cs +++ b/samples/JobHunt/Trax.Samples.JobHunt.Hub/Program.cs @@ -112,7 +112,15 @@ builder.Services.AddSingleton(); // ── GraphQL API + subscriptions ───────────────────────────────────────────── -builder.Services.AddTraxGraphQL(graphql => graphql.AddTypeExtension()); +// Phase 0 has no [TraxQuery]/[TraxMutation] trains yet, so without the +// operations namespace RootQuery would be empty. Expose ops so the schema +// has at least the framework-level query and mutation fields. +builder.Services.AddTraxGraphQL(graphql => + graphql + .AddTypeExtension() + .ExposeOperationQueries() + .ExposeOperationMutations() +); builder.Services.AddHealthChecks().AddTraxHealthCheck(); diff --git a/samples/LocalWorkers/Trax.Samples.GameServer.Api/Program.cs b/samples/LocalWorkers/Trax.Samples.GameServer.Api/Program.cs index 71c3c9b..d61b9aa 100644 --- a/samples/LocalWorkers/Trax.Samples.GameServer.Api/Program.cs +++ b/samples/LocalWorkers/Trax.Samples.GameServer.Api/Program.cs @@ -185,6 +185,11 @@ .MaxExecutionDepth(6) .AddDbContext() .AddTypeExtensions(typeof(Program).Assembly) + // The web UI surfaces health, manifests, executions, and dead letters + // for the in-browser ops dashboard, and lets operators trigger / + // cancel jobs. Both surfaces are off by default; opt in here. + .ExposeOperationQueries() + .ExposeOperationMutations() ); builder.Services.AddHealthChecks().AddTraxHealthCheck();