Skip to content

revert: delete backup-less configs on restore again#200

Closed
quickbeard wants to merge 1 commit into
mainfrom
fix/restore-delete-backupless-configs
Closed

revert: delete backup-less configs on restore again#200
quickbeard wants to merge 1 commit into
mainfrom
fix/restore-delete-backupless-configs

Conversation

@quickbeard

Copy link
Copy Markdown
Owner

What

Reverts #196, restoring the original delete-on-no-backup mechanism in restoreKind.

When restoring a tool's config to its pre-CoDev state, a live config file with no *.backup alongside it is deleted again, rather than being left in place.

Why

The original reasoning holds up: CoDev only skips the backup step when there was nothing to back up in the first place. So a live config with no backup next to it is necessarily post-CoDev — either CoDev-authored, or recreated by the tool after CoDev wiped it. Deleting it lands the user at "no file", which is the pre-CoDev state.

Keeping the file, as #196 did, had a cost that outweighed the caution: configureClaudeCode bakes the gateway URL and API key directly into settings.json, so a kept config keeps pointing the agent at the CoDev gateway — while runRemove has already revoked the token and wiped ~/.codev-hub. The user was left with a broken agent rather than a clean one, and the hint framed the necessary cleanup as optional polish.

Changes

  • configure.tskept-livedeleted-live; the no-backup branch rmSyncs the live file again.
  • remove.tsrunRestoreOrKeeprunRestoreOrDelete; reports deleted N file(s) (no backup). Drops StepResult.keptPaths / RemoveResult.keptPaths.
  • restore.ts — sweep prints No backup at <backup>. and counts any non-noop result as action again.
  • RemoveApp — drops the kept-files hint (it only existed to describe the kept-live state).
  • AGENTS.md and tests updated to match.

Conflict resolution

The revert conflicted with #198/#199, which renamed CoDev Code's config path. Resolved by keeping the newer paths (~/.config/codev/codev.json) with the reverted delete semantics — the revert is scoped to behavior, not to the path renames.

Validation

pnpm fix, pnpm typecheck, pnpm test (910 passed), and pnpm build && node dist/index.js --version all pass.

Also verified end-to-end by driving the built bundle against a throwaway $HOME:

  • Backup-less ~/.codex/config.toml → deleted, exit 0.
  • ~/.claude/settings.json with a backup → restored to the original contents, backup consumed.

Note (not addressed here)

AGENTS.md line 115 still claims runRestore "treats a missing backup as an error and exits 1". That's been stale since #123runRestore unconditionally returns 0 today. Left alone to keep this revert scoped; worth a separate fix.

🤖 Generated with Claude Code

… them (#196)"

This reverts the behavior change from #196, restoring the original
delete-on-no-backup mechanism in `restoreKind`.

The original reasoning holds: CoDev only skips the backup step when there
was nothing to back up in the first place, so a live config with no
`*.backup` alongside it is necessarily post-CoDev (CoDev-authored, or
recreated by the tool after CoDev wiped it). Deleting it lands the user at
"no file", which IS the pre-CoDev state.

Keeping the file instead left the user with a config still pointing at the
CoDev gateway with a baked-in API key, after `remove` had already revoked
the token and wiped ~/.codev-hub — a broken agent rather than a clean one.

Restores `deleted-live` as the `RestoreStatus`, `runRestoreOrDelete` in
remove.ts, and the sweep's "any non-noop counts as action" tally. Drops
`RemoveResult.keptPaths` and the RemoveApp hint that listed kept files,
both of which only existed to describe the kept-live state.

Conflicts in tests/lib/remove.test.ts and tests/RemoveApp.test.tsx were
resolved to keep the newer config paths from #198/#199
(~/.config/codev/codev.json) with the reverted delete semantics.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@quickbeard quickbeard closed this Jul 17, 2026
@quickbeard
quickbeard deleted the fix/restore-delete-backupless-configs branch July 17, 2026 02:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant