Skip to content

fix(drift): honor trailing-slash gitignore rules for absent paths - #218

Open
dyk1454683243-sudo wants to merge 1 commit into
mex-memory:mainfrom
dyk1454683243-sudo:cursor/fix-gitignore-trailing-slash-exemption-dc89
Open

dyk1454683243-sudo wants to merge 1 commit into
mex-memory:mainfrom
dyk1454683243-sudo:cursor/fix-gitignore-trailing-slash-exemption-dc89

Conversation

@dyk1454683243-sudo

@dyk1454683243-sudo dyk1454683243-sudo commented Sep 19, 2026

Copy link
Copy Markdown

What

Honor directory-only gitignore rules when collecting ignored paths for MISSING_PATH.

collectIgnoredPaths asked Git via git check-ignore --stdin. Trailing-slash patterns such as local/ match directories only, and Git cannot classify a path that does not exist. On a clean checkout .mex/local was therefore not ignored — yet that is the only case MISSING_PATH can fire (when the directory is present, existsSync already skips). graph.db* already escaped because it is a glob with no trailing slash.

The ignore-collection path now also asks Git about:

  • the directory form (.mex/local/)
  • ignored parent prefixes (so a file under an absent ignored directory stays exempt)

The original claim is treated as ignored when any of those queries match. Real missing non-ignored paths still error.

Why

Addresses #202 (bullet 6 only).

Do not treat this as Fixes #202 or Closes #202 — that would auto-close the whole mega-issue.

Remaining #202 bullets stay open for follow-ups:

  1. Symbol notation (src/auth/login.validateToken)
  2. Compound extensions (.d.ts) — owned by fix(drift): treat compound extensions like .d.ts as not-paths #216
  3. Hypothetical examples (./x, x.ts, x/index.ts)
  4. Alternation shorthand (tests/grounding|traversal|...)
  5. Scoped-package resolve (@scope/pkg/package.json vs bare specifier) — owned by fix(drift): resolve scoped packages by bare specifier #217

Type of change

  • Bug fix
  • New feature
  • Refactor
  • Docs
  • CI/Tooling

How to test

  1. npx vitest run src/drift
  2. npx vitest run test/checkers.test.ts
  3. Confirm an absent .mex/local (and a path under it) is not MISSING_PATH when local/ is in .mex/.gitignore.
  4. Confirm a present ignored path is still skipped, a missing non-ignored path still errors, and .mex/graph.db / graph.db* stay exempt.
  5. Confirm the existing no-ignore .mex/local/ case still reports MISSING_PATH.
  6. npm run typecheck

Checklist

  • Focused drift tests pass (npx vitest run src/drift — 15 passed, 1 skipped #201 version-shaped case left untouched)
  • Path-checker unit tests pass (npx vitest run test/checkers.test.ts — 111 passed, including absent local/ exemption, present ignored path, non-ignored missing path, and graph.db*)
  • Typecheck passes (npm run typecheck)
  • Tests pass (npm test) — full suite is not the gate for this ignore-collection change
  • No breaking changes (or documented below)
  • Tested locally with a real project

Code-graph changes

  • This PR targets main
  • A linked issue agrees on the bounded extractor/resolver scope
  • The change follows the frozen LanguageExtractor or FrameworkResolver interface
  • A focused fixture and assertions for the expected node/edge shape are included
  • Any new grammar WASM, extension mapping, extractor, or resolver is registered
  • No graph identity, reconciliation, schema, or drift-semantics changes are included, or a core / discuss-first issue is linked above

This is a drift path-ignore check only. It does not change graph identity, extractors, or the other #202 bullets.

Git check-ignore cannot classify a path that does not exist, so directory-only
rules like local/ never matched .mex/local on a clean checkout — the only case
MISSING_PATH can fire. Also ask about the directory form and ignored parent
prefixes so a deliberately ignored path stays exempt whether or not it exists.

Addresses mex-memory#202 (bullet 6 only).

Co-authored-by: David <dyk1454683243-sudo@users.noreply.github.com>
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.

2 participants