Skip to content

Back up uncommitted docs before --update edits them; never clear a repo root - #17

Merged
dandydarshan merged 1 commit into
mainfrom
fix/faithful-docs-backup
Nov 7, 2026
Merged

dandydarshan merged 1 commit into
mainfrom
fix/faithful-docs-backup

Conversation

@dandydarshan

@dandydarshan dandydarshan commented Nov 6, 2026 •

Copy link
Copy Markdown
Owner

Summary

When --update falls back to a full build, uncommitted docs were copied aside only at fallback time, after the update had already deleted and rewritten pages. On a scratch clone of this repo, that backup was missing 25 of the 35 tracked pages.

 generate --update
   docs committed & clean?        → rely on git (unchanged)
-  otherwise, at fallback:        → move docs/ (already partly rewritten) to docs.prev-<commit>/
+  otherwise, at the start:       → copy docs/ (minus temp/) to docs.prev-<commit>/   # still the previous docs
+  update succeeds in place       → drop that copy
+  full build                     → keep it, clear docs/
+  docs folder is a repo root     → never cleared or moved (--output .)

The copy leaves out temp/: it's the bulk of the size, and the graph is rebuilt from the docs' commit when missing. The copy stays git-ignored, and only the latest is kept.

Evidence

  • Scratch clone of this repo, uncommitted edit, forced full build (real CLI, scripted LLM):
    • Before: the backup had 10 of the 35 tracked pages; 25 were missing.
    • After: the backup has all 35 tracked pages plus 3 untracked ones that were present, keeps the uncommitted edit, and isn't visible to git status.
  • Committed clean docs: still no copy, and git restore --source=HEAD docs/ restores all 41 files.
  • Tests:
    • test_uncommitted_docs_are_backed_up_before_the_update_edits_them: a page the update deletes and one it rewrites are both intact in the backup, and temp/ is excluded;
    • test_successful_update_drops_the_backup;
    • test_a_repo_root_is_never_cleared.
  • 503 tests pass.

Merge Danger

Door: two-way

Blast Radius: --update with uncommitted docs

Each --update on uncommitted docs now copies the pages (without temp/) at the start, typically a few MB. The copy is removed when the update succeeds.

🤖 Generated with Claude Code

https://claude.ai/code/session_01CXRqeijND7XPq2srGHndRd

Base automatically changed from fix/serve-artifacts-and-ports to main November 7, 2026 01:43
@dandydarshan
dandydarshan force-pushed the fix/faithful-docs-backup branch from 768510b to 2ea2974 Compare November 7, 2026 01:53
…po root

A full-build fallback copied the docs aside only at fallback time, after
the update had already deleted and rewritten pages: on this repo the copy
was missing 25 of 41 pages. Uncommitted docs are now copied to
<docs>.prev-<commit>/ (git-ignored, latest only, without temp/ since the
graph is rebuilt from git) when --update starts, before anything writes
into docs/; the copy is dropped again when the update succeeds in place.
Committed, clean docs still rely on git.

Neither path clears or moves a folder that is a repo root (docs written
with --output .), which the old move-aside would have done.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CXRqeijND7XPq2srGHndRd
@dandydarshan
dandydarshan force-pushed the fix/faithful-docs-backup branch from 2ea2974 to 43ee1c0 Compare November 7, 2026 03:19
@dandydarshan
dandydarshan merged commit 0e47a98 into main Nov 7, 2026
10 checks passed
@dandydarshan
dandydarshan deleted the fix/faithful-docs-backup branch November 7, 2026 03:20
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