Skip to content

fix: repair export and receiver resolution gaps - #2

Merged
NianJiuZst merged 5 commits into
mainfrom
codex/resolution-quality-fixes
Nov 1, 2026
Merged

NianJiuZst merged 5 commits into
mainfrom
codex/resolution-quality-fixes

Conversation

@NianJiuZst

@NianJiuZst NianJiuZst commented Nov 1, 2026 •

Copy link
Copy Markdown
Owner

CommonJS export chains left 678 direct express() calls unresolved, while member fallback could connect res.format() to an unrelated local format() function. Rust module roots, conditional re-exports and reduced return annotations also lost receiver information. This change repairs those paths and includes semantic facts in incremental invalidation.

Changes

  • Resolve callable CommonJS exports, re-exports, aliases and object exports; distinguish the module value from named/ES default exports; respect JS export boundaries and distinguish member property names from internal function names.
  • Restrict member fallback using declaration evidence and explicit receiver types.
  • Select declared Cargo roots, isolate auxiliary targets, and resolve qualified paths and Rust module/value namespace collisions.
  • Recover facts inside bounded conditional item wrappers without executing macros or modifying the vendored kernel. Preserve raw return annotations and propagate bounded call-chain, Result/Option, unwrap and ? types.
  • Detect framework repositories themselves, ignore Express/Gin route examples in comments, and infer supported Django default-manager returns only with a resolved Model hierarchy.
  • Invalidate consumers when member aliases or return facts change. Bump engine rules to 3 so version-2 indexes rebuild on sync; format stays 2.

Fixed-corpus results

The oracle stays pinned at d2e0389, with the same four source revisions and every edge retained. P and R below mean agreement with that upstream snapshot, not semantic ground truth.

Project Shared edges before → after Relative P before → after Relative R before → after
Express 1,384 → 2,063 54.77% → 58.96% 59.30% → 88.39%
Gin 7,626 → 7,678 96.28% → 93.45% 94.46% → 95.11%
Tokio 31,541 → 33,638 86.39% → 87.14% 79.48% → 84.77%
Django 173,752 → 174,016 93.66% → 94.07% 89.51% → 89.65%

Shared edges increase by 3,092 net (3,224 additions, 132 removals). Non-route node identities remain 100% aligned. The global 97%/95% gate is not fully met. Gin's relative P drops partly because newly enabled routes produce containment edges absent from upstream. Some removed shared edges remain real coverage gaps; they are not all claimed as correctness improvements.

The bilingual investigation explains causes, remaining gaps and incompatible route representations. Machine-readable evidence records the runtime commit, binary hashes, all per-kind results and independent SQLite intersections. README performance numbers remain pinned to their original revision; this PR makes no new speed claim.

Validation

  • cargo build --release --locked -p cgr — passed with Rust 1.94.1.
  • CGR_SYNC_SEQUENCES=6 CGR_SYNC_STEPS=100 cargo test --locked --workspace — 137 passed, 1 existing ignored, including 600 random edit steps.
  • Rust 1.99 strict Clippy (--workspace --exclude cg-kernel --all-targets -- -D warnings) and the CI package-format check — passed.
  • 40 external focused checks — baseline 18/40, fixed 40/40. Covers export chains, private exports, member aliases, foreign annotations, static/dynamic property names, macro re-exports, duplicate target names, custom library paths, qualified returns standard/custom Result behavior, and callable CommonJS values versus properties named default.
  • 24 real-repository checks — initial/full comparison, edited sync/full comparison, restored sync/full comparison and strict verification for all four corpora. Source bytes remain identical after restoration.
  • Independent SQL INTERSECT reproduces all four strict shared-edge counts.
  • Existing CLI/MCP smoke test — passed. The version-output filter now consumes the whole pipe, avoiding intermittent musl SIGPIPE failures from head -3.
  • A 42-file member-alias reproduction previously kept stale calls; the fix re-resolves only two files and matches full rebuild. Engine-2 upgrade also rebuilds and matches full.

One-off proof scripts, fixtures, SQLite snapshots and logs remain outside the repository. The changed files contain runtime code, a correction to the existing CI smoke harness, and documentation/results. The vendored kernel and both READMEs are unchanged.

GitHub CI run: all nine checks passed for 9f1c1c3, including Linux/macOS/Windows tests and smoke checks, static musl, lint and kernel reproduction.

@NianJiuZst
NianJiuZst merged commit 4090af1 into main Nov 1, 2026
9 checks passed
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