[Routine - VT] fix(provider): guard against stale groupIdx when rendering file bookmarks#78
Draft
winterdrive wants to merge 1 commit into
Draft
[Routine - VT] fix(provider): guard against stale groupIdx when rendering file bookmarks#78winterdrive wants to merge 1 commit into
winterdrive wants to merge 1 commit into
Conversation
…arks getChildren() for a TempFileItem looked up its group via a cached groupIdx and passed it straight to BookmarkManager.getBookmarksForFile, which dereferences group.bookmarks unconditionally. If the groups array had shifted (group removed/reordered) before the tree node re-rendered, this threw instead of returning an empty list, mirroring the existing stale-index guard already present for TempFolderItem just above it.
This was referenced Jul 5, 2026
Draft
Draft
Draft
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.
1. Pre-flight Check
Open PRs / active branches checked before starting:
routine/vt-fix-treeview-listener-disposal-260702— touchessrc/extension.tsonly (treeView listener/reveal-timer disposal).release/0.7.6-260701— touchespackage.json,package-lock.json,CHANGELOG.mdonly (release PR).origin/routine/vt-fix-*branches exist but their commits are already squash-merged intomain(confirmed viagit log), andgh pr list --state openshows no PR for them.This PR only touches
src/provider.ts, which none of the above modify — no overlap.2. Changes
TreeDataProvider.getChildren()had a branch forTempFileItemthat looked upconst group = this.groups[element.groupIdx]and passed it directly intoBookmarkManager.getBookmarksForFile(group, ...), which unconditionally dereferencesgroup.bookmarks. Ifelement.groupIdxis stale (e.g. a group was removed viaremoveGroupByIdor reordered viamoveGroup, shifting array indices) before this tree node re-renders,groupisundefinedand the call throws. The siblingTempFolderItembranch just above already has anif (!group) return [];guard for this exact stale-index scenario — this PR adds the equivalent guard for theTempFileItembranch.Confirmed this PR does not modify commands, contributed configuration keys, dependencies, or the tab-group serialization/storage format.
3. Safety Verification
Commands run locally, all passed:
npx tsc -p ./— no errorsnpm run test(tsc -p ./ && jest --runInBand) — 25 suites / 175 tests passed4. CI / Release Gate Note
This is a daily routine Draft PR. Package version bump and CHANGELOG updates are intentionally deferred to the weekend release/integration PR. If CI fails only due to the repository's version-bump/release-readiness gate, that is expected behavior for a routine PR, not a code validation failure.