Skip to content

Commit 35e0451

Browse files
authored
Implement tracked correctness fixes (#134)
* Implement tracked correctness fixes * Expand enum semantic coverage * Address default export and require review feedback * Address enum review feedback * Address remaining PR feedback * Address export parser review feedback * Handle typed arrow export signatures
1 parent 40021bd commit 35e0451

44 files changed

Lines changed: 1444 additions & 168 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ npm i -g @lzehrung/codegraph
297297
npm i -g https://github.com/lzehrung/codegraph/releases/download/vVERSION/lzehrung-codegraph-VERSION.tgz
298298
```
299299

300-
Replace `VERSION` with the release you want. The root tarball does not bundle the native addon; source-language parsing still needs the scoped native package path via the `@lzehrung` GitHub Packages registry. Without it, Codegraph runs in reduced graph-only mode.
300+
Replace `VERSION` with the release you want. The root tarball does not bundle the native addon; source-language parsing still needs the scoped native package path via the `@lzehrung` GitHub Packages registry. Without it, Codegraph runs in reduced graph-only mode. The `@lzehrung/codegraph-js-fallback` package is a compatibility shim, not an alternate parser bundle.
301301

302302
## FAQ
303303

codegraph-skill/codegraph/SKILL.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ Use the scoped packages only:
8282
- native backend: `@lzehrung/codegraph-native`
8383
- compatibility shim: `@lzehrung/codegraph-js-fallback`
8484

85+
The compatibility shim is not a grammar fallback. Do not suggest installing it to restore source-language parsing when the native backend is unavailable.
86+
8587
Registry:
8688

8789
```bash

docs/installation.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Requirements and install paths for local source checkouts, published packages, r
88
- Published installs do not require Rust or a manual native setup step on supported targets.
99
- Local source checkouts do not require Rust just to build `dist/`, but the native workspace addon only builds when Cargo is available.
1010
- If no compatible native artifact is available, Codegraph drops to reduced graph-only and regex recovery mode instead of loading JS grammars.
11-
- Published installs do not need a separate grammar bundle for supported source-language parsing.
11+
- The root package does not install a JavaScript grammar fallback. `@lzehrung/codegraph-js-fallback` is only a compatibility shim package and does not provide parser recovery unless a future release documents that capability explicitly.
1212

1313
## Option 1: Local source checkout
1414

@@ -84,7 +84,7 @@ Explicit CLI, library, and tool `native` options take precedence over `CODEGRAPH
8484

8585
- `@lzehrung/codegraph`: main library and CLI
8686
- `@lzehrung/codegraph-native`: optional native runtime package that resolves the matching binary artifact
87-
- `@lzehrung/codegraph-js-fallback`: compatibility shim package with no grammar bundle
87+
- `@lzehrung/codegraph-js-fallback`: compatibility shim package with no grammar bundle; installing it separately does not restore non-native Tree-sitter parsing
8888

8989
Reduced mode preserves graph-only and regex-backed recovery where available; it does not provide a non-native Tree-sitter parser.
9090

docs/language-parity.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ Notes:
4444
- Native parity coverage includes both extraction parity and end-to-end semantic parity on the current source-language fixture set (`TypeScript`, `TSX`, `JavaScript`, `Python`, `PHP`, `Go`, `Java`, `C#`, `Rust`, `Kotlin`, `Swift`, `Zig`, `C`, `C++`, `Ruby`) plus graph/specifier parity for `HTML`, `CSS`, `Less`, `SCSS`, `Vue`, and `Svelte`.
4545
- Deeper hardening coverage includes Go aliases and interface-typed uses.
4646
- Deeper hardening coverage includes Kotlin aliases, wildcard imports, package-wide wildcard graph expansion, and native-owned import-binding recovery.
47-
- Deeper hardening coverage includes Java wildcard package fixtures, package-wide graph expansion, and static wildcard imports.
48-
- Deeper hardening coverage includes Rust aliased `use` imports and `extern crate` graph fixtures.
49-
- Deeper hardening coverage includes C# aliases, Swift static members, Zig `@import` namespace members, C function-pointer typedefs, C++ namespace/templates, and Ruby nested modules.
47+
- Deeper hardening coverage includes Java wildcard package fixtures, package-wide graph expansion, static wildcard imports, and enum type navigation.
48+
- Deeper hardening coverage includes Rust aliased `use` imports, `extern crate` graph fixtures, and enum variant extraction.
49+
- Deeper hardening coverage includes C# aliases/enums, Swift enums/static members, Zig `@import` namespace members, C/C++ enum constants, and Ruby nested modules.
5050
- Deeper hardening coverage includes Python `from __future__ import ...` extraction.
51-
- Deeper hardening coverage includes PHP grouped `use` imports, bracketed namespaces, `__DIR__` includes, fully-qualified Composer-backed references, function/class basename collisions, and Composer classmap-boundary coverage.
51+
- Deeper hardening coverage includes PHP grouped `use` imports, bracketed namespaces, `__DIR__` includes, fully-qualified Composer-backed references, enum cases, function/class basename collisions, and Composer classmap-boundary coverage.
5252
- JavaScript graphing now includes an isolated AngularJS heuristic layer for `templateUrl`, controller-name, and DI-token file/external edges when a file explicitly uses `angular.module(...)`. This coverage lives in dedicated framework tests, not in the generic JavaScript fixture set, and it is not a general claim that arbitrary `controller` or `templateUrl` config objects are Angular-aware.
5353
- Call compatibility hints compare changed callable arity with resolved callsites when parsing is high confidence. They are not type checking, overload resolution, trait dispatch, function-pointer analysis, macro expansion, or data-flow inference.
5454
- Call compatibility skips same-file overload sets unless a future resolver can prove the exact overload target.

docs/plans/2026-06-06-performance-and-cache-opportunities.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -425,12 +425,12 @@ These are not primarily performance work, but they remained confirmed high-value
425425

426426
Checklist:
427427

428-
- [ ] TypeScript enum declarations should be indexed as real symbols for goto/refs.
429-
- [ ] Anonymous JS/TS default exports should resolve through default imports.
430-
- [ ] JS/TS shorthand binding nodes should navigate to the actual binding/import.
431-
- [ ] Breaking-change suggestions should handle multiline exported signatures.
432-
- [ ] Publishing/install docs should clarify that JS fallback is only available when `@lzehrung/codegraph-js-fallback` is installed.
433-
- [ ] Consider stable subpath exports before narrowing the broad root API.
428+
- [x] TypeScript enum declarations should be indexed as real symbols for goto/refs.
429+
- [x] Anonymous JS/TS default exports should resolve through default imports.
430+
- [x] JS/TS shorthand binding nodes should navigate to the actual binding/import.
431+
- [x] Breaking-change suggestions should handle multiline exported signatures.
432+
- [x] Publishing/install docs should clarify that the JS fallback package is only a compatibility shim and does not provide parser recovery.
433+
- [x] Consider stable subpath exports before narrowing the broad root API.
434434

435435
## Suggested Execution Order
436436

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
# Remove JS Fallback Shim Plan
2+
3+
This plan removes `@lzehrung/codegraph-js-fallback` as a published compatibility package. The package no longer provides parser recovery, is not a runtime dependency of the root package, and only preserves an old import path with throwing stubs.
4+
5+
Do not remove internal reduced-mode behavior. Codegraph should continue to degrade to graph-only and regex-backed recovery when the native backend is unavailable.
6+
7+
## Current State
8+
9+
Observed package facts:
10+
11+
- `@lzehrung/codegraph` does not depend on `@lzehrung/codegraph-js-fallback`.
12+
- The root package does not export `./js-fallback`.
13+
- `packages/codegraph-js-fallback` ships only `js-fallback.cjs`, `js-fallback.d.ts`, and no grammar dependencies.
14+
- `src/jsFallback.ts` is still used internally for type-compatible parser stubs and unavailable-error detection.
15+
- Release tooling still treats `js-fallback` as a third publishable package.
16+
17+
Decision:
18+
19+
- Remove the standalone compatibility package.
20+
- Keep internal `src/jsFallback.ts` for now unless the implementation pass proves every internal type/use can be deleted safely.
21+
- Keep reduced-mode regex recovery and native fallback reporting intact.
22+
23+
## Phase 1: Package Boundary Cleanup
24+
25+
Implementation checklist:
26+
27+
- [ ] Delete `packages/codegraph-js-fallback/`.
28+
- [ ] Remove package-specific release metadata for `js-fallback` from `scripts/release-lib.mjs`.
29+
- [ ] Remove `js-fallback` version planning, manifest normalization, package selection, and publish handling from `scripts/release.mjs`.
30+
- [ ] Remove `js-fallback` from `.github/workflows/release.yml` publish commands and release notes.
31+
- [ ] Remove package-specific checks from `tests/package-metadata.test.ts`.
32+
- [ ] Confirm root `package.json` workspaces remain correct after deleting the package.
33+
34+
Acceptance:
35+
36+
- Release package selection accepts only `root`, `native`, `@lzehrung/codegraph`, and `@lzehrung/codegraph-native`.
37+
- No publish path references `@lzehrung/codegraph-js-fallback`.
38+
- No workspace package remains under `packages/codegraph-js-fallback`.
39+
40+
## Phase 2: Internal Shim Review
41+
42+
Implementation checklist:
43+
44+
- [ ] Audit every import from `src/jsFallback.ts`.
45+
- [ ] Keep `JsSyntaxTree`, `JsSyntaxNode`, and related structural types only if native query/result adapters still need them.
46+
- [ ] Rename internal-only concepts if useful so `jsFallback` does not imply an external parser backend.
47+
- [ ] Preserve `isJsFallbackUnavailableError()` behavior if build/index fallback diagnostics still depend on it.
48+
- [ ] Do not reintroduce any JS Tree-sitter grammar dependency.
49+
50+
Acceptance:
51+
52+
- Internal names no longer suggest users can install a parser fallback package.
53+
- Native-unavailable behavior still reports reduced mode, not a missing package instruction.
54+
- TypeScript build proves no stale external shim imports remain.
55+
56+
## Phase 3: Documentation Cleanup
57+
58+
Implementation checklist:
59+
60+
- [ ] Remove `@lzehrung/codegraph-js-fallback` from `README.md` install/release guidance.
61+
- [ ] Remove fallback shim package role from `docs/installation.md`.
62+
- [ ] Remove fallback shim release guidance from `PUBLISHING.md`.
63+
- [ ] Remove fallback shim mention from `codegraph-skill/codegraph/SKILL.md`.
64+
- [ ] Update any release examples that mention `--package js-fallback`.
65+
- [ ] Keep reduced-mode documentation explicit: without native, Codegraph has graph-only and regex recovery, not parser recovery.
66+
67+
Acceptance:
68+
69+
- User-facing docs list only root and native packages.
70+
- Docs do not imply installing another package can restore non-native Tree-sitter parsing.
71+
- Skill guidance matches current CLI/package surface.
72+
73+
## Phase 4: Test Updates
74+
75+
Implementation checklist:
76+
77+
- [ ] Replace package metadata tests that assert shim properties with tests asserting the shim package is absent.
78+
- [ ] Update release-script tests to cover the two-package release model.
79+
- [ ] Keep native fallback contract tests focused on reduced mode and native package absence.
80+
- [ ] Add a regression test that release commands reject `--package js-fallback` with a clear unknown-selector error.
81+
82+
Acceptance:
83+
84+
- Tests prove `js-fallback` is not publishable.
85+
- Tests prove root/native release flow still works.
86+
- Tests prove reduced-mode fallback still works without the deleted package.
87+
88+
## Phase 5: Validation
89+
90+
Run focused checks during implementation:
91+
92+
- [ ] `npx vitest run tests/package-metadata.test.ts tests/release-script.test.ts tests/native-fallback-contract.test.ts tests/native-fallback-reporting.test.ts`
93+
- [ ] `npx vitest run tests/js-fallback-loader.test.ts` if the file still exists; otherwise delete or replace it with reduced-mode coverage.
94+
- [ ] `npm run check`
95+
96+
Manual verification:
97+
98+
- [ ] `node ./dist/cli.js doctor` reports native status without mentioning a JS fallback package.
99+
- [ ] `node ./dist/cli.js orient --root . --budget small --json` still works with native available.
100+
101+
## Risks and Non-Goals
102+
103+
Risks:
104+
105+
- Existing external consumers importing `@lzehrung/codegraph-js-fallback` will break after removal.
106+
- Release automation has several references to all publishable packages; partial cleanup can leave CI publishing stale package notes or invalid selectors.
107+
108+
Non-goals:
109+
110+
- Do not remove reduced-mode regex recovery.
111+
- Do not add a new JS parser fallback.
112+
- Do not change native package loading or native target publication except where release package enumeration currently includes `js-fallback`.

0 commit comments

Comments
 (0)