Skip to content

feat(config): add include to force gitignored first-party source into the index - #137

Merged
sunerpy merged 1 commit into
mainfrom
feat/upstream-1.4.1-release-b-include-config
Jul 14, 2026
Merged

sunerpy merged 1 commit into
mainfrom
feat/upstream-1.4.1-release-b-include-config

Conversation

@sunerpy

@sunerpy sunerpy commented Jul 14, 2026

Copy link
Copy Markdown
Owner

Summary

Upstream-sync Release B — ports colby #1063 (2a06d9a): an [indexing] include list of gitignore-style, root-relative path patterns (dir, ** glob, or single file) that forces first-party source into the index even when .gitignore excludes it. Solves the dual-VCS case (SVN/Perforce sources gitignored so they never land in git). Complements the existing exclude. Off by default — empty include is byte-identical to today.

  • include is a separate decision applied AFTER the ordered gitignore/exclude model: force-include iff matches include, not under a built-in skip (node_modules/.git/.godot/dist — never re-includable), and not matching an explicit exclude (exclude wins). Precedence: built-in skip > exclude > include > existing ordered model (unchanged !-negation).
  • Scanner descends an otherwise-ignored dir when it's an ancestor of an include pattern (so an included file/nested glob under a gitignored parent is reached), pruning non-included files under it.
  • Scan == watch scope: the force-include/exclude path decision is unified via one exported codegraph_extract::include_exclude_pattern_matches (whole-relative-path semantics) used by both the extractor scan and the watcher WatchPolicy, so codegraph index, codegraph sync, and the live watcher agree — sync stays byte-for-byte equal to index --force. Threaded through ExtractOptions / WatchPolicy / WatchOptions / DaemonOptions.

Verification

  • make ci green (fmt + clippy + test + guardrail + equivalence).
  • Golden .schema + fixtures byte-identical, NO regen (file-selection only).
  • New scan⇔watch parity test proves include = ["gen*"] both indexes AND watches a gitignored gen/helper.ts consistently (the divergence an initial oracle review caught and this fixes); plus builtin-skip-never-reincluded, exclude-wins, ancestor-file, and empty-include-byte-identical tests.
  • Independent oracle review: APPROVE after unifying the cross-crate matcher.

Release B of the chosen 1.2.0→1.4.1 upstream PORT subset.

…to the index

Ports upstream colby #1063: an `[indexing] include` list of gitignore-style,
root-relative path patterns (a dir, a `**` glob, or a single file) that forces
first-party source INTO the index even when `.gitignore` excludes it — the
case of a repo tracked by a second VCS (SVN/Perforce) whose sources are
gitignored so they never land in git. Complements the existing `exclude` (its
opposite). Off by default: an empty `include` leaves scan and watch behavior
byte-identical.

`include` is a separate decision applied AFTER the ordered gitignore/exclude
model: a path the model would ignore is force-included iff it matches `include`,
is not under a built-in skip (node_modules/.git/.godot/dist/…, never
re-includable), and does not match an explicit config `exclude` (exclude wins).
Precedence: built-in skip > exclude > include > the existing ordered
ignore_paths/exclude/.gitignore model with `!`-negation, which is unchanged. The
scanner also descends an otherwise-ignored directory when it is an ancestor of
an include pattern, so an included file or nested glob under a gitignored parent
is reached, while non-included files under it stay pruned.

The force-include/exclude path decision is unified across crates via a single
exported `codegraph_extract::include_exclude_pattern_matches` (whole-relative-path
semantics), used by both the extractor scan and the watcher's WatchPolicy, so
`codegraph index`, `codegraph sync`, and the live file-watcher agree on scope —
`sync` output stays byte-for-byte equal to `index --force`. Threaded through
ExtractOptions, WatchPolicy, WatchOptions, and DaemonOptions.

Golden .schema and all fixtures unchanged (file-selection only; no regen).
@codecov

codecov Bot commented Jul 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.28647% with 14 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/codegraph-watch/src/sync.rs 90.24% 8 Missing ⚠️
crates/codegraph-extract/src/engine.rs 97.53% 4 Missing ⚠️
crates/codegraph-watch/src/policy.rs 97.82% 2 Missing ⚠️

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #137      +/-   ##
==========================================
- Coverage   95.65%   95.64%   -0.01%     
==========================================
  Files         115      115              
  Lines       55790    56459     +669     
==========================================
+ Hits        53364    54000     +636     
- Misses       2426     2459      +33     
Files with missing lines Coverage Δ
crates/codegraph-cli/src/main.rs 89.22% <100.00%> (+<0.01%) ⬆️
crates/codegraph-core/src/config.rs 99.43% <100.00%> (+0.03%) ⬆️
crates/codegraph-daemon/src/lib.rs 91.78% <100.00%> (+0.18%) ⬆️
crates/codegraph-watch/src/watcher.rs 94.02% <100.00%> (+0.03%) ⬆️
crates/codegraph-watch/src/policy.rs 97.80% <97.82%> (-0.01%) ⬇️
crates/codegraph-extract/src/engine.rs 96.22% <97.53%> (+0.37%) ⬆️
crates/codegraph-watch/src/sync.rs 97.91% <90.24%> (-0.84%) ⬇️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sunerpy
sunerpy merged commit 69a5a2b into main Jul 14, 2026
7 checks passed
@sunerpy
sunerpy deleted the feat/upstream-1.4.1-release-b-include-config branch July 14, 2026 07:10
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.

1 participant