Skip to content

fleet(proxy-proto): proxy-mux stream frame family — wire contract for #5756 (§7 step 1) - #13330

Merged
dezren39 merged 2 commits into
mainfrom
felix/5756-mux-proto
Nov 23, 2026
Merged

dezren39 merged 2 commits into
mainfrom
felix/5756-mux-proto

Conversation

@dezren39

@dezren39 dezren39 commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Implements step 1 of the merged seam record for #5756 (doc/2026-11-16T10-40-00Z_design_id5756_multiplexed_streams_seam.md §7): the fleet-proxy-proto slice. The rest of #5756 (proxy mux, client path, broker dispatch, acceptance harness — record §7 steps 2–5) is untouched and still open; this PR does not close the issue.

What lands

New module fleet_proxy_proto::mux — the wire contract only:

  • Stream frame types open/data/window/rst/ping/pong inside the existing 8-byte length-prefixed JSON framing, discriminated by kind (record §4, decision D1). open carries stream id, target port, method/path or raw-connect intent, and the trip id; data carries a base64 payload chunk with fin half-close and the broker's first-response status; rst reasons are named constants (cancelled, timeout, tunnel_lost, port_not_served, protocol_error).
  • proxy-mux capability (CAP_PROXY_MUX) + mux_negotiated(): the mux activates only when BOTH hello peers advertise it (record §5). It is a wire-negotiation capability string owned by the proto crate, deliberately not a fleet-registry build capability — mux is negotiated behavior, not a build surface.
  • Bounds as types: MAX_DATA_PAYLOAD_BYTES = 64 KiB (enforced in the data constructor, payload(), and validate()); StreamWindow — the credit window as a type (256 KiB initial; send refuses overrun of granted credit, receive refuses peer overrun of the granted window, consume returns credit to grant back); StreamCeiling — per-stream timeout, default 10 s, hard cap 15 s, well under the historical 16–26 s failure cluster; keepalive/idle-exit constants (180 s / 3600 s) carried from the issue.
  • Stream id discipline: client-initiated ids are nonzero and odd, enforced at construction (StreamId::client); id 0 on the wire fails validation.

Compatibility

Dormant by construction: no peer sends these frames until both sides advertise proxy-mux, and nothing in this PR advertises it — no existing behavior changes anywhere; the pooled HTTP-per-call path stays byte-for-byte in charge (the record's no-one-sided-shipment rule). Stream frames are additive within protocol major 1; unknown fields are tolerated, unknown kinds are not stream frames.

Evidence

Dispatched remotely (fleet-command workflow, developing-today/fleet run 45185203954, head be5bcbe): cargo test -p fleet-proxy-proto — 20 passed / 0 failed (10 pre-existing + 10 new contract tests: negotiation, frame shapes, intent, id rules, 64 KiB bound, unknown-field tolerance, window credit in both directions, ceiling bounds, framing roundtrip); cargo check -p fleet-proxy clean; cargo clippy -p fleet-proxy-proto --all-targets clean. (First run caught one wrong expectation in my own window test — the implementation was right, the test's arithmetic was not; fixed in be5bcbe.)

Venue note: the fleet build container ships no cargo and its nix cannot build the root dev shell (missing nixbld group, then a /homeless-shelter build purity error), so the dispatched command bootstraps the pinned toolchain (1.99.1, per pkgs/fleet/rust-toolchain.toml) via rustup into the run's CARGO_HOME/RUSTUP_HOME caches. Filed separately as a runner-surface issue.

New dependency

base64 0.23 added to fleet-proxy-proto for data-frame payloads — the same version the fleet bin crate already uses; no new crate enters the project's dependency graph.

Refs #5756


Start Proof
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

felix added 2 commits November 23, 2026 12:46
…5756 (§7 step 1)

Implements step 1 of the merged seam record
(doc/2026-11-16T10-40-00Z_design_id5756_multiplexed_streams_seam.md):
the stream frame types (open/data/window/rst/ping/pong) inside the
existing 8-byte length-prefixed JSON framing, discriminated by kind;
the proxy-mux hello capability with a both-peers negotiation helper;
window/credit semantics as a type (64 KiB data-frame bound, 256 KiB
initial per-stream window); per-stream timeout ceiling type (10 s
default, 15 s hard cap, well under the 16-26 s failure cluster);
keepalive/idle-exit constants carried from the issue.

Dormant contract only: no peer sends these frames until both hello
peers advertise proxy-mux, and no existing behavior changes — the
no-one-sided-shipment rule (record §5). Proxy mux, client path,
broker dispatch, and the acceptance harness are follow-on steps
2-5 of the record's §7 split.

New dependency for this crate: base64 0.23 (already used by the
fleet bin crate at the same version) for data-frame payloads.
@coderabbitai

coderabbitai Bot commented Nov 23, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You'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 14 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3f1e9120-a51a-4c75-89a2-882cf9669eb8
Commits

Reviewing files that changed from the base of the PR and between 8f29633 and be5bcbe.

Files ignored due to path filters: 1

  • pkgs/fleet/Cargo.lock is excluded by !**/*.lock
Files selected for processing: 3

  • pkgs/fleet/crates/fleet-proxy-proto/Cargo.toml
  • pkgs/fleet/crates/fleet-proxy-proto/src/lib.rs
  • pkgs/fleet/crates/fleet-proxy-proto/src/mux.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-23T13:40:48.078256Z be5bcbe PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: be5bcbe299

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +619 to +620
#[test]
fn window_credit_bounds_both_directions() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Add generated model tests for the credit-window invariants

The new StreamWindow state machine is covered only by a fixed operation sequence, despite having explicit credit-conservation and window-bound invariants. This violates the testing doctrine in AGENTS.md, which requires property tests for invariant-bearing code and model-based tests where a specification exists; the linked doctrine explicitly says example tests do not replace these. Add generated send/grant/receive/consume sequences checked against an independent credit model, including rejected-operation state preservation and receive/consume conservation, and name that model as the oracle.

AGENTS.md reference: AGENTS.md:L36-L39

Useful? React with 👍 / 👎.

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.

1 participant