You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(ci): the second-sgconfig check counts only the files git tracks, so scratch under .data cannot fail a commit #1787
test_the_network_construct_gate_has_no_escape fails in a checkout whose gitignored .data/ holds an sgconfig.yml, and so does the commit hook that runs the covering tests, with no change of the committer's at fault. It cost a failed commit and a re-do from a worktree on 2026-10-21.
Evidence
_sgconfig_escapes in tests/test_architectural_invariants.py reports "a second sgconfig.yml" for every sgconfig.yml it finds under the project root. It reads the working tree, not the committed files.
The primary checkout's .data/agent/scratch/refine/work/astgrep/sgconfig.yml and astgrep2/sgconfig.yml, from an earlier agent run, are untracked and gitignored. With them present, the test fails there. It passes in a fresh worktree and on CI.
The same working-tree scans (covered = (project / "src").rglob("*")) read ignored files in other invariants.
Remedy
The scan counts only the files git tracks, as the other invariants that guard the committed tree do, so a scratch directory cannot fail it.
Acceptance criteria
Tests first: an untracked sgconfig.yml under .data/ does not fail the check, and a tracked second one still does.
The check for a second sgconfig.yml read the working tree with rglob. A nested worktree under .claude/worktrees/ and scratch under .data/ hold an sgconfig.yml that no commit holds. They failed test_the_network_construct_gate_has_no_escape and the commit hook, but CI passed. The scan of the covered source files under src read the working tree in the same way.
Change
_tracked_paths runs git ls-files -z and returns the names that git tracks. _sgconfig_escapes asks for :(glob)**/sgconfig.yml and excludes the root file. It reports a tracked second sgconfig.yml at any depth and names it. _network_construct_escapes reads the tracked files under src. A project that is not a git repository fails the check, and it does not pass on an empty listing. The fixture git_environment removes the repository variables that a commit hook sets, so a test cannot write into the index of the commit. The fixture git_project builds on it. The change touches no file in src/.
Existing tool considered
Git already names the tracked files, and its pathspecs select by name. The change adopts git ls-files. It adds no ignore logic, no list of directory names and no dependency. The helper get_git_tracked_files in tests/support/workspace_tripwire.py returns an empty list on each failure, so the check could pass with no repository. The change does not reuse it. _tracked_paths has 4 lines. I estimate that the helper, the fixtures and the tests cost about 25,000…
Acceptance Criteria of docs/agent/tasks/task-1787-the-second-sgconfig-check-counts-tracked-files.md:
An untracked sgconfig.yml under .data/, and one in a nested worktree under .claude/worktrees/, do not fail the check.
A tracked second sgconfig.yml still fails the check at any depth and the message names it.
A project that is not a git repository fails the check, also when its temporary directory lies inside another repository.
Git in a temporary repository does not write to the repository variables that a commit hook sets.
An untracked source file that .gitignore matches does not fail the check, and a tracked one still does.
The invariants file passes in a worktree that holds a nested worktree, and the base fails there.
Each new test fails when I undo the line it guards.
uv run devops ci test tests/test_architectural_invariants.py passes.
Pending a person: run uv run devops ci in the primary checkout, which holds nested worktrees, and see test_the_network_construct_gate_has_no_escape pass.
Activity
dan-petty commentedon Oct 21, 2026
Intake placed this item to the backlog: at intake only a critical fix goes into a release; a release start pulls Ready items in, P0 features first.
The candidate fixes a defect in the CI process where untracked files caused false test failures.This issue affects the development workflow and can cause unnecessary build failures, but does not block core functionality.Fixing this improves developer experience and reduces friction in the CI pipeline without changing user-facing behavior.The fix involves adjusting how files are scanned to exclude untracked git files, which is a localized change.fix(ci): count only the files git tracks in the second-sgconfig check (…
dan-petty commentedon Oct 23, 2026
What changed
#1942, merged into
release/v0.2.39as 72b8a3c.3 file(s) changed.
How it was verified
Check runs at 3dcfcfd:
Acceptance Criteria of
docs/agent/tasks/task-1787-the-second-sgconfig-check-counts-tracked-files.md:sgconfig.ymlunder.data/, and one in a nested worktree under.claude/worktrees/, do not fail the check.sgconfig.ymlstill fails the check at any depth and the message names it..gitignorematches does not fail the check, and a tracked one still does.uv run devops ci test tests/test_architectural_invariants.pypasses.uv run devops ciin the primary checkout, which holds nested worktrees, and seetest_the_network_construct_gate_has_no_escapepass.feat(release): v0.2.39 (#1947)