fix(sdk): snapshot index pane handles via resolved stable id#97
Open
grindset95 wants to merge 1 commit into
Open
fix(sdk): snapshot index pane handles via resolved stable id#97grindset95 wants to merge 1 commit into
grindset95 wants to merge 1 commit into
Conversation
Fixes Helvesec#94 Signed-off-by: vox <1606366+grindset95@users.noreply.github.com>
grindset95
marked this pull request as ready for review
July 11, 2026 19:37
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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. Whenpane-base-index != 0the lookup misses, the daemon returnsInvalidTarget, and the SDK swallows it into a blankPaneSnapshot::default()withrevision: 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
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.pane_queriesandlist_panessuites pass; existing stale-slot and multi-window literal-index tests unchanged and green.cargo fmt --checkandcargo clippy -- -D warningson the changed targets are clean; the workspace build succeeds. One pre-existing lint intests/armed_wait.rsreproduces on unmodified main with a newer local toolchain and is unrelated to this change.Possible follow-ups (maintainer call, out of scope here)
PaneTarget.pane_indexas raw whilelist-panesrenders visible indices; making target resolution visible-index-aware would also fix other by-slot commands (send-keys, kill-pane, select-pane, resize).snapshot()on a handle that never resolves still returnsOkwith the default grid; an explicit error variant (option 2 in SDK: index-based pane handles return silent all-blank snapshots (revision: 0) where by-id resolution succeeds #94) may be worth considering.