Skip to content

[CTX-1927] chore(runtime): rename pane_session_ids to the accurate pane_view_ids - #3297

Merged
Xuepoo merged 1 commit into
mainfrom
ctx-1927/chore-pane-view-ids
Nov 21, 2026
Merged

Xuepoo merged 1 commit into
mainfrom
ctx-1927/chore-pane-view-ids

Conversation

@Xuepoo

@Xuepoo Xuepoo commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

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-logging alerts 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() into eprintln! (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:

pub fn pane_session_ids(&self) -> Vec<ViewId> {
    self.pane_sessions.keys().copied().collect()
}

ViewId is pub struct ViewId(pub u64) — a layout slot number, not a session credential, token, or terminal byte. It is already exposed through bitty ctl output, layout snapshots, and Debug as ViewId(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:

/// `ViewId`s whose leaf owns a private shell session, in deterministic order.
///
/// These are layout ids (a `u64` slot), never session credentials or
/// terminal bytes; callers may log them for diagnostics.

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.
  • Code-scanning alerts are expected to close once the CodeQL job runs on this head; I will confirm rather than assume.

@Xuepoo Xuepoo added this to the v0.1.0 milestone Nov 21, 2026
@Xuepoo Xuepoo added chore Chore / maintenance area:runtime Area: runtime orchestration P2 Priority: medium labels Nov 21, 2026
@coderabbitai

coderabbitai Bot commented Nov 21, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI (base), Organization UI (inherited)
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 024add6b-3a32-4462-a659-6316f29f32f1
Commits

Reviewing files that changed from the base of the PR and between 9ec9371 and ffb6cfa.

Files selected for processing: 12

  • crates/bitty-runtime/src/runtime/panes.rs
  • crates/bitty-runtime/src/runtime/workspaces.rs
  • crates/bitty-runtime/tests/longrun_hang.rs
  • crates/bitty-runtime/tests/opencode_soak.rs
  • crates/bitty-runtime/tests/pane_sessions.rs
  • crates/bitty-runtime/tests/panel_session_invariants.rs
  • crates/bitty-runtime/tests/runtime_panes.rs
  • crates/bitty-runtime/tests/soak_campaign.rs
  • crates/bitty-terminal/src/chrome_keys.rs
  • crates/bitty-terminal/src/ctl/tests.rs
  • crates/bitty-terminal/src/terminal_app.rs
  • crates/bitty-terminal/src/tests.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@Xuepoo Xuepoo left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 u64 slot), 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"); view iterates pane_ids collected at terminal_app.rs:4850 via let 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 from rt.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 from for 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

@Xuepoo
Xuepoo merged commit ccd1975 into main Nov 21, 2026
21 checks passed
@Xuepoo
Xuepoo deleted the ctx-1927/chore-pane-view-ids branch November 21, 2026 10:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:runtime Area: runtime orchestration chore Chore / maintenance P2 Priority: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant