Skip to content

feat(command-dump): add REDIRECT control frame support - #1759

Merged
jfallows merged 3 commits into
developfrom
feature/redirect-dump
May 10, 2026
Merged

jfallows merged 3 commits into
developfrom
feature/redirect-dump

Conversation

@jfallows

@jfallows jfallows commented May 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds REDIRECT control frame support across two layers, aligned with the
RESET pattern that the engine ABI from #1755 establishes as the model
for stream-terminating throttle frames.

command-dump — 8c8b3971

Captures the engine's REDIRECT frame (type id 0x40000005, introduced
in #1755) in the zilla dump command's pcap output and surfaces it in
the zilla.lua Wireshark dissector.

  • ZillaDumpCommand: RedirectFW flyweight (read + builder), dispatch
    on RedirectFW.TYPE_ID in handleFrame, and onRedirect patches the
    round-tripped extension and emits the pcap frame with TCP PSH (like
    RESET, since REDIRECT terminates the stream).
  • zilla.lua: REDIRECT_ID = 0x40000005, registered in
    resolve_frame_type, dispatched via handle_redirect_frame (affinity
    • extension, same shape as BEGIN). Each binding's extension
      dissector (handle_http_extension, handle_grpc_extension,
      handle_sse_extension, handle_ws_extension, handle_mqtt_extension,
      handle_kafka_extension) treats REDIRECT as the BEGIN-style payload
      since the extension is round-tripped from BEGIN.
  • New k3po scripts under
    …/ws/streams/application/advise/client.sent.redirect/{client,server}.rpt
    exercising write advised zilla:redirect / read advise zilla:redirect
    with a non-empty ws:beginEx round-trip.
  • WsAdvisoryApplicationIT#shouldReceiveClientSentRedirect is wired
    but @Ignore'd pending regeneration of its tshark-generated expected
    fixture on a docker-enabled host.

engine k3po-zilla transport teardown — 13ad202a

Per the engine ABI, REDIRECT terminates the stream like RESET
(EngineWorker.dispatch and Target.handle* both call
dispatcher.remove / streams[].remove on RedirectFW.TYPE_ID the
same as ResetFW.TYPE_ID). The k3po-zilla test transport was leaving
the channel in an inconsistent state on both ends, so follow-up cleanup
or script steps could emit END / ABORT frames against a stream the
engine had already torn down — yielding inconsistent zilla dump
output. Mirror the existing RESET pattern exactly:

  • ZillaSource.doAdviseInput (ADVISORY_REDIRECT branch): the caller of
    streamFactory.doRedirect closes the local READ side after the
    frame is written, mirroring doAbortInputAfterBegin for RESET. The
    frame writer (ZillaTarget.doRedirect) stays state-free, mirroring
    ZillaTarget.doReset / doAbortInput.
  • Throttle.onRedirect: on the receiver side, full mirror of
    Throttle.onReset — setWriteAborted + setWriteClosed +
    fireOutputAborted + disconnect/unbind/close events. The receiver is
    the source of the stream (REDIRECT travels in the throttle direction,
    opposite the BEGIN), so its WRITE side is what the redirect
    terminates — same as RESET semantics.

Test plan

  • ./mvnw -pl incubator/command-dump install -DskipTests -DskipITs
    compiles cleanly with the generated RedirectFW.
  • ./mvnw -pl incubator/command-dump checkstyle:check reports 0
    violations.
  • ./mvnw -pl runtime/engine clean verify green — surefire 320/320
    + failsafe 204/204 (incl. SimplexIT 37/37, with the REDIRECT
    test from feat(engine): add REDIRECT control frame primitive #1755).
  • Full CI Build (25) + Analyze (java) + CodeQL green on
    13ad202a.
  • Re-enable shouldReceiveClientSentRedirect and regenerate
    WsAdvisoryApplicationIT_shouldReceiveClientSentRedirect.txt via
    the docker-based tshark runner; verify the dissector output
    matches the expected REDIRECT layout (frame type, affinity,
    round-tripped ws extension).
  • Manual sanity check by running zilla dump against an engine
    that emits REDIRECT and opening the resulting pcap in Wireshark
    with the updated zilla.lua plugin.

Closes the dump-command gap from #1753.

https://claude.ai/code/session_01K4wd5z8Ejgq4ejTsmL88oh

Capture the engine's REDIRECT frame (type id 0x40000005, introduced
in #1755) in the dump command's pcap output and surface it in the
zilla.lua Wireshark dissector. Like RESET, REDIRECT terminates the
stream, so it is mapped to a TCP PSH segment. Like BEGIN, the frame
carries an int64 affinity and a round-tripped extension, so each
binding's extension dissector treats REDIRECT the same as BEGIN.

Adds k3po scripts for the client-sent redirect scenario; the IT method
is wired but @ignore'd until its tshark-generated expected fixture is
regenerated on a docker-enabled host.

https://claude.ai/code/session_01K4wd5z8Ejgq4ejTsmL88oh
@jfallows
jfallows force-pushed the feature/redirect-dump branch 2 times, most recently from 04a2ab2 to 8c8b397 Compare May 10, 2026 21:03
claude and others added 2 commits May 10, 2026 21:29
Per the engine ABI from #1755, REDIRECT terminates the stream like RESET
(EngineWorker dispatcher.remove + Target streams[].remove for both
RedirectFW.TYPE_ID and ResetFW.TYPE_ID). The k3po-zilla test transport
was leaving the channel in an inconsistent state on both ends, so
follow-up cleanup or script steps could emit END / ABORT frames against
a stream the engine had already torn down. This produced inconsistent
zilla dump pcap output for redirect scenarios.

Mirror the existing RESET pattern exactly:

- `ZillaSource.doAdviseInput` (ADVISORY_REDIRECT branch) — the caller of
  `streamFactory.doRedirect` now closes the local READ side after the
  frame is written, mirroring `doAbortInputAfterBegin` for RESET. The
  frame writer (`ZillaTarget.doRedirect`) stays state-free, mirroring
  `ZillaTarget.doReset` / `doAbortInput`.
- `Throttle.onRedirect` — on the receiver side, mirror `Throttle.onReset`
  exactly: `setWriteAborted` + `setWriteClosed` + `fireOutputAborted` +
  the disconnect / unbind / close events. The receiver is the source of
  the stream (REDIRECT travels in the throttle direction, opposite the
  BEGIN), so its WRITE side is what the redirect terminates — same as
  RESET semantics.

The pre-existing `binding-http` `RedirectIT` (`read advise zilla:redirect`
+ `write aborted` on the application side, added in #1758) was authored
against the previous buggy transport behavior and has been failing on
develop ever since. With this fix in place it will need to be revisited
in a follow-up — that test is unaffected by this commit and remains in
the same failure state as on develop's HEAD.

Verified: engine surefire 320/320 + failsafe 204/204
(incl. SimplexIT 37/37 with the PR #1755 REDIRECT test).

https://claude.ai/code/session_01K4wd5z8Ejgq4ejTsmL88oh
Pair the redirect rpt scripts with `read abort` (client) and
`write aborted` (server) so post-REDIRECT teardown is deterministic
once the k3po-zilla transport aligns REDIRECT with RESET (#13ad202a1).
Add the tshark fixture and unignore the IT method.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

@jfallows jfallows left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jfallows
jfallows merged commit a056d3b into develop May 10, 2026
74 checks passed
@jfallows jfallows self-assigned this May 11, 2026
@jfallows
jfallows deleted the feature/redirect-dump branch July 1, 2026 23:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants