Title: id(world_net): compile() silently defaults a malformed 'compiled' reply — missing/mistyped module_hash, sequence and diagnostics all read as Ok(("", 0, "")) · Issue #6620 · developing-today/code · GitHub
Open Graph Title: id(world_net): compile() silently defaults a malformed 'compiled' reply — missing/mistyped module_hash, sequence and diagnostics all read as Ok(("", 0, "")) · Issue #6620 · developing-today/code
X Title: id(world_net): compile() silently defaults a malformed 'compiled' reply — missing/mistyped module_hash, sequence and diagnostics all read as Ok(("", 0, "")) · Issue #6620 · developing-today/code
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...
Open Graph 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().unwra...
X 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...
Opengraph URL: https://github.com/developing-today/code/issues/6620
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"id(world_net): compile() silently defaults a malformed 'compiled' reply — missing/mistyped module_hash, sequence and diagnostics all read as Ok((\"\", 0, \"\"))","articleBody":"## Summary\n\n`WorldClient::compile` (`pkgs/id/src/world_net.rs:773-775`) reads the host's `compiled` reply with `unwrap_or_default()` on every field:\n\n```rust\nSome(\"compiled\") => Ok((\n reply[\"module_hash\"].as_str().unwrap_or_default().to_owned(), // :773\n reply[\"sequence\"].as_u64().unwrap_or_default(), // :774\n reply[\"diagnostics\"].as_str().unwrap_or_default().to_owned(), // :775\n)),\n```\n\nA `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:\n\n- `invite` — `reply[\"capability\"].as_str().map(str::to_owned).context(\"invite reply had no capability\")`\n- `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\")\n- `info_details` — `.context(\"host omitted world id\")?` / `.context(\"host omitted sequence\")?`, and invalid provenance is a hard error\n- `metrics` — `serde_json::from_value(...).context(\"host sent invalid metrics\")`\n\n`compile` is the only reply path that manufactures a plausible-looking success value out of a malformed reply.\n\n## Why it matters\n\n- `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.\n- `id world apply`'s `InstallModule` step (`commands/world.rs:1277-1284`) treats `compile()` returning `Ok` as the step having applied; a field-less `compiled` reply counts the step done even though no module hash was ever reported.\n- Sequence `0` is 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.\n\n## Evidence (verified this run)\n\nLaptop 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.\n\n- Control — `{\"type\":\"compiled\",\"module_hash\":\"abc123\",\"sequence\":7,\"diagnostics\":\"warn\"}` → `Ok((\"abc123\", 7, \"warn\"))`.\n- Missing `module_hash` — `{\"type\":\"compiled\",\"sequence\":7,\"diagnostics\":\"\"}` → `Ok((\"\", 7, \"\"))` (silently defaulted).\n- Mistyped fields — `{\"type\":\"compiled\",\"module_hash\":123,\"sequence\":\"7\",\"diagnostics\":42}` → `Ok((\"\", 0, \"\"))` (all three silently defaulted).\n- Bare — `{\"type\":\"compiled\"}` → `Ok((\"\", 0, \"\"))`.\n\n## Acceptance criteria\n\n- [ ] `compile()` errors (with a message naming the missing/invalid field, in the style of the sibling parsers) when a `compiled` reply omits `module_hash` or `sequence`, or carries any of `module_hash` / `sequence` / `diagnostics` under a wrong JSON type.\n- [ ] A well-formed `compiled` reply returns its fields unchanged (existing behavior).\n- [ ] A test pins the refusal: a scripted/broken host reply missing `module_hash` makes `id world compile` fail non-zero instead of printing an empty hash.\n- [ ] No change to the refusal path (non-`compiled` replies still surface the host's message) or to any other reply parser.\n","author":{"url":"https://github.com/dezren39","@type":"Person","name":"dezren39"},"datePublished":"2026-11-06T21:31:58Z","url":"https://github.com/developing-today/code/issues/6620"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:74d19c6d-f135-83fe-b4db-51e719ddf712 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D47E:2046A0:322879:44B052:6B0763E0 |
| html-safe-nonce | 4a517be6c3ed97b061cf512040a0eb6dce7fd7b6ffd7a5a97f05dd3888e2b1e7 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENDdFOjIwNDZBMDozMjI4Nzk6NDRCMDUyOjZCMDc2M0UwIiwidmlzaXRvcl9pZCI6IjU5NzA0Nzk3NjQxODcwNzk2NDgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 1c01f49cf48e25dbf02d74a8d2190070f605bd61bbc8fc06979deeb0b213f48f |
| hovercard-subject-tag | issue:6251019863 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/developing-today/code/6620/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a7c6e858655082f136f21d95de0a46de2f588cd3ae893d90616a6a9ec99088d4/developing-today/code/issues/6620 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a7c6e858655082f136f21d95de0a46de2f588cd3ae893d90616a6a9ec99088d4/developing-today/code/issues/6620 |
| og:image:alt | 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().unwra... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dezren39 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7a557ecc960a3ae6e299fc66b0bc9132072f8860191648e6749fee5d3ff00d82 |
| turbo-cache-control | no-preview |
| go-import | github.com/developing-today/code git https://github.com/developing-today/code.git |
| octolytics-dimension-user_id | 26439447 |
| octolytics-dimension-user_login | developing-today |
| octolytics-dimension-repository_id | 627308783 |
| octolytics-dimension-repository_nwo | developing-today/code |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 627308783 |
| octolytics-dimension-repository_network_root_nwo | developing-today/code |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | bd845eb7947c1ed8c850f7ab415a51339d162de3 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width