Repository navigation
chore: ignore the local-only working directories every agent creates - #2244
Merged
Merged
Conversation
Measured in a primary checkout: `git add -A` stages 69 files from .validation-worktrees alone. Five entries at the repository root are untracked and matched by no ignore rule; three of them are directories created by convention rather than by accident -- throwaway worktrees used to validate a PR against latest main, and a vendored upstream checkout. This is the layer that stops them reaching a commit. It is not a substitute for the root-file allowlist job, which remains the backstop: verified that a `git add -f` past these new rules is still refused by that job, naming `.validation-worktrees/` as a directory, and that the job still passes with only this change staged. Root-anchored, because a crate could legitimately hold a nested fixture directory of any of these names; only the repository root is scratch. Two further root entries are deliberately left alone: `hogpids.txt` belongs to another agent's run and should simply be deleted by its owner, and `.squad/` is a policy question about whether the team root is meant to be committed, which is not mine to answer in a chore commit. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2244 +/- ##
==========================================
+ Coverage 80.64% 81.21% +0.56%
==========================================
Files 432 432
Lines 220114 220126 +12
Branches 220114 220126 +12
==========================================
+ Hits 177512 178766 +1254
+ Misses 36717 35476 -1241
+ Partials 5885 5884 -1
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
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.
One line of context each for three directories, measured rather than assumed.
What I found
Five entries sit at the repository root that are untracked and matched by no ignore rule:
git add -Ain a primary checkout stages 69 files from.validation-worktreesalone.hogpids.txtis the one I'd flag to a human reader: it has no leading dot, so ingit statusit reads as ordinary repository content rather than as scratch.This is the untracked precursor to the class that has now arrived four times (
.commitmsg/,.commitmsg,.pris_v4.log,.body.md). Those were all files someone created and forgot. These three are directories every agent creates by convention — throwaway worktrees for validating a PR against latestmain, and a vendored upstream checkout — so unlike a filename, they are enumerable and don't require predicting anything.This does not replace the allowlist job — verified, not assumed
@holden's
Root file allowlistis the backstop and it works. I extracted the script structurally (yaml.safe_load→jobs['root-files'], asserting exactly onerun:step, per the lesson from #2052) and drove it:Root is exactly the 36 allowlisted entr(ies)..validation-worktrees/ (directory)git add -fpast the new ignore rules.gitignorestaged (control)The third row is the one that matters: an ignore rule that hid a force-added file from the guard would be worse than the problem. It doesn't —
ls-filesreports the root segment of a tracked path regardless of ignore state. So this is a layer in front of the backstop, not a replacement for it.Each staging arm asserts
git diff --cached --name-onlybefore believing any rc, because an acceptance arm can otherwise be satisfied by its own setup silently failing — which is exactly how agit addrefused by an ignore rule produced a misleading rc=0 in #2036.Deliberately not included
hogpids.txt— another agent's run artifact. It should be deleted by its owner, not permanently ignored; writing a rule for it would be predicting filenames again, which is the approach chore: enumerate what belongs at the repository root #2036 retired..squad/— whether the team root is meant to be committed is a policy question, not a chore. Flagging it rather than deciding it: right now it is onegit add -Aaway from being committed, and I don't think that's intended either way by accident. @justinchuby, worth a decision.Root-anchored (
/.worktrees/, not.worktrees/) because a crate could legitimately hold a nested fixture directory of any of these names; only the repository root is scratch.