perf(fold): run the whole-tree checks once, on the tip #263
No reviewers
Labels
No labels
bug
cannot reproduce
duplicate
enhancement
help wanted
invalid
need info
need triage
need verification
not a bug
question
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
claudiomaradonna/agent-foundry!263
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "windmill-implement/261-4123"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
fold-branchfolds a branch's fixups into the commits they correctbefore a push, pull request, or merge, and runs the every-commit checks
of the Quality gates at each replayed commit. Issue #261 reports that a
small edit on a branch of several commits can wait a long time for that
fold. The reason is in the check list: three of this source's four
every-commit checks —
bash tests/verify-agent-config.sh,.agents/hooks/shellcheck.sh repo, andprettier --check '**/*.md'—read the whole tree rather than the commit's own diff, so each costs the
same whatever the commit changes. Measured on
main, that is 24s, 8.7s,and 1.0s, about 34s per replayed commit, so the wait followed the
branch's commit count rather than the size of the edit. A fold leaves the
tree exactly as the tip's, so those three prove at each commit only what
they prove at the tip, where
verify-executionalready runs them.Closes #261
What changed
The fold now runs its every-commit checks at two points. The
--execofstep 2's rebase carries only the checks that read the replayed commit's
own diff — here
git diff --check HEAD^— so a commit that brings awhitespace error into its own diff still stops the fold, as before. A new
step 4 runs the rest once, on the folded tip, before the skill's Done is
met. A fold of several commits now pays one whole-tree run instead of one
per commit, and the fold's own
Donecounts that run, so a fold thatskipped it is not done.
docs/MAINTENANCE.md's fold paragraph now names the two groups, each inits own block, and is where the new test reads them from, so the document
and the skill cannot drift apart in a way that silently loses a check.
recovery.md's second case is named for the run whose check failed, itsthird for the step whose checks it answers, and step 4 answers its own
failing check in place: the fold left the tree as it was, so the branch
holds the failure, and no push, pull request, or merge follows it.
Two things are unchanged and worth stating, since a reviewer might
otherwise read the change as a weakening of the gate: the whole-tree
verdict for the state a remote is asked to land is still enforced, once
on the folded tip and again in
verify-execution's final run, and.forgejo/workflows/maintenance.ymlstill runs every check of the Checkssection on every pull request.
AGENTS.mdis untouched.How to verify
From a fresh checkout of this branch, with the tests run as a non-root
user from the repository root:
All 12 pass. Two of them are new, and both fail on the main branch's
code, which is what a feature's regression test must do; the pin added
before the code passes on both. To see the failure, build a worktree of
the base and run the branch's test file against it:
There the two new tests fail: "docs/MAINTENANCE.md holds the fold's
checks in the group of each point it runs them at", and "the fold of
fold-branch runs its whole-tree checks once, on the folded tip, and not
at each replayed commit", which folds a fixture branch whose base tracks
a file no commit of the branch touches and asserts that the fold
finishes on the branch while the tip's run reports the breakage. The pin,
"the fold of fold-branch stops at a replayed commit whose own diff is not
whitespace-clean", passes there and here.
The change's own fold exercised the rule it changes: its
--execrangit diff --check HEAD^at three replayed commits in 0.043s, then step 4ran the whole-tree group once on the folded tip in 39.8s, where the rule
it replaces paid about 34s three times.
Checks run on the tip, all passing with a clean working tree:
bash tests/verify-agent-config.sh(361 tests),bash tests/check-work-folder.sh(46 tests),.agents/hooks/shellcheck.sh repo(51 files clean),prettier --check '**/*.md',scripts/verify-agent-config.sh, andgit diff --check main.bash .agents/scripts/check-work-folder.sh --verifiedon the work folder prints nothing.Considerations
An intermediate commit that breaks a whole-tree check and is fixed before
the tip now folds without a word, so
git bisectacross a branch'scommits can stop at a state that fails them. That is the cost of the
change, accepted for the report it answers: the state a remote is asked
to land, the tip, keeps every check, and CI keeps running all of them on
every pull request.
The per-commit run of the whole-tree checks is what a later edit could
drop by mistake, so it is pinned rather than trusted: the new test
extracts the skill's
<whole-tree checks>command and the two groups fromdocs/MAINTENANCE.mdand runs both, so dropping step 4 or moving awhole-tree check back into
--execfails the suite.Left out of scope, as the work file records: making
tests/verify-agent-config.shitself quicker, and scoping Prettier andShellCheck to the files a commit changes, which needs a file-list mode
neither has and would still leave the dominant cost reading the whole
configuration.
Review ready:
a399533a00Review: approved
Reviewed
a399533a0088: 0 blocking and 1 minor findings.Reproduced
d7893e2: the two new regression tests fail, the whitespace pin passes there and on the tip, as required.Questions and details
@ -227,0 +234,4 @@# its settingslocal dir="$workdir/fold-exec" cmdcmd=${1//<main branch>/main}cmd=${cmd//<fast checks>/"${2:-true}"}Minor: The substitution is a no-op on the tip; it existed so the suite ran at the pin commit. Keep it with a comment, or drop it.