Skip to content

feat(docgen): livelock guard + major-only cascade (+ --changed for upstream parity) - #5

Merged
decider merged 1 commit into
mainfrom
feat/docgen-hardening
May 25, 2026
Merged

feat(docgen): livelock guard + major-only cascade (+ --changed for upstream parity)#5
decider merged 1 commit into
mainfrom
feat/docgen-hardening

Conversation

@decider

@decider decider commented May 25, 2026

Copy link
Copy Markdown
Owner

Brings this standalone docgen repo to parity with the upstream hardened version (polar-bear-express/pbx-trader-lab-public/tools/docgen).

Changes

  • Livelock guardanalyzeAllParallel analyses each directory at most once per run, so a directory whose contents change mid-run can't be re-queued forever (the sweep always drains and produces its auto-commit). A still-stale dir is surfaced once as churn then skipped.
  • Major-only cascade — a child README change re-generates its parent only on a MAJOR version bump; minor/patch stay local. (The repo's needsAnalysis comment already said "major.minor only" but the code compared both — now aligned on major-only.)
  • --changed flag — added alongside the existing --scope (backward-compatible) so the CLI matches upstream's interface; the pre-push hook feeds push-diff dirs via --changed, with a full-sweep fallback.

Verification (self-contained, no local-machine deps)

  • Full suite 56/56 green — in the working tree and in a fresh git clone (runs standalone).
  • No machine-specific absolute paths; no package.json dependencies — pure Node. Only runtime dep is the claude CLI, and only for actual generation.

🤖 Generated with Claude Code

…only cascade

- analyzeAllParallel: add per-run analyzedThisRun + churnReported Sets so
  each directory is analysed at most once per invocation, preventing an
  infinite loop when a dir's files mutate mid-run (e.g. a hook re-touching
  its own dir during the very sweep that triggered it).
- needsAnalysis: cascade only on a child's MAJOR version bump (not minor/patch);
  minor bumps leave the parent's index-level summary accurate, so re-generating
  the whole ancestor chain is unnecessary cost.
- Add --changed <comma-separated-dirs> CLI flag as an alias to the existing
  --scope mechanism; threaded into analyzeAllParallel as opts.changed.
- Update pre-push hook to pass --changed (changed dirs from push diff) with
  full-sweep fallback, preserving the flat-repo docgen binary path convention.
- Tests: rename minor-cascade test to major-only, add livelock test (adapted
  for content-hash staleness model), add two --changed scoping tests.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@decider
decider merged commit b0dfeca into main May 25, 2026
1 check passed
@decider
decider deleted the feat/docgen-hardening branch May 25, 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.

2 participants