config-audit/commands
Kjell Tore Guttormsen 8f149891c9 fix(rollback): restore the backup path contract the engine and the commands disagreed on
Pipeline step 4 dogfood. `/config-audit rollback` could not see a single one of
the four real backups on this machine, and reported "Backup not found" for one
that was sitting right there.

Four defects, one root: nothing agreed on where a backup lives or what its
manifest looks like.

- M-BUG-22 `lib/backup.mjs` resolved `~/.config-audit/backups` (pre-v2.2.0)
  while every command, agent and doc uses `~/.claude/config-audit/backups`.
  The auto-backup hook and fix-cli wrote to the first, implement to the second,
  rollback read only the first. Canonical root now, with the legacy root kept
  readable so older backups stay listable and restorable (`legacy: true`).
- M-BUG-25 `parseManifest` understood only the engine's quoted `original_path:`
  spelling, but implement hand-builds its manifest with `- backup:`/`original:`/
  `sha256:`. Every implement-made backup parsed to zero files and restoreBackup
  returned `{restored: [], failed: []}` — a success-shaped no-op. Both formats
  parse now, and a manifest with unparseable entries throws instead of
  pretending to succeed.
- M-BUG-23 both session hooks watched `~/.config-audit/sessions`, which does not
  exist; sessions live under `~/.claude/`. "Check for active sessions" had never
  fired once. It fires now.
- M-BUG-24 the suite called createBackup() against the developer's real home —
  it had left nine stray backups there, and cleanupOldBackups() deletes past ten.
  Root is overridable via CONFIG_AUDIT_BACKUP_ROOT; both test files use it.

Rollback still cannot delete files implement CREATED — no backup can hold a file
that never existed. It no longer does so silently: manifests carry a `created:`
list, restoreBackup returns `createdNotRemoved`, and rollback.md requires the
report. Automatic deletion is a destructive action and needs its own design.

Verified against backup 20260717_032636 on a throwaway copy: all three files
restore byte-exact (sha256 match), zero writes outside the copy, backup dir
unmodified. Suite 1382 -> 1398/0; frozen v5.0.0 snapshots untouched.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SejM9RQAa1Hfuq7Ek2WfFr
2026-07-31 17:23:30 +02:00
..
analyze.md fix(acr): analyze persists agent-returned report (M-BUG-18) 2026-07-16 20:24:12 +02:00
campaign.md docs(campaign): render machine-wide token bill + refresh-tokens surface (v5.9 B2b-3) 2026-06-23 17:28:05 +02:00
cleanup.md feat(humanizer): update action command templates [skip-docs] 2026-05-01 19:50:47 +02:00
config-audit.md fix(commands): wire knowledge-refresh into router + help 2026-06-23 10:31:05 +02:00
discover.md feat(humanizer): update audit/analysis command templates group B [skip-docs] 2026-05-01 19:45:55 +02:00
drift.md feat(humanizer): update audit/analysis command templates group B [skip-docs] 2026-05-01 19:45:55 +02:00
feature-gap.md feat(humanizer): update audit/analysis command templates group A [skip-docs] 2026-05-01 19:41:08 +02:00
fix.md feat(humanizer): update action command templates [skip-docs] 2026-05-01 19:50:47 +02:00
help.md fix(commands): wire knowledge-refresh into router + help 2026-06-23 10:31:05 +02:00
implement.md fix(rollback): restore the backup path contract the engine and the commands disagreed on 2026-07-31 17:23:30 +02:00
interview.md feat(humanizer): update action command templates [skip-docs] 2026-05-01 19:50:47 +02:00
knowledge-refresh.md feat(knowledge): knowledge-refresh — living register, deterministic stale core + web poll (v5.7 Chunk 3) 2026-06-21 19:22:57 +02:00
manifest.md feat(mft): v5.6 B1 — load-pattern accounting in manifest 2026-06-20 17:48:55 +02:00
optimize.md feat(optimize): add --subtract, the subtraction axis, behind a deterministic floor 2026-07-31 16:24:51 +02:00
plan.md feat(humanizer): update action command templates [skip-docs] 2026-05-01 19:50:47 +02:00
plugin-health.md feat(humanizer): update audit/analysis command templates group B [skip-docs] 2026-05-01 19:45:55 +02:00
posture.md feat(humanizer): update audit/analysis command templates group A [skip-docs] 2026-05-01 19:41:08 +02:00
rollback.md fix(rollback): restore the backup path contract the engine and the commands disagreed on 2026-07-31 17:23:30 +02:00
status.md feat(humanizer): update audit/analysis command templates group B [skip-docs] 2026-05-01 19:45:55 +02:00
tokens.md feat(tokens): stale plugin-cache disk-cleanup finding, honestly labelled Dead config (v5.9 B3b) 2026-06-23 18:17:55 +02:00
whats-active.md feat(humanizer): update audit/analysis command templates group A [skip-docs] 2026-05-01 19:41:08 +02:00