ci(checks): a change that touches no code does not run the code checks #527
No reviewers
Labels
No labels
agent-ready
bug
contract
documentation
duplicate
enhancement
good first issue
help wanted
invalid
needs-human
needs-input
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
iterative-works/iw-cli!527
Loading…
Reference in a new issue
No description provided.
Delete branch "skip-code-checks-for-document-changes"
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
An intake commit that writes only an analysis paid for a format check over 529
files, a core compile, scalafix, both unit suites, and a compile of all 34
command scripts. That took more than ten minutes and proved nothing. The
unattended intake loop writes such a commit for every issue it processes.
The rule
scripts/change-scope.shholds one rule and prints one word:A path is a document when it sits under
project-management/ordocs/, orwhen it is a markdown file in the root. Everything else is code, including
.iw/commands/,test/,.git-hooks/and.github/.It is an allowlist, so a directory nobody has classified yet is code, not a
document. Anything the script cannot work out is code as well — an unresolvable
base, a call from outside a repository, an empty path list. A wrong
documentshides a broken build; a wrong
codecosts only time.Three callers, one rule
.git-hooks/pre-commitreads the staged paths..git-hooks/pre-pushreads each pushed ref againstorigin/main.changesjob in CI reads the pull request against its base, and the othersix jobs gate on its output.
The scope is measured from the merge base, never from the remote branch. A
branch that touched code in an earlier commit still runs the checks on every
later push, and a commit that lands on
mainafter the branch starts does notcount.
Why
if:and notpaths-ignore:paths-ignore:on the trigger starts no run at all, so every required checkgoes missing rather than green. That is the state
phase-prreads as "no CI"(#485). A job skipped by
if:still reports its state, and thechangesjobitself always runs — so a document-only pull request always carries at least one
real check.
Verification
28 new tests, all green:
test/change-scope.bats— 21 tests over the path rule and the merge-base range.test/git-hooks-scope.bats— 7 tests over both hooks, every tool stubbed, so askipped check is distinguishable from a check that passed.
Mutating the rule (
*/*returning "document" instead of "code") turned 10 ofthem red, so they are fallible.
Measured on real branches:
IW-513(an intake analysis) readsdocuments; thisbranch reads
codeand paid the full pre-push cost.Notes for the reviewer
The rule is a shell script rather than a function in
core/. Both git hooks andthe CI
changesjob need an answer before paying for a JVM start, and calling./iwfrom thechangesjob would compile core — the exact cost this removes.The rule stays in one tested place.
Two pre-existing defects met while landing this, neither touched here:
ujson.ParseException: expected json value got "G" at index 0arriving with asecond connection — an HTTP GET on the daemon's socket.
docs/testing.mdsaysthe cause is not established; this narrows it. Belongs to #494.
IssuePollerTest.a read that throws leaves the poller able to read againfailed once on
mainand passed on re-run.🤖 Generated with Claude Code
https://claude.ai/code/session_01NhP5pWJetsgNK6SqmQdz7F