feat(docgen): livelock guard + major-only cascade (+ --changed for upstream parity) - #5
Merged
Merged
Conversation
…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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Brings this standalone docgen repo to parity with the upstream hardened version (
polar-bear-express/pbx-trader-lab-public/tools/docgen).Changes
analyzeAllParallelanalyses 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 aschurnthen skipped.needsAnalysiscomment already said "major.minor only" but the code compared both — now aligned on major-only.)--changedflag — 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)
git clone(runs standalone).package.jsondependencies — pure Node. Only runtime dep is theclaudeCLI, and only for actual generation.🤖 Generated with Claude Code