base red: panic ratchet, new cmux-tui index and string slices from #30414, #29234, #30634, #30664 and #30574 use checked forms

Merged
LA
4d ago
+46-31

Base-red fix (fix forward). The Rust panic ratchet for cmux-tui is red on feat-cmux-next. The culprits are #30414 (0507fc4361e), #29234 (d8e1b7cde91), #30634 (9f5e2e15c39), #30664 (7b30784711c) and #30574 (93772c4550f).

The count rose as these PRs landed:

tiprowjob
7e0a0f2bc744cmux-tui: indexing_slicing 833 > 831, string_slice 84 > 8221c6ba0ebda787821cc7bc4b
da77b4930f22indexing_slicing 835 > 831, string_slice 84 > 8278d969ee339c330219260958 (run 41294359852)
e27f116ca2a2indexing_slicing 851 > 831tip watcher 32a66a050633135ff8a2988f

This PR rewrites every hit without a panic. Behavior does not change, and the baseline is not raised.

culpritfilehitsnow
#30414link/start_chat_cli.rsid[4..], &url[scheme.len()..], body["ref"] = .., body["environment"] = ..id.get(4..) (always Some after starts_with("env_")), split_at_checked (None in the same cases as the get(..n) before it), JsonSet::set
#29234cli/terminal_talk/send.rs stage_failureerror["details"], error["message"]get
#30634link/seed_cli.rs13 Value reads, 1 writeget reads, JsonSet::set
#30634, #30664link/mod.rs&args[1..], &args[2..]args.get(n..).unwrap_or_default(). The branch runs only after args.get(n - 1) matched, so the slice is always there
#30664link/machine_pin.rsline["ok"] != json!(true)get("ok").and_then(Value::as_bool) != Some(true)
#30574link/start_chat_cli.rs plan_withline["machine"], ["created"], ["snapshot"], ["environment"]get

A missing key read through get is None where indexing gave Null. as_str() and as_bool() see the same value, and json! writes None as null. No revert is needed: every fix is small, and #30655 and others build on these files.

Testing (fleet Linux, --os linux)

runrefresult
panic ratchettip 7e0a0f2bc744RED, job 21c6ba0ebda787821cc7bc4b
panic ratchettip da77b4930f22RED, 835 > 831, job 78d969ee339c330219260958
panic ratchetfirst fix b23259b3826c (base e9f46392402)pass, job 0931ab17956b487dd375d6ce
panic ratchetmerge with tip e27f116, 18cef5a0b87dRED, 849 > 831 (the new base hits), job 9d666b02dcb4c69dbfc147f0
panic ratchetc8f66b166f86 (e27f116 in it)pass, job 5154a2d47f1bde977b80bb0d
tests machine_pin / seed_cli / start_chat / terminal_talkc8f66b166f863/3, 2/2, 32/32, 24/24 pass, jobs b3c86c752fad239b85daf933, ec5244e7c6d8af7790886f11, a6843bd9dfe61282835f4cce, 1cb69b24f6b5c79192b76535
panic ratchethead 9732cc5feac8 (merge with tip 4976f6e5028, plus the #30574 fix)pass (no RED row), job d16b456c9523363a3406442d
tests start_chathead 9732cc5feac833/33 pass, job 270a743c6e75d26b06dd7ff8

Observed / Not run

Observed: the runs above, and prepush-gate.py with no new violations.
Not run: macOS, because this PR has no Swift change and the ratchet runs on Linux only. Job d685d827570e6eaddaafb6cf went to a Mac by mistake and gave no verdict.

Changelog

none