feat(stella-graph): the code-graph walk honors the repository's own ignore rules (#2360) - #2366
Merged
Merged
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Contributor
Reviewer's GuideThis PR centralizes repository ignore resolution in a new stella-graph::workspace_ignore module that shells out to git once per walk, wires it into both the code-graph index walk and the stella-tools workspace probe (including watcher events), preserves the deny-list for non-repo workspaces, and fixes process-free registry behavior so it never spawns git despite IgnorePolicy settings. Sequence diagram for process-free registry and ignore resolutionsequenceDiagram
actor Host
participant RegistryOptions
participant ToolRegistry
participant WorkspaceProbe
participant WorkspaceIgnore
participant git
Host->>RegistryOptions: configure probe_ignore_policy
Host->>ToolRegistry: new(process_free, options)
ToolRegistry->>RegistryOptions: effective_probe_ignore_policy(process_free)
RegistryOptions-->>ToolRegistry: IgnorePolicy (WalkAll if process_free)
Note over ToolRegistry,RegistryOptions: process_free forces WalkAll, no git
Host->>WorkspaceProbe: capture_with(root, ToolRegistry.probe_ignore_policy())
WorkspaceProbe->>WorkspaceIgnore: resolve(root)
alt workspace_is_repo and not process_free
WorkspaceIgnore->>git: ls-files -z --others --ignored --directory --exclude-standard
git-->>WorkspaceIgnore: ignored paths
else non_repo or process_free
WorkspaceIgnore-->>WorkspaceProbe: none()
end
WorkspaceProbe-->>Host: WorkspaceProbe snapshot with ignored: WorkspaceIgnore
File-Level Changes
Assessment against linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
…gnore rules (#2360) Closes #2360 walk.rs carried a documented gap for two releases: custom .gitignore patterns — per-directory files, negations, globs — were not honored, only a hardcoded deny-list was. A generated directory with a project-specific name was indexed, and recall paid for it. Closed by asking git rather than reimplementing it. The new stella-graph::workspace_ignore resolves the rules once per walk (git ls-files --others --ignored --directory --exclude-standard) and is the ONE answer two walkers now share: this crate's index walk and stella-tools' workspace probe, which had its own copy from #2344. It lives in stella-graph because stella-tools already depends on it and not the reverse, so one implementation serves both with no new crate and no new dependency edge. The deny-list survives beside the rules rather than under them: it is what still prunes a vendored bundle in a workspace that is NOT a repository, where no ignore file says anything. Two filters, two jobs. The watcher resolves once at construction rather than per event — the filter runs on every saved file, and resolving per call would be one git invocation per write. A .gitignore edited mid-session is not seen until the next full index pass, which costs one wasted re-index, never a wrong row. Also fixes a defect #2344 shipped: the probe spawned git unconditionally, including under HostDataIsolation::ProcessFree, whose whole promise is that no built-in launches a child process. An isolated registry now walks unfiltered — the cost is walk time, already bounded by MAX_RECORDED_TOUCHES, rather than the guarantee. Refs #2344, #2336
macanderson
force-pushed
the
fix/2360-graph-walk-gitignore
branch
from
August 8, 2026 23:03
cb72ace to
4d81dcb
Compare
…licy accessor
`probe_ignore_policy()` was added beside four call sites that all still read
the field directly, so it had no non-test caller and the lib build reported
`method `probe_ignore_policy` is never used`. Under the required job's
`cargo clippy --workspace --all-targets -- -D warnings` that warning is an
error, which is why `fmt + clippy + test` was red.
Routing the four captures through the accessor removes the dead code without
an `#[allow]` — the lint is right here, the method really was unreachable —
and makes its doc comment ("the ignore policy every capture this registry
takes will use") literally true: one chokepoint for the ProcessFree
attestation override instead of four independent field reads.
`registry.rs` nets zero lines, so its god-file ceiling is untouched.
Refs #2360
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
`cargo doc -D warnings` fails this branch:
error: public documentation for `workspace_ignore` links to private
item `crate::walk`
--> crates/stella-graph/src/workspace_ignore.rs:4
error: could not document `stella-graph`
`workspace_ignore` is `pub mod`; `walk` is a private `mod`.
`rustdoc::private_intra_doc_links` denies that under `-D warnings`, and
`--document-private-items` does not silence it for a public → private
link — the same rule and the same fix shape as #2365.
The link becomes prose. No API change, no behavior change.
macanderson
marked this pull request as ready for review
August 8, 2026 23:31
Contributor
There was a problem hiding this comment.
Sorry @macanderson, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
macanderson
enabled auto-merge (squash)
August 8, 2026 23:33
macanderson
disabled auto-merge
August 8, 2026 23:33
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.
What & why
Closes #2360.
crates/stella-graph/src/walk.rshas carried this in its own module doc for two releases:So a generated directory whose name the deny-list has never heard of —
generated-sdk/, a sibling checkout, anything project-specific — was indexed into the code graph and paid for on every recall. #2344 closed the same gap for the workspace probe; this closes it for the index, and makes the two share one answer instead of two approximations.The design: ask git, don't reimplement it
New
stella-graph::workspace_ignoreresolves the rules once per walk withgit ls-files -z --others --ignored --directory --exclude-standard. Per-directory ignore files, negations, globs,.git/info/exclude, and the user's global excludesfile therefore behave exactly as they do at the command line — because the answer is git's. A hand-rolled matcher would be a second ignore engine to keep correct forever, and its failure mode is silent: a file quietly indexed, or quietly not.Where it lives, and why that is not arbitrary.
stella-toolsalready depends onstella-graphand not the reverse, so putting the resolver here lets one implementation serve both walkers with no new crate and no new dependency edge — and it costsstella-graphnothing butstd. The alternative considered and rejected was pulling ripgrep'signorecrate: it would give this crate a dependency and leavestella-toolson a different mechanism, so the two could disagree about the same tree.stella-tools' private copy from #2344 is deleted in this PR.The deny-list survives beside the rules, not under them. They answer different questions: the rules say what this repository does not track, the deny-list says what is never worth parsing. A Terminal-Bench task directory is not a repository, so it has no rules to consult — and there the deny-list is the only thing keeping a vendored bundle out of the index. Witnessed both ways.
The watcher resolves once at construction, not per event. The relevance filter runs on every saved file; resolving per call would be one
gitinvocation per write. The window that opens is a.gitignoreedited while a session is live, whose new rules are not seen until the next full index pass — one wasted re-index, never a wrong row, and the same direction every other bound in this subsystem fails.A defect #2344 shipped, fixed here
HostDataIsolation::ProcessFreepromises that the registry "omit[s] every built-in tool that launches a child process". #2344's probe spawnedgitunconditionally to resolve ignore rules — including under that attestation. It now resolves toIgnorePolicy::WalkAllwhenever the registry is process-free, whatever theignore_gitignoresetting says. Losing the filter there costs walk time, whichMAX_RECORDED_TOUCHESalready bounds; honoring the setting instead would cost the guarantee.This is the "a field's second consumer arms what the first never checked" shape:
process_freewas consulted at construction for tools and for exploration coverage, and the probe's new subprocess simply never asked.The witness
main, pass here)a_repositorys_own_ignore_rules_are_honored_including_globs_and_negationsstella-graph/src/walk.rsthe_deny_list_still_applies_when_there_are_no_rules_to_consultstella-graph/src/walk.rsa_watcher_event_for_an_ignored_path_is_not_relevantstella-graph/src/walk.rsa_repositorys_own_rules_are_resolved_including_a_collapsed_directorystella-graph/src/workspace_ignore.rs--directorycollapsing, andexcludesvsexcludes_dira_non_repository_ignores_nothing_even_inside_a_repositorystella-graph/src/workspace_ignore.rs$HOMEdotfiles repo ignoring*cannot blind a scratch dir under ita_process_free_registry_never_consults_the_repositorys_ignore_rulesstella-tools/src/registry/tests/file_change.rsThe pre-existing
dist_standalone_and_next_directories_are_never_walkedis unchanged and still green — that is the non-repository posture stated as a test that predates this PR.God-file accounting
registry.rssat at its exact ratchet ceiling again, so the process-free resolution went toRegistryOptions::effective_probe_ignore_policyinregistry/options.rsand the accessor toregistry/turn_probe.rs.registry.rsnets −7;shell_touch.rsnets −42 from deleting the duplicated resolver.file-sizeis green and reports "none grew by this change".Docs
crates/stella-graph/README.md's "Gotchas" entry claimed the gap; it now describes the two-filter arrangement. The.gitattributeshalf of that entry is genuinely still unresolved and is now stated separately rather than bundled with a gap that is closed.The gate
Not run locally — a Terminal-Bench match is executing on this machine (
harbor run … sqlite-with-gcov) and a workspace build would contend for CPU, which is how a trial acquires a false timeout.make guards-fastis green, includingfile-size,god-files,module-reachabilityandfmt --check. The compile tiers are deliberately CI's.Opened as a draft on purpose: it is unverified until CI compiles it, and this repository merges PRs fast. Marking it ready is the signal that the build is green.
cargo fmt --check· [ ]cargo clippy --workspace --all-targets -- -D warnings· [ ]cargo test --workspaceDepends on
#2365 unbreaks
main(a public item intra-doc-linking a private one, landed by #2344). Until that merges, this PR is red for a reason that has nothing to do with it. This branch already carries the equivalent fix, so expect a one-line conflict on rebase.Ground-rule check
stella-core; no new dependencies in any crateWorkspaceIgnoreis internal to the tool/graph layer, not a protocol type)Nothing left behind
.gitattributesper-directory merging remains unresolved and is now named on its own in the README gotcha rather than hidden inside a gap that is closed. It is pre-existing, unrelated to the walk, and already visible to a reader of that section.Summary by Sourcery
Unify and harden workspace ignore handling by introducing a shared git-backed WorkspaceIgnore resolver used by both the code-graph walk and workspace probes, ensuring repository .gitignore rules are honored alongside the existing deny-list while preserving process-free isolation guarantees.
New Features:
Bug Fixes:
Enhancements:
Documentation:
Tests: