feat: persisted-operations sample + E2E test project#53
Merged
Conversation
916521d to
f05af10
Compare
Two-process sample under samples/PersistedOperations: - Trax.Samples.PersistedOperations.Api: GraphQL host with persisted-op enforcement enabled. Demonstrates AllowOperationsMatching for dev_* carve-outs and shadow-mode logging. - Trax.Samples.PersistedOperations.Client: console client that uploads a manifest, sends a request by id, hot-fixes the document, and re-queries to demonstrate the no-redeploy flow. E2E test project under tests/Trax.Samples.PersistedOperations.E2E: - WebApplicationFactory<Program>-hosted in-process API, real Postgres via the docker-compose container. - Enforcement, dev-prefix bypass, deactivate/restore lifecycle, hot-fix flow tests. The persisted-id resolution path (3 tests) is currently Ignored pending follow-up on HC v15's IOperationDocumentStorage pipeline wiring; the storage layer itself is fully exercised by the Trax.Api integration suite.
f05af10 to
c9e04b8
Compare
Switch the dev broker to trax/trax123 so local docker-compose mirrors the CI service container, and apply csharpier formatting to two E2E test files that were failing the format check.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
This PR is included in version 1.22.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A real Trax demo of persisted operations: trains, mediator, GraphQL exposure via
[TraxQuery], and persisted-op enforcement.Library (
Trax.Samples.PersistedOperations) — train assembly:GreetTrain(namespacegreeting):Junction<GreetInput, GreetOutput>builds a greeting and timestamp.LookupUserTrain(namespaceusers):Junction<LookupUserInput, UserProfile>resolves a synthetic user profile.[TraxQuery]-attributed and discovered throughAddMediator(typeof(GraphQLNamespaces).Assembly).API (
.Api) —WebApplicationhost:AddTrax(t => t.AddEffects(e => e.UsePostgres(...)).AddMediator(...)).AddTraxGraphQL(g => g.UsePersistedOperations(opts => opts.UseDatabase(...).RequirePersisted(true).LogNonPersistedRequests(true).AllowOperationsMatching(id => id.StartsWith("dev_")))).app.UsePersistedOperationsEnforcement()thenUseTraxGraphQL().Client (
.Client) — console process:AddTrax + AddPersistedOperationStore.greet_v1,lookupUser_v1) of GraphQL documents that call into the trains.E2E test project (
.E2E) —WebApplicationFactory<Program>against real Postgres, 18 tests covering: enforcement (inline rejected, persisted accepted), distinct-ids dispatching to distinct trains, multi-variable inputs returning correct results per call, deactivate/restore lifecycle, history accumulation, dev-prefix bypass, content-type variants, batched requests (rejected wholesale on inline entry; both-persisted batches pass), shape-diff rejection, deactivated-id error shape, auth-ordering smoke check, tenant scoping isolation.Live smoke run completes end-to-end:
Depends on Trax.Api PR (uses the new package).
Test plan
dotnet build Trax.Samples/produces zero warnings.dotnet test tests/Trax.Samples.PersistedOperations.E2E/passes 18/18 againstdocker compose up -d.dotnet run --project samples/PersistedOperations/Trax.Samples.PersistedOperations.Api/followed by the Client process completes the upload + query + hot-fix loop end-to-end.