Skip to content

fix(detect): do not prune scan root when explicitly passed even if gitignored (#2358) - #2370

Open
shard-c6 wants to merge 1 commit into
Graphify-Labs:v8from
shard-c6:fix/issue-2358-gitignore-detect
Open

shard-c6 wants to merge 1 commit into
Graphify-Labs:v8from
shard-c6:fix/issue-2358-gitignore-detect

Conversation

@shard-c6

@shard-c6 shard-c6 commented Aug 1, 2026

Copy link
Copy Markdown

Fixes #2358

Problem

When the scan root itself is matched by an ancestor .gitignore
(e.g. corpus/ in the parent repo's .gitignore), detect()
silently prunes all nested files while top-level files survive.

Fix

In _eval(), when the scan root is a descendant of the pattern's
anchor directory, rebase the relative path to the scan root so
unanchored patterns only match path components below the scan
root — not the scan root's own name.

Testing

  • Added test_ancestor_gitignore_matching_scan_root_does_not_prune_nested
  • Full test_detect.py suite: 227 passed, 0 failed

@graphify-labs graphify-labs Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks safe to merge — no coupling regressions and no blocking issues, checked against the code graph (not a self-assessment).

Graphify reviewed this change.

Looks safe to merge — no coupling regressions and no blocking issues, checked against the code graph (not a self-assessment).


Graphify review — findings

This PR modifies the _is_ignored logic in graphify/detect.py to handle the case where the scan root is a descendant of a .gitignore anchor directory. When the scan root differs from the pattern anchor, it rebases the relative path used for pattern matching to be relative to the scan root rather than the anchor. It also adds a new test verifying that nested files under a scan root aren't dropped when that root matches an ancestor's ignore rule (#2358), with the bulk of the diff being unrelated test-symbol churn in tests/test_detect.py.

No blocking issues surfaced. 4 lower-confidence candidates did not survive cross-model review.

Analysis details — impact, health, verification

Impact & health

Graphify review

Impact — 1168 functions depend on the 421 functions this change touches.

Health — this change adds coupling hotspots:

  • worse: detect() — 81 callers, 11 callees

Verification — 1168 functions in the blast radius were not formally verified this run (proofs are advisory here).

Gate & verification

graphify gate

PASS — objectively clean (no health regressions, tests not run — proofs not run this pass (advisory)). Grounded, not self-assessed.

Advisory (not blocking):

  • verification_scope: 614 function(s) in the blast radius were not formally verified this run

· 1 more finding(s) on lines outside this diff (see the check run).

@shard-c6 shard-c6 left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes #2358 with proper reproducibility of the issue.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

detect(): scan root itself matched by an ancestor .gitignore prunes nested files but not top-level ones (near-total silent data loss)

1 participant