base red: panic ratchet, #30361's new JSON index reads use get (acpmux, cmux-host, cmux-tui, cmux-tui-core)
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).
| crate | clippy::indexing_slicing at the tip | baseline |
|---|---|---|
| acpmux | 694 | 686 |
| cmux-host | 1 | 0 |
| cmux-tui | 836 | 831 |
| cmux-tui-core | 880 | 853 |
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.
| file | hits | now |
|---|---|---|
acpmux/src/cloud_repo_mcp.rs | 17 | get(..).and_then(Value::as_str), pointer("/error/code"), and get_mut("error") in enrich_retry |
cmux-host/src/cloud/github_repos.rs | 3 | pointer("/error/code"), get("provider"), get("_tag") |
cmux-tui/src/cli/cloud_repo.rs | 4 | get("id"), get("ok"), get("error_code"), get("error") |
cmux-tui/src/cli.rs | 1 | command.get(..2).is_some_and(..) (the old code checked len() >= 2 first) |
cmux-tui-core/src/cloud_repos/{engine,local,runtime,store}.rs | rest | get / 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"becomesas_str() == Some("x").v["ok"] != truebecomesas_bool() != Some(true).existing["ref"] != json!(reference)keepsNullfor a missing key.from_value(doc["local"].clone())becomesfrom_value(get(..).cloned().unwrap_or_default()), which is stillNull, so a missing list still fails the same way.enrich_retryused to write through&mut result["error"]only whenresult["error"]was an object, so theget_mutform 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_slicing689 > 686: #30439 addedsummary["turn"]inhub/views.rsandself.running[at](twice) insubagents.rs. They are nowget("turn")andget_mut(at).atis a position in the same Vec, found just before with no change between. - cmux-tui
string_slice83 > 82: #30464 added&text[prefix.len()..]inlink/seed/github.rs. It is nowsplit_at_checked, which givesNonein the same cases as the oldget(..n).
Testing
| run | ref | result |
|---|---|---|
panic ratchet (--arg panic) | tip 4cd800a309c2 | RED: the four rows above, job 63b147f0938fdb56741e7c83 |
panic ratchet (--arg panic) | first head 8b701f471bc5 | pass (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) | 8b701f471bc5 | 37 of 37 pass, job 6083001dc37f62bd46fd723c |
test github_repos (cmux-host) | 8b701f471bc5 | 9 of 9 pass, job cf655a5395608395acddeb21 |
panic ratchet (--arg panic) | merge head 9d4a172af476 | RED: acpmux 689 > 686 and cmux-tui string_slice 83 > 82, from #30439 and #30464, job 1764d0cc925c9f12951dc4c3 |
panic ratchet (--arg panic) | head f9a0611a0188 | pass (no RED row), job 1f0e6bb20a1631d3f73a8b30 |
test subagents | f9a0611a0188 | 51 of 51 pass, job 2d550515957dbd10a47c1254 |
test seed | f9a0611a0188 | 79 of 79 pass, job 9fac88983e527560cdbb0f29 |
test cloud_repo | f9a0611a0188 | 37 of 37 pass, job 5d73878f27ac96fcd368f66b |
- Review (subagent, correctness first): SHIP at 8b701f471bc59e073c3a2ad36fda79ed7e2008ac, at 9d4a172af4763b798d5ac2606d992edf46356ff3 (the merge) and at f9a0611a018858eff511ddd69a96884745836e80 (the current head). It checked every rewrite against serde_json semantics and the
enrich_retryborrow and found no blocking issue.
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