refactor(cli): drop redundant explicit Effect.ensuring(store.dispose)#25503
Merged
kitlangton merged 1 commit intodevfrom May 3, 2026
Merged
refactor(cli): drop redundant explicit Effect.ensuring(store.dispose)#25503kitlangton merged 1 commit intodevfrom
kitlangton merged 1 commit intodevfrom
Conversation
#25481 folded auto-dispose into effectCmd, so the per-handler Effect.ensuring(store.dispose(ctx)) calls are now redundant (idempotent double-dispose). Drop them across all converted commands. Files: - import.ts, export.ts, stats.ts, session.ts (delete + list) - debug/config.ts, skill.ts, snapshot.ts (×3), lsp.ts (×3), ripgrep.ts (×3), file.ts (×5), agent.ts For commands where ctx was ONLY used for dispose, drops the InstanceRef yield + null check + InstanceStore.Service yield + unused imports too. For commands using ctx for other purposes (project.id, directory), keeps the InstanceRef yield but drops everything else. Behavior preserved exactly — disposeEntry is idempotent (cache.get returns mismatched entry on the second call and skips disposeContext).
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.
Summary
#25481 folded auto-dispose into `effectCmd` itself. The per-handler `Effect.ensuring(store.dispose(ctx))` calls (and the `InstanceRef`/`InstanceStore.Service` yields that exist solely to set up that wrap) are now redundant — drop them across all converted commands.
Net change: 11 files, -111 lines.
Files
For commands where `ctx` was ONLY used for `store.dispose(ctx)`: drops the `InstanceRef` yield + null check + `InstanceStore.Service` yield + unused imports.
For commands using `ctx` for other purposes (`ctx.project.id` in import/stats, `ctx.directory` in ripgrep, full `ctx` in debug/agent): keeps the `InstanceRef` yield but drops the `store` yield and the explicit `Effect.ensuring` wrap.
Behavior preservation
Exact. `disposeEntry` is idempotent: the second auto-dispose call hits `if (cache.get(directory) !== entry) return false` and skips `disposeContext` — already proven during the #25481 review and verified by smoke tests.
Test plan