base red: panic ratchet, #30361's new JSON index reads use get (acpmux, cmux-host, cmux-tui, cmux-tui-core)

LA
4d ago
+185-122

Base-red fix (fix forward). The Rust panic ratchet is red on feat-cmux-next since 72dc85db17a (#30361, Cloud repository discovery). The tip watcher's --arg panic step failed at 4cd800a309c2 (job 63b147f0938fdb56741e7c83) and again at b9b4ac567ea8 (job b2e7ab23614482433a9e00b5). It passed at 4b15acdb7ae8 (job 919042f7eb84849e08597ca8).

crateclippy::indexing_slicing at the tipbaseline
acpmux694686
cmux-host10
cmux-tui836831
cmux-tui-core880853

The watcher reported only the first crate (acpmux, +8). Four crates are red. All of the new hits come from #30361. The other first-parent commits in 4b15acdb7ae8..4cd800a309c2 (#30197, #30157, #28937, #30362, #29826 and others) add no index or slice in production code.

What changed

Each serde_json index read that #30361 added in production code is now a get / pointer read. The one IndexMut is now get_mut. The slice command[..2] is now command.get(..2). The baseline is not raised.

filehitsnow
acpmux/src/cloud_repo_mcp.rs17get(..).and_then(Value::as_str), pointer("/error/code"), and get_mut("error") in enrich_retry
cmux-host/src/cloud/github_repos.rs3pointer("/error/code"), get("provider"), get("_tag")
cmux-tui/src/cli/cloud_repo.rs4get("id"), get("ok"), get("error_code"), get("error")
cmux-tui/src/cli.rs1command.get(..2).is_some_and(..) (the old code checked len() >= 2 first)
cmux-tui-core/src/cloud_repos/{engine,local,runtime,store}.rsrestget / pointer reads; store.rs gets two small readers, chat_repos and recent_repos

There is no change in behavior. A missing key read through get gives the same result as the Null that indexing returned:

  • v["k"] == "x" becomes as_str() == Some("x").
  • v["ok"] != true becomes as_bool() != Some(true).
  • existing["ref"] != json!(reference) keeps Null for a missing key.
  • from_value(doc["local"].clone()) becomes from_value(get(..).cloned().unwrap_or_default()), which is still Null, so a missing list still fails the same way.
  • enrich_retry used to write through &mut result["error"] only when result["error"] was an object, so the get_mut form takes the same branch.

Update after the merge of feat-cmux-next (1dfc4dd6266)

The merge had conflicts in cloud_repo_mcp.rs, engine.rs and runtime.rs with #30528 (let-chains) and #30382 (seed.unknown_job). The resolution keeps their logic and the get reads. At the merge head 9d4a172af476 the ratchet was still red (job 1764d0cc925c9f12951dc4c3) on two rows that later base commits added. Both are fixed here too, because base reds go in one PR:

  • acpmux indexing_slicing 689 > 686: #30439 added summary["turn"] in hub/views.rs and self.running[at] (twice) in subagents.rs. They are now get("turn") and get_mut(at). at is a position in the same Vec, found just before with no change between.
  • cmux-tui string_slice 83 > 82: #30464 added &text[prefix.len()..] in link/seed/github.rs. It is now split_at_checked, which gives None in the same cases as the old get(..n).

Testing

runrefresult
panic ratchet (--arg panic)tip 4cd800a309c2RED: the four rows above, job 63b147f0938fdb56741e7c83
panic ratchet (--arg panic)first head 8b701f471bc5pass (exit 0, no RED row, indexing_slicing at or under the baseline in all four crates), job 0b990c6938c0c3ba18439332. The warn-tier rows (arithmetic, casts) are the same as on the tip.
test cloud_repo (acpmux cloud_repo_mcp, cmux-tui-core cloud_repos, cmux-tui cli::cloud_repo and cloud_repo_tools)8b701f471bc537 of 37 pass, job 6083001dc37f62bd46fd723c
test github_repos (cmux-host)8b701f471bc59 of 9 pass, job cf655a5395608395acddeb21
panic ratchet (--arg panic)merge head 9d4a172af476RED: acpmux 689 > 686 and cmux-tui string_slice 83 > 82, from #30439 and #30464, job 1764d0cc925c9f12951dc4c3
panic ratchet (--arg panic)head f9a0611a0188pass (no RED row), job 1f0e6bb20a1631d3f73a8b30
test subagentsf9a0611a018851 of 51 pass, job 2d550515957dbd10a47c1254
test seedf9a0611a018879 of 79 pass, job 9fac88983e527560cdbb0f29
test cloud_repof9a0611a018837 of 37 pass, job 5d73878f27ac96fcd368f66b

Observed / Not run

Observed: all the runs above (fleet Linux, Blacksmith overflow), prepush-gate.py (no new violations), and rustfmt 1.95 on the changed files.
Not run: macOS builds, because this PR has no Swift change. I did not run a macOS clippy, because the panic ratchet runs on Linux. #30555 (cloud_repo.rs validate is_none_or) overlaps 4 let-chain sites; whichever lands second merges the other.

Changelog

none