feat!: add lazy clients and transport-neutral command contracts - #225
Merged
Merged
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Team Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Register authority before loading, preserve command lifecycle and dispatch order, and expose generated preload support. Implements [[tasks/client-artifact-loading-2]]
Move command outcomes, shape metadata, validation, and consistency contracts into distributed::command. Adapt GraphQL and legacy derives at the boundary while retaining canonical artifacts and fingerprints. Implements [[tasks/core-command-contract-1]]
Use command-owned derives, metadata, and outcomes throughout library tests, e2e-ui domains, fixtures, and generated services. Remove legacy GraphQL traits, conversions, derives, and re-exports. BREAKING CHANGE: command authors must use distributed::command and the CommandInput/CommandOutput derives. GraphqlInput/GraphqlOutput and GraphQL command exports are removed. Implements [[tasks/core-command-contract-1]]
Keep the full rust-src diagnostic used in CI; document the regeneration prerequisite. All 35 compile-fail fixtures pass with rust-src installed. Refs: tasks/distributed-v5-pr-stack
patrickleet
force-pushed
the
refactor/core-command-contract
branch
from
September 6, 2026 23:30
b9f2960 to
8f1f54f
Compare
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.
Why
Command semantics belong to the domain-facing framework, not to a particular gateway. Read-only browser visits also should not have to initialize every command implementation.
This PR includes the lazy generated command loading from #224 alongside the transport-neutral command contract. It supersedes #224 and targets
v5, so the breaking Rust API migration can ship with the other v5 changes rather than entering the current main release line.What application authors gain
distributed::command. GraphQL exposes those contracts alongside queries and subscriptions.provideDistributedLazyregisters the small authority catalog immediately and loads one shared command runtime on preload or first invocation. Query/SSR loading and command call signatures are unchanged.Examples
Domain DTOs describe commands without depending on GraphQL authoring types:
Opt into lazy loading in the generated SvelteKit client while keeping existing provider options and command calls:
The loader validates the loaded surface/inventory, fences scope changes and cancellation during imports, and preserves preparation order across cold/warm calls. Controlled reload preloads before an existing recovery callback; loading code never replays commands.
Breaking Rust migration
GraphqlInput/GraphqlOutputwithCommandInput/CommandOutput, including nested DTOs.distributed::command.CommandInputType/CommandOutputType,command_type(), andCommandTypeDef/CommandTypeField.The old GraphQL command derives, traits, shape types, conversions and re-exports are removed. The e2e-ui domains, integration tests, application fixtures and service templates are migrated. GraphQL validates naming when exposing a command; the core accepts Serde names independently.
Bundle measurements
A representative larger application's frozen 4.12.1 manifest was regenerated with this CLI and built with this runtime and Vite 6.4.3:
The first command needs another 28,856 B gzip; total emitted JS gzip grows from 217,193 to 221,944 B. These are sums of independently compressed emitted JS files and their initial static dependencies, excluding HTML, SSR data, CSS and request overhead. This moves work off startup; no browser CPU/LCP improvement is claimed. Query splitting is excluded because the earlier experiment showed little compressed-size benefit.
Validation
b9f2960a, including both live browser suites and celld Queue/NATS. The earlier compile-fail failure was a diagnostic snapshot missing the standard-library source span; the correction restores the full CI diagnostic. All 35 fixtures pass locally withrust-srcinstalled. No browser assertion was weakened.v5after feat!: make projections and dev runtime recovery-safe #226. Its fencing, typed application assembly and lifecycle command-proof tests are retained. Fresh CI verifies the rebased branch; consult the current checks rather than treating earlier development counts as a substitute.cargo test --workspace --all-features --lockedpasses (environment-gated live tests are not credited as live evidence); JavaScriptnpm run qualitypasses with 355 tests, generated TypeScript checks, packed-consumer smoke and publint; all 5 lifecycle command-proof tests pass.Implements
tasks/client-artifact-loading-2andtasks/core-command-contract-1.