Repository navigation
feat(gateway)!: share one stream configuration and move the test harness out of the gateway - #54
Merged
sunib merged 2 commits intoOct 5, 2026
Conversation
…try points
Implement change 1 of proposal 0010.
- StreamConfig holds every setting a stream needs however it is
served: Authorizer, Clients, Projections, Ordering, Observer,
Diagnostics, HeartbeatInterval, WriteTimeout, ReauthorizationInterval
and ReauthorizationTimeout. Options and Gateway embed it, so each
setting has one name and Handler copies one value instead of mapping
fields. Gateway.Auth is now Authorizer on both paths.
- One projection field. Projection is removed; nil Projections grants
only ProjectionFull, and a host with one view uses StaticProjection.
- ServeStream and Stream take the requested projection; the
ServeStreamProjection and StreamProjection variants are removed.
NewSharedBackend takes SharedOptions; NewSharedBackendWithOptions is
removed.
- Validation is unchanged: HTTP serving still refuses a negative
WriteTimeout and timed checks without one before any I/O, and Stream
still leaves generic sinks to the host.
- The strict-ordering refusal names StreamConfig.Ordering, so its one
golden transcript line changes in message prose only.
- Tests cover a nil policy redacting Secrets and refusing other views, a
dynamic policy deciding at opening and on every cycle, Handler serving
with its whole StreamConfig, and the two entry points sharing it.
Callers, the replay server, kube examples and guides are migrated.
BREAKING CHANGE: Options and Gateway embed StreamConfig, so composite literals set Authorizer, Clients, Projections, Ordering, Observer, Diagnostics, HeartbeatInterval, WriteTimeout and the reauthorization settings inside StreamConfig: gateway.StreamConfig{...}. Gateway.Auth is renamed Authorizer. The Projection field is removed: use Projections: gateway.StaticProjection(p), or leave it nil for ProjectionFull. ServeStream(w, r, principal, scope, requested) and Stream(ctx, principal, scope, requested, sink) replace ServeStreamProjection and StreamProjection; pass "" for the default view. NewSharedBackend(upstream, options) replaces NewSharedBackendWithOptions; pass gateway.SharedOptions{} for the defaults.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ckage Implement change 2 of proposal 0010. - The fixture loader and scripted backend move from package gateway to gateway/internal/conformance: Fixture, WatchOp, FixtureEvent, Corpus, LoadCorpus and ScriptedBackend. The production gateway no longer imports it, so serving a stream never loads a corpus from disk. LoadConformance, the relative-path convenience loader, is removed; the replay server and the tests name the corpus directory. - The replay server and the tests split connection scripts with one function, conformance.Connections, instead of two copies. - Fixture-driven conformance, golden and bookkeeping-suppression tests move to package gateway_test, which can import the harness without a cycle. Private implementation tests stay in package gateway. Goldens are still written through the production SSE sink and regenerate byte-identically. - SSESink.Comment becomes a private helper, now also used by the heartbeat, which keeps writing the same bytes. The heartbeat default becomes private; StreamConfig documents the 20-second default. - Scope.Query, used only by a conformance test, moves into that test. ScopeFromQuery and the canonical query checks are unchanged. - The fixtures task lists the harness as a source of the goldens. BREAKING CHANGE: gateway no longer exports Fixture, WatchOp, FixtureEvent, Corpus, LoadCorpus, LoadConformance, ScriptedBackend or NewScriptedBackend; they were repository test harness. SSESink.Comment, the HeartbeatInterval constant and Scope.Query are removed: set StreamConfig.HeartbeatInterval (zero means 20 seconds), and build a scope's query string from its fields in the documented order. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 19 minutes. View limit detailsLimit details: You’ve used the included review currently available. Review configuration: ⚙️ Run configuration
⛔ Files ignored due to path filters (1)
📒 Files selected for processing (36)
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 |
sunib
added this pull request to stack #56
October 4, 2026 21:00
This was referenced Oct 4, 2026
Merged
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.
Stacked on #53. This PR is based on
docs/proposal-0009-stream-editor-separation, which adds proposal 0010. Once #53 merges, it retargets tomain. It adds only the twofeat(gateway)!commits.Implements proposal 0010 (Go gateway API cleanup) as its two planned changes. Each commit builds and is fully migrated on its own. Authorization, projection, bounded HTTP delivery, the shared-watch lifecycle and v1 wire behavior are unchanged.
Change 1: one configuration, one stream method each, one constructor (
f73fc47)StreamConfigholds the settings every serving path needs:Authorizer,Clients,Projections,Ordering,Observer,Diagnostics,HeartbeatInterval,WriteTimeout,ReauthorizationIntervalandReauthorizationTimeout.Options(plusPrincipalandScopes) andGatewayboth embed it.Handlercopies one value instead of mapping fields, andGateway.AuthbecomesAuthorizeron both paths.Projectionis removed. A nilProjectionsgrants onlyProjectionFull; a host with one view usesStaticProjection.ServeStream(w, r, principal, scope, requested)andStream(ctx, principal, scope, requested, sink)replace the default/…Projectionpairs.NewSharedBackend(upstream, SharedOptions)replaces the two constructors.WriteTimeout, and timed checks without one, before any I/O.Streamstill leaves generic sinks to the host.StreamConfig.Ordering, so one golden line changes, in message prose only (see Golden output).Change 2: the conformance harness leaves the production package (
8bc56df)Fixture,WatchOp,FixtureEvent,Corpus,LoadCorpusandScriptedBackendmove togateway/internal/conformance. The relative-pathLoadConformanceis removed; the replay server and the tests name the corpus directory.package gatewayno longer imports the harness, noros/path/filepathdirectly.conformance.Connections, instead of two copies that differed on empty segments. No fixture has an empty segment, so served bytes are unchanged.package gateway_test. Private implementation tests stay inpackage gateway.SSESink.Commentbecomes a privatecomment, which the heartbeat now uses (same bytes). The heartbeat default becomes private, andStreamConfigdocuments the 20 seconds.Scope.Querymoves into the scope conformance test.ScopeFromQueryand the canonical-query checks are unchanged.fixturestask lists the harness as a source of the goldens.Deliberately kept, per the proposal:
SLOW_CONSUMER, theSink/Stream/SSE encoding seams,OrderingLenient, andEvent.Target.Breaking changes
StreamConfig: gateway.StreamConfig{…}:opts.Authorizer = …keep working through field promotion.Gateway.Auth→Authorizer.Projection: p→Projections: gateway.StaticProjection(p), or nil forProjectionFull.ServeStreamProjection/StreamProjectionare removed.ServeStreamandStreamtake the requested projection; pass""for the default view.NewSharedBackendWithOptionsis removed. UseNewSharedBackend(upstream, gateway.SharedOptions{…}).Fixture,WatchOp,FixtureEvent,Corpus,LoadCorpus,LoadConformance,ScriptedBackend,NewScriptedBackend,SSESink.Comment, theHeartbeatIntervalconstant andScope.Query.Golden output
conformance/gen/sse/resourceversion-unorderable.ssechanges in exactly one place: the error message now saysSet StreamConfig.Ordering = OrderingLenientinstead ofSet Gateway.Ordering = …. The proposal asks for that message to name the shared setting. Code,terminal, sequence and framing are byte-identical, and both suites deliberately compare error messages loosely. Every other golden,protocol.json,fixtures.jsonandscopes.jsonis unchanged. After change 2, the moved harness regenerates every golden byte-identically, including one deleted and recreated as a check.Verification
task verifypasses on8bc56df: fixtures-check, lint (Go vet and golangci-lint in both modules, TypeScript, Biome, actionlint, hadolint), test (both Go modules with-race, client 129/129, Vue 2/2), release-rehearsal, e2e-wire (14 fixtures), e2e-browser (20/20) and pack-client.New tests cover:
Handlerserving with its wholeStreamConfig;OptionsandGatewaysharing oneStreamConfig, with no duplicate setting names.The first two were checked by breaking the implementation on purpose: a raw default policy, and a
Handlercopying a subset of the config.Not available: no krm-foyer (or other host) source is checked out here, so host imports of the removed APIs could not be inventoried. No cluster tasks were run; the proposal makes no capacity claim and requires no new cluster run.
BREAKING CHANGE: Options and Gateway embed StreamConfig, so composite literals set Authorizer, Clients, Projections, Ordering, Observer, Diagnostics, HeartbeatInterval, WriteTimeout and the reauthorization settings inside StreamConfig: gateway.StreamConfig{...}. Gateway.Auth is renamed Authorizer. The Projection field is removed: use Projections: gateway.StaticProjection(p), or leave it nil for ProjectionFull. ServeStream(w, r, principal, scope, requested) and Stream(ctx, principal, scope, requested, sink) replace ServeStreamProjection and StreamProjection; pass "" for the default view. NewSharedBackend(upstream, options) replaces NewSharedBackendWithOptions. The repository test harness (Fixture, WatchOp, FixtureEvent, Corpus, LoadCorpus, LoadConformance, ScriptedBackend, NewScriptedBackend), SSESink.Comment, the HeartbeatInterval constant and Scope.Query are no longer exported.
🤖 Generated with Claude Code