[Routine - VT] fix(provider): flush pending debounced save on deactivation#83
Draft
winterdrive wants to merge 1 commit into
Draft
[Routine - VT] fix(provider): flush pending debounced save on deactivation#83winterdrive wants to merge 1 commit into
winterdrive wants to merge 1 commit into
Conversation
The 500ms save debounce timer in TempFoldersProvider never gets a chance to fire if VS Code closes shortly after a group/file/bookmark edit, silently dropping that change. Register a subscription that flushes it synchronously on deactivate. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.
Pre-flight Check
Open PRs / active routine branches checked before starting (Phase 1):
validate_json_structure, files-iteration branch)jumpToBookmarkposition clamp, ~L1188-1200)addFilesToGroup/removeFilesFromGroup)getChildrenbookmark-render branch, ~L1852-1860)This PR does not overlap any of the above:
src/provider.ts: adds a new methodflushPendingSave()right after the existingsaveGroups()debounce helper (~L332), nowhere near the bookmark-render branch [Routine - VT] fix(provider): guard against stale groupIdx when rendering file bookmarks #78 touches (~L1852).src/extension.ts: adds onecontext.subscriptions.push(...)at line ~120, immediately aftertreeView.description = ..., which is before the listener-registration block [Routine - VT] fix(extension): dispose treeView listeners and pending reveal timer #77 modifies (starts ~L137). No line overlap with [Routine - VT] fix(extension): dispose treeView listeners and pending reveal timer #77's diff hunks.Changes
TempFoldersProviderdebounces disk writes: every group/file/bookmark edit schedules asaveGroupsImmediate()call 500ms later viasetTimeout, coalescing rapid edits into one write. However, nothing ever flushed that pending timer on extension deactivation. If a user made an edit and closed VS Code within that 500ms window, the timer was simply discarded by the JS runtime and the change was silently lost — never written to.vscode/virtualTab.json.Fix:
src/provider.ts: new publicflushPendingSave()method — clears the pending debounce timer (if any) and calls the existing synchronoussaveGroupsImmediate()directly.src/extension.ts: registerscontext.subscriptions.push({ dispose: () => provider.flushPendingSave() })right after the tree view is created, so VS Code invokes it automatically on deactivation.This does not modify any command registrations, contributed configuration keys, dependencies, or the tab-group serialization/storage format — it only ensures an already-scheduled write actually happens before shutdown.
Safety Verification
Commands run locally, from the repo root:
npx tsc -p ./→ passed, no errors.npm run test(runstsc -p ./ && jest --runInBand) → 25 test suites, 175 tests, all passed.No new test was added: the existing unit-test suite has no
vscode-module mock/harness for instantiatingTempFoldersProvider(all current tests exercise puresrc/core/*logic), so a proper test for this deactivation-hook fix would require scaffolding beyond the scope of a "smallest practical fix" routine PR. This mirrors the precedent set by #77/#78, which also shipped one-line defensive fixes toextension.ts/provider.tswithout new tests.CI / Release Gate Note
This is a daily routine Draft PR. Package version bump and
CHANGELOG.mdconsolidation are intentionally deferred to the weekend release/integration PR. If CI fails solely due to the repository's version-bump release gate, that is expected release-readiness behavior for a routine PR, not a code validation failure.🤖 Generated with Claude Code