Skip to content

fix(sdk): snapshot index pane handles via resolved stable id#97

Open
grindset95 wants to merge 1 commit into
Helvesec:mainfrom
grindset95:fix/index-pane-handle-resolution
Open

fix(sdk): snapshot index pane handles via resolved stable id#97
grindset95 wants to merge 1 commit into
Helvesec:mainfrom
grindset95:fix/index-pane-handle-resolution

Conversation

@grindset95

Copy link
Copy Markdown
Contributor

Fixes #94

Problem

Slot handles from Session::pane(w, p) snapshot through the by-slot endpoint, which sends the visible (base-adjusted) pane index. The daemon resolver (pane_id_for_target -> window.pane(idx)) matches the raw index. When pane-base-index != 0 the lookup misses, the daemon returns InvalidTarget, and the SDK swallows it into a blank PaneSnapshot::default() with revision: 0. The by-id path is unaffected because the daemon maps the stable pane id back to the raw index internally.

Fix

Slot-handle snapshots now resolve the stable pane id and use the by-id endpoint, falling back to the legacy slot endpoint for daemons without by-id support. The documented stale-slot contract is unchanged: genuinely absent slots still return the default snapshot.

Scope note

The defect fires only when pane-base-index != 0. Revisiting the report with that understanding: under default config (base-index 1 / pane-base-index 1), the (0, 0) blank was a genuinely absent slot under literal indexing (correctly blank by contract), while (1, 1) was the live pane hitting this bug; it is repaired by this change.

Testing

  • New regression test index_pane_handle_resolves_live_pane_under_nonzero_base_index: fails on unmodified main, passes with the fix, and fails again if the fix is reverted.
  • Full pane_queries and list_panes suites pass; existing stale-slot and multi-window literal-index tests unchanged and green.
  • cargo fmt --check and cargo clippy -- -D warnings on the changed targets are clean; the workspace build succeeds. One pre-existing lint in tests/armed_wait.rs reproduces on unmodified main with a newer local toolchain and is unrelated to this change.
  • Independently verified end-to-end with the probe binary from the original report against a freshly built daemon in all three base-index configurations.

Possible follow-ups (maintainer call, out of scope here)

Fixes Helvesec#94

Signed-off-by: vox <1606366+grindset95@users.noreply.github.com>
@grindset95
grindset95 marked this pull request as ready for review July 11, 2026 19:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SDK: index-based pane handles return silent all-blank snapshots (revision: 0) where by-id resolution succeeds

1 participant