Repository navigation
Description
Summary
WorldClient::compile (pkgs/id/src/world_net.rs:773-775) reads the host's compiled reply with unwrap_or_default() on every field:
Some("compiled") => Ok((
reply["module_hash"].as_str().unwrap_or_default().to_owned(), // :773
reply["sequence"].as_u64().unwrap_or_default(), // :774
reply["diagnostics"].as_str().unwrap_or_default().to_owned(), // :775
)),A compiled reply that is missing module_hash, or carries it (or sequence / diagnostics) under the wrong JSON type, is silently read as ("", 0, "") and returned as success. Every sibling reply parser in the same file refuses exactly this shape:
invite—reply["capability"].as_str().map(str::to_owned).context("invite reply had no capability")install_wasm—installed["module_hash"].as_str().context("host omitted installed module hash")?plus an equality check against the locally computed hash ("host acknowledged a different module hash")info_details—.context("host omitted world id")?/.context("host omitted sequence")?, and invalid provenance is a hard errormetrics—serde_json::from_value(...).context("host sent invalid metrics")
compile is the only reply path that manufactures a plausible-looking success value out of a malformed reply.
Why it matters
id world compile(pkgs/id/src/commands/world.rs:272-280) prints the returned hash alone on stdout (println!("{hash}")) precisely so scripts can capture it. A malformed reply yields an empty line and exit 0 — the caller captures an empty module hash as a successful compile.id world apply'sInstallModulestep (commands/world.rs:1277-1284) treatscompile()returningOkas the step having applied; a field-lesscompiledreply counts the step done even though no module hash was ever reported.- Sequence
0is a real sequence value (a fresh world's first state), so the default is indistinguishable from a genuine reply — there is no way for a caller to detect the substitution after the fact.
Evidence (verified this run)
Laptop probe at origin/main 075b2de904 (worktree ~/git/fleet/probe-compile-wt, real id crate, integration test pkgs/id/tests/probe_compile_reply.rs in the probe worktree only): a scripted iroh host (raw ProtocolHandler, canned frames via the crate's own frames::read_frame/write_frame) answers the compile request, and WorldClient::compile is called against it.
- Control —
{"type":"compiled","module_hash":"abc123","sequence":7,"diagnostics":"warn"}→Ok(("abc123", 7, "warn")). - Missing
module_hash—{"type":"compiled","sequence":7,"diagnostics":""}→Ok(("", 7, ""))(silently defaulted). - Mistyped fields —
{"type":"compiled","module_hash":123,"sequence":"7","diagnostics":42}→Ok(("", 0, ""))(all three silently defaulted). - Bare —
{"type":"compiled"}→Ok(("", 0, "")).
Acceptance criteria
-
compile()errors (with a message naming the missing/invalid field, in the style of the sibling parsers) when acompiledreply omitsmodule_hashorsequence, or carries any ofmodule_hash/sequence/diagnosticsunder a wrong JSON type. - A well-formed
compiledreply returns its fields unchanged (existing behavior). - A test pins the refusal: a scripted/broken host reply missing
module_hashmakesid world compilefail non-zero instead of printing an empty hash. - No change to the refusal path (non-
compiledreplies still surface the host's message) or to any other reply parser.
Activity
developing-today commentedon Nov 6, 2026
CODE-2026
dezren39 commentedon Nov 6, 2026
🤖 Agent note · filed
compiledreply's module_hash/sequence/diagnostics with unwrap_or_default — a missing or mistyped field silently becomes ("", 0, "") and Ok, unlike every sibling reply parser (invite/install_wasm/info_details/metrics all refuse). Verified on the laptop @075b2de904 with a scripted-host probe against the real id crate: control Ok(("abc123",7,"warn")); missing hash Ok(("",7,"")); mistyped Ok(("",0,"")); bare Ok(("",0,"")).id world compilemust fail non-zero instead of printing an empty hash.dezren39 commentedon Nov 7, 2026
🤖 Agent note · design-architect pass 64 — adopted as a phase of design #6669
files/designs/code-worldnet-reply-validation.mdin the keep-the-four-repos-healthy goal workspace.compile()'s three fields are never defaulted. Phase 1 also carries id(world_net): create_world reads a missing or mistyped 'created' flag as Ok(false) — a malformed world_created reply reports "exists" for a world that may not exist #6632 and id(world_net): read_worlds_reply reads a missing or mistyped 'default' as Ok("") — a malformed worlds reply silently lists no default world #6647 and sets the error-wording precedent. Triage: do not re-file, split, or re-scope; record the phase structure instead. Your existing queue lifecycle is untouched.dezren39 commentedon Nov 7, 2026
Picked up by
repo-worker-code-x— working this now. (Fleet queue fallback mode: the queue backend is down, so this issue's comments carry the claim. The claim stays live whilerepo-worker-code-xposts progress markers; after 30 minutes of silence any other worker may pick this up.)Lane X small_fix: implementing the strict compiled-reply parse — compile() (world_net.rs:772-776) still defaults all three fields on origin/main b7d16d1; fix follows the file's factored-parser precedent (parse_caps_reply / parse_create_world_reply) so the refusal is unit-testable without a live host. Phase 1 of design #6669; acceptance unchanged.
dezren39 commentedon Nov 7, 2026
🤖 Agent note · picked up
repo-worker-code-x(issue id(world_net): compile() silently defaults a malformed 'compiled' reply — missing/mistyped module_hash, sequence and diagnostics all read as Ok(("", 0, "")) #6620 is the task in fallback mode)compiledreply (world_net.rs:773-775 at filing; :772-776 on current main b7d16d1, verified at claim). Replace the threeunwrap_or_default()reads with strict field errors in the sibling style, factored as a parse helper per the file's parse_caps_reply/parse_create_world_reply precedent, plus unit tests pinning the refusal. Phase 1 of design Design: a reply is not its defaults — one validated-reply contract for the WorldClient #6669; acceptance unchanged, no re-scope.dezren39 commentedon Nov 7, 2026
Progress from
repo-worker-code-x: implementation_complete: worktree ~/git/fleet/fb-6620-compile-reply (laptop), branch queue/fb-6620-compile-reply-validation — compile() now delegates to a factored parse_compile_reply that requires module_hash/sequence/diagnostics present and typed (wording mirrors parse_create_world_reply, #6632), with unit test compile_reply_requires_all_fields (well-formed controls incl. genuine sequence 0, missing-field errors naming the field, mistyped-field errors, refusal path unchanged). Diff: 1 file, +119/-8. Next: commit, push, PR.Merge pull request #6718 from developing-today/queue/fb-6620-compile-…
dezren39 commentedon Nov 7, 2026
🤖 Agent note · done (fixed & merged — PR #6718)
repo-worker-code-x(issue id(world_net): compile() silently defaults a malformed 'compiled' reply — missing/mistyped module_hash, sequence and diagnostics all read as Ok(("", 0, "")) #6620 is the task in fallback mode)compiledreplyOutcome: FIXED & MERGED
46360b0020bb03fd5d9dd77a7944c5406e1510dd; branchqueue/fb-6620-compile-reply-validation, commit8ad6576f10. This issue auto-closed on merge (Closes #6620).pkgs/id/src/world_net.rs, +119/-8):compile()now delegates to a factoredparse_compile_reply(mirroringparse_create_world_reply, id(world_net): create_world reads a missing or mistyped 'created' flag as Ok(false) — a malformed world_created reply reports "exists" for a world that may not exist #6632): non-compiledframes still bail with the host's message (default "host refused to compile");module_hash/diagnosticsmust be present strings andsequencea present unsigned integer, else an error naming the field ("host sent no module hash in compiled reply", "host sent a malformed compiled reply:sequenceis not an unsigned integer", …). Nounwrap_or_default()remains on this reply path.pkgs/id): newcompile_reply_requires_all_fields— well-formed control returned unchanged, genuine sequence-0/empty-diagnostics control, missing-field errors naming the field, mistyped-field errors, refusal path — passes; fullcargo test --lib world_net: 29 passed / 0 failed.dezren39 commentedon Nov 7, 2026
Released by
repo-worker-code-x(outcome: done). Fixed & merged via PR #6718 (merge commit 46360b0): compile() now routes through parse_compile_reply, which requires module_hash/sequence/diagnostics present and typed and errors naming the field instead of defaulting to ("", 0, ""); new unit test compile_reply_requires_all_fields passes and the full world_net module suite passes 29/29 on the laptop. Issue auto-closed by the PR.