Repository navigation
[CTX-1927] chore(runtime): rename pane_session_ids to the accurate pane_view_ids - #3297
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 39 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Xuepoo
left a comment
There was a problem hiding this comment.
Independent review of PR #3297 — [CTX-1927] chore(runtime): rename pane_session_ids to the accurate pane_view_ids
Reviewed head: ffb6cfa (worktree clean at the PR head; grep/git evidence only — no cargo or build run locally, remote CI covers compilation).
CHECK 1 — Completeness: PASS
git grep -n 'pane_session_ids' -- crates/ at head ffb6cfa returns zero hits (grep exit code 1). The old symbol is fully gone from crates/.
CHECK 2 — Purity: PASS
git diff origin/main...HEAD (63de016..ffb6cfa): 12 files, 32 insertions / 29 deletions. Every changed line is either a one-token rename pane_session_ids -> pane_view_ids (28 lines: the accessor definition plus every call site) or the doc-comment rewrite at the accessor definition. No logic, expression, or assertion/log message-string changes in any hunk. The only two production-file hunks:
crates/bitty-runtime/src/runtime/panes.rs @@ -881,9 +881,12 (doc + name only, body untouched):
- /// Ids owning a private shell session, in deterministic (
ViewId) order.
- ///
ViewIds whose leaf owns a private shell session, in deterministic order. - ///
- /// These are layout ids (a
u64slot), never session credentials or - /// terminal bytes; callers may log them for diagnostics.
#[must_use]
- pub fn pane_session_ids(&self) -> Vec {
- pub fn pane_view_ids(&self) -> Vec {
self.pane_sessions.keys().copied().collect()
crates/bitty-runtime/src/runtime/workspaces.rs (5 one-token renames, all inside the file's mod tests block — hunk header context is mod tests {):
-
let before = rt.pane_session_ids();
-
let before = rt.pane_view_ids();
-
assert_eq!(rt.pane_session_ids().len(), 2, "sessions intact");
-
assert_eq!(rt.pane_view_ids().len(), 2, "sessions intact");
-
let before_ids = rt.pane_session_ids();
-
let before_ids = rt.pane_view_ids();
-
assert_eq!(rt.pane_session_ids().len(), before_ids.len());
-
assert_eq!(rt.pane_view_ids().len(), before_ids.len());
(the last pair occurs twice, at workspaces.rs:3979 and workspaces.rs:3993)
The new doc comment matches the contract text quoted in the PR body verbatim.
CHECK 3 — Semantics: PASS
crates/bitty-runtime/src/runtime/panes.rs:889 — signature pub fn pane_view_ids(&self) -> Vec<ViewId> (with #[must_use] at panes.rs:888); body at panes.rs:890 is self.pane_sessions.keys().copied().collect() — byte-for-byte the same expression as before the rename (per the diff), so the return type and behaviour are unchanged modulo the name. ViewId is pub struct ViewId(pub u64) (crates/bitty-ui/src/view.rs:42) — a plain layout slot number, not a credential.
CHECK 4 — Alert-site match: PASS
All five CodeQL sites named in the PR body exist at the head and now read from pane_view_ids():
- crates/bitty-terminal/src/terminal_app.rs:5026 —
eprintln!("warning: pane shell {view:?} exited but its leaf is in no layout — session kept");viewiteratespane_idscollected at terminal_app.rs:4850 vialet pane_ids: Vec<bitty_runtime::ViewId> = self.runtime.pane_view_ids();(reap_exited_shells). - crates/bitty-runtime/tests/panel_session_invariants.rs:185 —
"{context}: pane session {id:?} outlived its leaf (WS-INV-9)", id drawn fromrt.pane_view_ids()(line 173); :200 —panic!("{context}: session {id:?} must have a grid"); :204 —"{context}: pane {id:?} grid must match its content frame"; :210 —"{context}: pane {id:?} PTY winsize must match its content frame", ids drawn fromfor id in rt.pane_view_ids()(line 194).
The line numbers match the PR body exactly (5026 / 185 / 200 / 204 / 210).
CHECK 5 — Commit hygiene: PASS
git log -1 --format=%s → [CTX-1927] chore(runtime): rename pane_session_ids to the accurate pane_view_ids.
CHECK 6 — Test coherence: PASS
Every renamed test-file call site uses the new name exactly (git grep at head): longrun_hang.rs:174,193; opencode_soak.rs:388; pane_sessions.rs:113,242; runtime_panes.rs:30; soak_campaign.rs:696,757; chrome_keys.rs:5250,7560,7574 (in-file mod tests); ctl/tests.rs:3126,3158; tests.rs:15591,18210,18231,18314 — with zero pane_session_ids remnants anywhere in crates/. The diff touches 12 files, matching the PR's 12-file list one-for-one.
CI at review time: 15 checks pass on head ffb6cfa (including CodeQL, Analyze (rust) and the MSRV 1.85 check); the "Windows check and test" job was still pending.
VERDICT: APPROVE
Priority: P2 | Area: runtime | Labels: chore,P2,area:runtime | Milestone: v0.1.0 | RFC: none | Task: CTX-1927
Clears the five open CodeQL
rust/cleartext-loggingalerts by correcting a misleading name, not by dismissing them.Why these alerts are false positives
All five alerts trace a value from
Runtime::pane_session_ids()intoeprintln!(crates/bitty-terminal/src/terminal_app.rs:5026) or an assertion message (crates/bitty-runtime/tests/panel_session_invariants.rs:185/200/204/210). That accessor returns:ViewIdispub struct ViewId(pub u64)— a layout slot number, not a session credential, token, or terminal byte. It is already exposed throughbitty ctloutput, layout snapshots, andDebugasViewId(3).The rule keys on the name: an accessor ending in
session_ids()taints its return value as a sensitive identifier, so logging it trips the rule. One root cause, five instances.Change
Rename
pane_view_ids(12 files, 28 call sites; no behaviour change) and document the contract at the definition:The name now says what it returns, so the taint heuristic no longer applies and the alerts close on the new head. No suppression, no
#[allow], no dashboard dismissal to maintain.pane_session_count()keeps its name: it counts sessions, which is accurate.Verification
cargo clippy -p bitty-runtime -p bitty-terminal --all-targets -- -D warnings→ clean.cargo nextest run -p bitty-runtime -p bitty-terminal→ 6362 passed, 11 skipped, including the wall-recovery and panel-invariant suites that carry four of the five alerts.cargo fmt --all --check→ clean.