Skip to content

fix(drift): resolve scoped packages by bare specifier - #217

Open
dyk1454683243-sudo wants to merge 2 commits into
mex-memory:mainfrom
dyk1454683243-sudo:cursor/fix-scoped-package-bare-resolve-e840
Open

dyk1454683243-sudo wants to merge 2 commits into
mex-memory:mainfrom
dyk1454683243-sudo:cursor/fix-scoped-package-bare-resolve-e840

Conversation

@dyk1454683243-sudo

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

Copy link
Copy Markdown

What

Change scoped-package existence checks in pathExists to resolve the bare specifier (@scope/pkg) instead of ${pkgName}/package.json.

Modern packages with a strict exports map often do not export ./package.json. Node then throws ERR_PACKAGE_PATH_NOT_EXPORTED even when the package is installed, listed in dependencies, and importable via the bare name. The workspace-name fallback is unchanged.

Why

Addresses #202 (bullet 5 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. gitignore trailing-slash directory exemption

Type of change

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

How to test

  1. npx vitest run src/drift
  2. Confirm an installed scoped package that blocks ./package.json export is not MISSING_PATH.
  3. Confirm a missing scoped name still reports MISSING_PATH.
  4. Confirm existing workspace-name fallback still works (test/checkers.test.ts workspace cases).
  5. npm run typecheck

Checklist

  • Focused drift tests pass (npx vitest run src/drift — 12 passed, 1 skipped #201 version-shaped case left untouched)
  • Path-checker unit tests pass (npx vitest run test/checkers.test.ts — includes the blocked-package.json export case and a still-missing scoped name)
  • Typecheck passes (npm run typecheck)
  • Tests pass (npm test) — full suite is not the gate for this one-line resolve 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-existence check only. It does not change graph identity, extractors, or the other #202 bullets.

Addresses mex-memory#202 (bullet 5 only). pathExists probed
`${pkgName}/package.json`, which modern packages with a strict exports
map do not expose, so installed importable packages were reported as
MISSING_PATH. Resolve the bare specifier and keep the workspace-name
fallback.

Co-authored-by: David <dyk1454683243-sudo@users.noreply.github.com>
The fixture assertion now accepts Node's 'not defined by "exports"'
wording (and ERR_PACKAGE_PATH_NOT_EXPORTED) so the mex-memory#202 bullet 5
regression stays honest about the old resolve path failing.

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