Skip to content

fix(doc-keeper): checkout branch before agent + gitignore report - #190

Merged
EVWorth merged 1 commit into
mainfrom
fix/doc-keeper-script-safety
Jul 19, 2026
Merged

EVWorth merged 1 commit into
mainfrom
fix/doc-keeper-script-safety

Conversation

@EVWorth

@EVWorth EVWorth commented Jul 19, 2026

Copy link
Copy Markdown
Owner

Summary

Two fixes for scripts/doc-keeper-sweep.sh:

  1. Checkout the work branch BEFORE the agent runs (not after). If the agent is killed mid-run, partial edits stay isolated on a throwaway branch instead of contaminating main.
  2. Add .doc-keeper-report.md to .gitignore. Per-run artifact, regenerated each sweep, never source.

Why

Fix 1 — branch before agent

During the dry-run test for PR #189, the script was killed by a shell timeout mid-agent-run. The agent's partial edits had been written to the working tree on main (because the original script only did git checkout -b AFTER the agent returned). Result: had to manually stash the changes and create docs/doc-keeper-snapshot-2026-07-19 branch to recover them.

New flow:

preflight → git pull → git checkout -b <branch>  ← happens FIRST
                ↓
            run agent (changes land on the new branch)
                ↓
            commit + (optional) push/PR

Fix 2 — gitignore

The .doc-keeper-report.md file is written by the agent each sweep. It contains the audit trail (drift findings, fixes applied, files touched). It belongs in the PR (as git add . will pick it up before commit) but should NOT be committed to main directly. Adding to .gitignore is belt-and-suspenders against accidental commits.

Diff

.gitignore                  |  3 +++
scripts/doc-keeper-sweep.sh | 21 ++++++++++++---------
2 files changed, 15 insertions(+), 9 deletions(-)

No code changes outside the script and gitignore. Bash syntax verified.

Test Plan

  1. bash -n scripts/doc-keeper-sweep.sh — syntax OK
  2. bash scripts/doc-keeper-sweep.sh --help — usage prints correctly
  3. Manual dry-run with intentional kill — verify changes land on the throwaway branch, not main
  4. Verify .doc-keeper-report.md is now ignored by git status

Related

🤖 Self-driving fix for self-driving script. Meta.

Two fixes for scripts/doc-keeper-sweep.sh:

1. Checkout the work branch BEFORE the agent runs (not after).
   Previously, if the agent was killed mid-run (timeout, Ctrl-C,
   OOM), partial changes landed on main's working tree — exactly
   what happened during the dry-run test that produced PR #189's
   snapshot. Branching first isolates agent edits to a throwaway
   branch even when the script is interrupted.

2. Add .doc-keeper-report.md to .gitignore. The report is a
   per-run artifact regenerated each sweep; not source. Without
   the ignore entry, accidental commits were possible.

Refs:
  - #189 (snapshot branch — doc-keeper dry-run findings, for review)
@EVWorth
EVWorth merged commit 7254ea4 into main Jul 19, 2026
8 of 9 checks passed
@EVWorth
EVWorth deleted the fix/doc-keeper-script-safety branch July 19, 2026 03:20
EVWorth added a commit that referenced this pull request Jul 19, 2026
Refreshes README.md against actual code state:

- Test counts: 1465 → 1488+ (matches vitest run output)
- Rust integration tests: 36 → 45 (matches cargo test count)
- Component count: 36 → 46 (matches actual src/components/*.tsx files)
- Added ai/ and querybuilder/ to component tree (real subdirs)
- Removed mas-sqlite/tests/ line (mas-sqlite is for local SQLite
  storage, not MySQL integration tests)
- Removed DEVELOPMENT_PLAN.md from docs/design/ tree (file was
  deleted in #184)

Found by doc-keeper agent on 2026-07-19.

NOTE: A separate PR (#190) bumps React 18 → React 19 in the same
file. If both merge, dprint will keep both edits; no conflict
expected.
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