feat(uninstall): remove config root on --purge#246
Conversation
`--purge` previously deleted only explicitly targeted child items (auth.toml, settings.toml, logs, registry skills), leaving the app-support/config root behind with residual files and an empty `skills/` parent. Append the config root as the last user-data target so it sweeps anything the explicit items did not cover. On Windows it is deferred for the same reason as the data directory, since the running process may still hold open SQLite handles. Removing the config root also deletes the telemetry directory, so suppress this invocation's telemetry when purging; otherwise the teardown flush would re-create the directory we just removed. Signed-off-by: Kevin Cui <bh@bugs.cc>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Summary by CodeRabbit
WalkthroughThis PR extends the Sequence Diagram(s)sequenceDiagram
participant User
participant UninstallCommand
participant Telemetry
participant addUserDataItems
participant FileSystem
participant WindowsScheduler
User->>UninstallCommand: run `uninstall --purge`
UninstallCommand->>Telemetry: suppressCurrentInvocation() (if purge && !dryRun)
UninstallCommand->>addUserDataItems: build uninstall plan (user-data items + config root)
addUserDataItems->>FileSystem: remove user-data items immediately (non-Windows)
addUserDataItems->>WindowsScheduler: schedule config-root removal (Windows deferred)
WindowsScheduler->>FileSystem: perform deferred removal (later)
Possibly related PRs
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches✨ Simplify code
Comment |
The `--yes --purge` CLI test asserted the config root (and a residual leftover.txt within it) was gone right after the in-process run. On Windows the config root removal is deferred to the post-exit helper, since the running process may still hold open SQLite handles under it, so the root is still present when the command returns. Branch the test on platform: on Windows expect a scheduled cleanup with the root retained, on Unix expect the in-process removal as before.
--purgepreviously deleted only explicitly targeted child items (auth.toml, settings.toml, logs, registry skills), leaving the app-support/config root behind with residual files and an emptyskills/parent. Append the config root as the last user-data target so it sweeps anything the explicit items did not cover. On Windows it is deferred for the same reason as the data directory, since the running process may still hold open SQLite handles.Removing the config root also deletes the telemetry directory, so suppress this invocation's telemetry when purging; otherwise the teardown flush would re-create the directory we just removed.