Repository navigation
feat(engine): assert the affinity of a stream with read option zilla:affinity - #3200
Merged
jfallows merged 2 commits intoNov 13, 2026
Conversation
A k3po script can only expect an affinity per accept, so the affinity of an individual stream cannot be asserted. Add a script pair that accepts two streams of different affinities on one address and asserts each with read option zilla:affinity, and a pair where the peers disagree on the affinity of one stream. Both fail until read option zilla:affinity is supported. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SiHVoTySu8fxqSjcohrEqA
…affinity An accept stanza can expect an affinity, but every stream accepted on that address then has to carry the same one, so a script cannot assert the affinity an individual stream was opened with. Record the affinity of each stream's BEGIN on its channel and add zilla:affinity to the read options. The new handler follows the other read options and fails the stream's script with the statement's region info when the recorded affinity differs from the expected one. Streams without the statement, and the accept-level option, are unchanged. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SiHVoTySu8fxqSjcohrEqA
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.
Description
The k3po zilla extension can only expect an affinity per accept:
option zilla:affinityon anacceptis copied to every accepted channel and compared when its BEGIN arrives. A script that accepts several streams on one address, each opened with a different affinity, therefore cannot assert the affinity of an individual stream.This adds
read option zilla:affinity <value>:ZillaStreamFactory.onBeginrecords the BEGIN's affinity on the channel (sourceAffinity, next tosourceIdandsourceAuth).zilla:affinityis added to the type system's read options, with aReadOptionFactoryentry inZillaBehaviorSystem. The grammar is not touched.ReadAffinityOptionHandlerfollows the other read option handlers. When the script reaches the statement it compares the expected affinity with the channel's, and a mismatch fails that stream's script with aScriptProgressExceptioncarrying the statement's region info, asread option zilla:flagsdoes.Streams without the statement are unaffected, and the accept-level option keeps its meaning.
Fixes #3199
Stacked on #3198; the base is
fix/3195-kafka-api-broker-affinity.Test evidence
Test-first: the first commit holds the scripts and
SimplexITmethods only.SimplexIT.shouldReadAffinityOfEachStream(handshake.read.affinity): two streams with affinities0xb1and0xb2accepted on one address, each asserted withread option zilla:affinity.SimplexIT.shouldRejectReadAffinityMismatch(handshake.read.affinity.mismatch): the client opens with0xb2, the server asserts0xb1; expects the scriptComparisonFailure, asshouldRejectHandshakeWithMismatchedCircuitIddoes.Before the implementation, both failed with
Unrecognized option: zilla:affinity(a parse error, because it was not a read option). After it, both pass.Run with
mvn(system Maven), with checkstyle, license, notice and jacoco checks on and-Dmaven.build.cache.skipCache=true:runtime/engineclean verify: BUILD SUCCESS, 310 unit tests and 266 ITs with 0 failures and 0 errors (1 unit and 13 IT skipped,@Ignorein existing tests; I did not compare these counts with the base branch).SimplexITran 42 with 2 skipped, including the new methods and the unchanged accept-levelshouldHandshakeWithAffinityandshouldRejectHandshakeWithMismatchedCircuitId.specs/engine.specinstall: BUILD SUCCESS.specs/binding-kafka.specclean verify: BUILD SUCCESS, 226 unit tests and 472 ITs with 0 failures (12 skipped).runtime/binding-kafkaclean verify: BUILD SUCCESS, 229 unit tests and 447 ITs with 0 failures (67 skipped). These use the accept-side affinity; no script outside the new ones uses the read option.The upstream modules (
-am) of the two kafka modules were installed with-Dskip.checks=true -DskipTests -DskipITsbeforehand, because the snapshots are not published; the full-reactorbuildmodule notice check was not run. The extension's own scripts live inruntime/engine/src/test/scripts/.../ext/simplex, so nothing was added underspecs/engine.spec.Not delivered / follow-ups
Generated by Claude Code