presubmit-sweep
Skill9 starsChanged 46 days agoApache-2.0View on GitHub
Run the local presubmit scripts before pushing to core-agent. Use when a change is ready to push, before `git push` or `gh pr create`, or when CI has gone red and you want to reproduce it locally. Covers which scripts to run, which are slow, and why a green local run is the same run as CI.
- Commits and pushes
In this repository10 other files it gives its agents.
- .agents/AGENTS.mdAGENTS.md
- AGENTS.mdAGENTS.md
- .agents/reviewer/AGENTS.mdAGENTS.md
- adversarial-review-gateSkill
- changelog-bulletSkill
- prefix-failure-verificationSkill
- stacked-pr-orderSkill
- autonomous-setupSkill
- cli-setupSkill
- library-embeddingSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 13
Run them before every push.
- Very specific: line 77
test-unitfails in a package you did not touch: Check it fails on a clean tree too before assuming you caused it.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Presubmit sweep
dev/ci/presubmits/* are the scripts CI runs. A green local sweep is the
same green run as remote CI, which is the whole reason to do it here: pushing
first and reading the failure off GitHub costs a full CI cycle to learn
something a local minute would have told you.
Run them before every push. Not before every commit — before every push.
The sweep
Run everything in dev/ci/presubmits/ except the two e2e-* scripts.
That is the whole rule, and it is simpler than the conditional table you
might expect because CI has no conditional table either: of the eighteen
scripts, sixteen run on every pull request and only e2e-real-provider and
e2e-recipe-gke-troubleshoot-agent are gated on credentials.
for s in dev/ci/presubmits/*; do
n=$(basename "$s")
case "$n" in e2e-*) continue ;; esac
echo "=== $n ==="
"$s" >/tmp/ps-$n.log 2>&1 && echo PASS || { echo FAIL; tail -30 /tmp/ps-$n.log; }
doneGlobbing the directory rather than listing names is deliberate: a presubmit added to CI and not to this skill would otherwise be a silent gap, and the skill cannot be the thing that has to be remembered.
Capture to a file and tail on failure rather than letting output stream. Some
of these produce far more than a screen, and piping a long producer into
head is how you get a SIGPIPE that looks like a crash.
The loop is one compound command, and a permission gate's prefix rules never
match a compound command, so it goes to a person for approval. To run the
sweep as separate calls instead, list the directory and run each script as its
own call, by its path and with nothing appended: dev/ci/presubmits/build,
then dev/ci/presubmits/vet, and so on. Run from outside any git work tree,
each script checks the tree it lives in, so an absolute path into another
working copy works too.
Three of them are the ones most often wrongly assumed to be conditional:
examples-smokeis unconditional in the requiredtestjob (#852). Apkg/API change that an example consumes turns it red without anything underexamples/being touched — exactly the case a paths filter would miss, which is why it does not have one.verify-gke-drillis the offline check. It runs on every PR as "GKE drill (offline)" and needs no cluster and no credentials. The scripts that need a live cluster are thee2e-*pair.verify-docs-lintandverify-version-fallbacklive in their own workflows with nopaths:filter, precisely becauseci.ymlskips markdown-only changes and these two guard markdown drift.verify-no-agent-attributionalso has its own unfiltered workflow. It scans the commits inorigin/main..HEAD, so run it after you commit. CI also scans the PR title and body, which a local run can't see.
e2e-real-provider and e2e-recipe-gke-troubleshoot-agent need credentials
or a live cluster. Run them only when asked, and never assume their absence
means the change is unverified.
Reading a failure
lint-gofails but the same code passed a minute ago. The golangci-lint cache goes stale across worktrees, and it is stale in both directions — phantom failures and false local passes.golangci-lint cache cleanusing the binary fromGOPATH/bin, then re-run.verify-go-formatfails. Just rungofmt -won the named files; there is nothing to think about.verify-mod-tidyfails.go mod tidyand stage the result.test-unitfails in a package you did not touch. Check it fails on a clean tree too before assuming you caused it.- A registry test fails after you added a package, config key or
harness script. These are deliberate tripwires; each wants one line,
in the same PR:
TestEveryImportablePackageIsADecision(internal/testutil): a newpkg/...package needspromisedorunsupportedindev/api-surface.txt, and the same name in the unsupported list indocs/compatibility-policy.mdand in the CHANGELOG "Stability promise" paragraph (the test checks all three).TestConfigSurfaceIsAccountedFor(examples/internal/recipecheck): a new config path. Decide whether it is version-gated (registers a tool, changes topology or loaded content, or asserts a safety or durability property → add aGatedFeaturesrow), thengo test ./examples/internal/recipecheck -run TestConfigSurfaceIsAccountedFor -update.TestInvocationCensus(dev/harness-config-check): a new script underdev/that runs the binary needs its expected count in the census.
What the sweep does not prove
It proves the change does not break what is already checked. It does not
prove the new behaviour is correct, and it does not prove a new test would
have caught the bug it is supposed to catch — that is the
prefix-failure-verification skill, and it is a separate step.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

