Repository navigation
base red: panic ratchet, #30361's new JSON index reads use get (acpmux, cmux-host, cmux-tui, cmux-tui-core) - #30478
Conversation
The Rust panic ratchet is red on feat-cmux-next since 72dc85d (#30361, Cloud repository discovery), tip watcher job 63b147f0938fdb56741e7c83 at 4cd800a: clippy::indexing_slicing over the baseline in four crates (acpmux 694 > 686, cmux-host 1 > 0, cmux-tui 836 > 831, cmux-tui-core 880 > 853). The other commits in 4b15acd..4cd800a add no index or slice in production code. This rewrites every serde_json index read #30361 added in production code (cloud_repo_mcp.rs, github_repos.rs, cli/cloud_repo.rs, cloud_repos/ engine.rs, local.rs, runtime.rs, store.rs) as get / pointer reads, the one IndexMut as get_mut, and the `command[..2]` slice in cli.rs as `command.get(..2)`. Behavior is the same: a missing key read through get compares and converts the same as the Null that indexing returned (`v["k"] == "x"` is `as_str() == Some("x")`, `v["ok"] != true` is `as_bool() != Some(true)`, `v["ref"] != json!(r)` keeps Null for a missing key). The baseline is not raised.
…d-panic-acpmux-30361 # Conflicts: # cmux-tui/crates/acpmux/src/cloud_repo_mcp.rs # cmux-tui/crates/cmux-tui-core/src/cloud_repos/engine.rs # cmux-tui/crates/cmux-tui-core/src/cloud_repos/runtime.rs
…lice use checked forms After the merge of feat-cmux-next 1dfc4dd, the panic ratchet at 9d4a172 (job 1764d0cc925c9f12951dc4c3) is still red on two rows that later base commits added: - acpmux indexing_slicing 689 > 686: #30439 (229803e) added `summary["turn"].is_object()` in hub/views.rs and two `self.running[at]` in subagents.rs. - cmux-tui string_slice 83 > 82: #30464 (1b7b01c) added `&text[prefix.len()..]` in link/seed/github.rs. Now `summary.get("turn").is_some_and(Value::is_object)`, `self.running.get_mut(at)` (`at` is a position in the same Vec, found just above with no change between, so the slot is always there), and `text.split_at_checked(prefix.len())` (None exactly where the old `text.get(..prefix.len())` was None). No behavior change.
|
cmux status (one comment, edited in place; each line is updated by the job that owns it) Review App of this head (app.zip, kept 1 day)
Shipped in:
|
|
Review (subagent, correctness first): SHIP at f9a0611 The reviewer checked the 3 new changes by reading:
The merge resolutions keep #30528's let-chains and #30382's |
|
Review (subagent, correctness first): SHIP at 8b701f4 The reviewer read every rewrite against serde_json semantics. A missing key read through get / pointer gives the same result as the Null from indexing. |
|
Found 13 test failures on Blacksmith runners: Failures
...and 3 more test failures. View all on Blacksmith
|
![Fix with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/fix-with-codesmith-light-3x.png)
Base-red fix (fix forward). The Rust panic ratchet is red on feat-cmux-next since 72dc85d (#30361, Cloud repository discovery). The tip watcher's
--arg panicstep failed at 4cd800a (job 63b147f0938fdb56741e7c83) and again at b9b4ac5 (job b2e7ab23614482433a9e00b5). It passed at 4b15acd (job 919042f7eb84849e08597ca8).clippy::indexing_slicingat the tipThe 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/pointerread. The oneIndexMutis nowget_mut. The slicecommand[..2]is nowcommand.get(..2). The baseline is not raised.acpmux/src/cloud_repo_mcp.rsget(..).and_then(Value::as_str),pointer("/error/code"), andget_mut("error")inenrich_retrycmux-host/src/cloud/github_repos.rspointer("/error/code"),get("provider"),get("_tag")cmux-tui/src/cli/cloud_repo.rsget("id"),get("ok"),get("error_code"),get("error")cmux-tui/src/cli.rscommand.get(..2).is_some_and(..)(the old code checkedlen() >= 2first)cmux-tui-core/src/cloud_repos/{engine,local,runtime,store}.rsget/pointerreads;store.rsgets two small readers,chat_reposandrecent_reposThere is no change in behavior. A missing key read through
getgives the same result as theNullthat 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 (1dfc4dd)
The merge had conflicts in
cloud_repo_mcp.rs,engine.rsandruntime.rswith #30528 (let-chains) and #30382 (seed.unknown_job). The resolution keeps their logic and thegetreads. At the merge head 9d4a172 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:indexing_slicing689 > 686: Sidebar hover preview: count and name each agent's running subagents; History drops inbox notices #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.string_slice83 > 82: link: plan a git-seed-v1 seed of a GitHub working copy #30464 added&text[prefix.len()..]inlink/seed/github.rs. It is nowsplit_at_checked, which givesNonein the same cases as the oldget(..n).Testing
--arg panic)--arg panic)indexing_slicingat 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(acpmuxcloud_repo_mcp, cmux-tui-corecloud_repos, cmux-tuicli::cloud_repoandcloud_repo_tools)test github_repos(cmux-host)--arg panic)--arg panic)test subagentstest seedtest cloud_repoenrich_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