Repository navigation
Description
Problem
parseShellContract in pkgs/id/web/src/shell-contract.ts (line 115) validates every client/server field spec at load — that was the #4238 / #2657 fix, so a malformed spec cannot make checkValue throw later. But it never validates the contract's top-level fields: it checks only that client_frames/server_frames are objects with object fields, then returns value as unknown as ShellContract (line ~141). The Rust checker it ports (pkgs/id/src/shell_contract.rs, RawContract at lines 238–249) requires all of these with no #[serde(default)]: max_frame_bytes: usize, routing_fields: Vec<String>, and projection.redacted_keys: Vec<String>. A contract document the Rust side refuses to load is accepted by the TS side, and the failure surfaces later — as a thrown TypeError instead of a recorded violation, or as a silently disabled check.
Evidence (verified this run)
Probe on the laptop (~/git/fleet/probe-2026-11-02-laneB-shellcontract/, verbatim shell-contract.ts @ main 8052d96f, md5 59dc2d096669f95b8ef29f714d1ea8d2, real contract/shell-contract.v1.json, bun). Controls on the unmodified contract behave: a valid join passes, a 1,100,041-byte frame is rejected with "frame of 1100041 bytes exceeds 1048576", and a world_state frame with seed: 7 is rejected as a projection leak.
With top-level fields removed or mistyped, parseShellContract accepts every variant:
routing_fieldsdeleted →checkClientFramethrowsTypeError: undefined is not an object (evaluating 'routing.includes')(line 226) instead of returning aCheck/recording a violation.projectiondeleted →checkServerFramethrowsTypeError(evaluatingcontract.projection.redacted_keys, line 298). Same throw when onlyprojection.redacted_keysis deleted.max_frame_bytesdeleted → the frame-size cap is silently off: the same 1,100,041-byte frame no longer gets the size error and falls through to field checking ("joinhas no fieldpad").max_frame_bytes: -1→ accepted; then every frame is rejected ("frame of 32 bytes exceeds -1"). Rust'susizerefuses this document at load.routing_fields: "world"(a string, not an array) → accepted;String.includesthen does substring matching, so a frame field namedorlis treated as a routing field ("routing fieldorlmust be a string").
Why it matters
The shell contract is the conformance boundary between shell and host: the size cap, the routing-field exemption, and the redacted-key leak check (seed must never reach a session nonzero) are three of its load-bearing checks. All three depend on top-level fields the TS parser never validates, so a truncated, hand-edited, or version-skewed contract document either crashes the checker mid-session with an uncaught TypeError or quietly disables the cap/leak checks — precisely the failure mode #4238 fixed for field specs, one level up.
Acceptance criteria
parseShellContractrejects, with a named error at load time: missing/non-objectprojection, missing/non-string-arrayprojection.redacted_keys, missing/non-string-arrayrouting_fields, and missing/non-finite/negativemax_frame_bytes.- After the fix, no input to
parseShellContractcan makecheckClientFrame/checkServerFrame/Conformancethrow aTypeErrorfrom these fields; malformed contracts fail at parse, malformed frames return violations. - Regression tests in
pkgs/id/web/src/world-contract.test.tscover each case above (missing routing fields, missing projection, missing redacted_keys, missing/negative frame cap, string routing fields), mirroring the existing field-spec tests added by fix(id-web): validate shell contract field specs #4238. - The real
contract/shell-contract.v1.jsonstill parses and all existing shell-contract tests pass.
Activity
dezren39 commentedon Nov 2, 2026
🤖 Agent note · filed
dezren39 commentedon Nov 2, 2026
Picked up (task 6190, lane B, triage): revalidating #4323 against fresh source — verifying parseShellContract top-level validation gap in pkgs/id/web/src/shell-contract.ts and spot-checking the reported TypeError reproduction on the laptop before routing a fix task.
265 remaining items
dezren39 commentedon Nov 5, 2026
🤖 Agent note · claimed
queued(runner capacity, not running/failing) — per standing merge authority, verified work does not wait on CI. Diffed duplicate draft PR Fixes #4323: Validate top-level fields in shell contract #4371 against canonical PR fix(id): validate shell contract top-level fields at load (#4323) #6172 per protocol §8 before disposition.Merge pull request #6172 from developing-today/queue/6193-4323-shell-…
dezren39 commentedon Nov 5, 2026
🤖 Agent note · done
tsc --noEmitclean; Codex review completed with no findings). This lane resumed it from its CI-pending park: CI jobs were stillqueued(runner capacity), so per standing merge authority the verified PR merged without waiting on CI.max_frame_bytes) and closed as superseded.