GitNexus/gitnexus/test/unit/scope-resolution
azizur100389 5fc518d2cb
fix(dart): resolve package imports by pubspec identity (#3369)
* fix(dart): resolve package imports by pubspec identity

* fix(dart): keep package-identity edges out of the cycle check

Pubspec identity edges invalidate importers when a manifest changes. They cannot form an init cycle, so the cycle query excludes them before the row cap. Discovery reads each manifest once, with a size bound, and resolution shares one package-URI parser with those edges.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Address PR review feedback (#3369)

- Reject package URIs with an empty library path so they do not emit identity edges
- Skip the pubspec permission test where chmod cannot deny reads
- Document that the Dart heap probe is not a uniqueTarget spelling

Note: pre-existing failure in test/unit/incremental-index-extension-dml-gate.test.ts not addressed by this PR.
Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(dart): list package directories through a no-follow descriptor

A directory replaced by a symlink between the parent listing and the next visit must not be traversed. The walk opens it with O_DIRECTORY|O_NOFOLLOW and lists that inode.

Co-authored-by: Cursor <cursoragent@cursor.com>

* chore(autofix): apply prettier + eslint fixes via /autofix command

* fix(mcp): keep the Dart identity reason out of MCP startup

The cycle query still excludes the same reason string. The constant now lives with the other non-initializing import reasons, so MCP startup does not load a language provider.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Address PR review feedback (#3369)

Open discovered pubspecs and child directories through the parent directory inode on Linux, so replacing that directory with a symlink cannot redirect the walk.

Note: pre-existing failure in test/unit/incremental-index-extension-dml-gate.test.ts (worker pool startup timeout) not addressed by this PR.
Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(dart): reject Windows junctions during pubspec walk

* Address PR review feedback (#3369)

Refuse pubspec discovery that cannot set O_NOFOLLOW, and verify macOS child opens against the pinned directory chain instead of reopening a mutable path.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(dart): bound live pubspec descriptors and close the macOS check-then-open

A deep directory chain held one descriptor per level until open failed with EMFILE, and macOS child opens statted the path before using it. Refuse the next directory at 64 live handles, and stat only the descriptor opened with O_NOFOLLOW.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(dart): open pubspecs non-blocking so a FIFO cannot hang discovery

A listed pubspec can be replaced by a FIFO before open. O_RDONLY alone waits inside open for a writer, so the file-type check never runs. O_NONBLOCK returns immediately and the walk rejects the non-regular file.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(dart): cap names read from each pubspec directory

readdir kept every entry before the visit budget could run, so one huge directory could allocate without bound. Read the listing one name at a time and fail closed past 100,000 entries.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(dart): reject a pubspec that grows while its descriptor is read

The size cap was taken from the stat before the read, so a file that grew in that window could be parsed from a short prefix. Re-stat the same descriptor afterward and fail closed when the size no longer matches the bytes captured.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(ci): rebaseline the Dart scope-capture fingerprint for package-import fixtures

The benchmark hashes every dart-* fixture. The new package-import corpus adds six Dart files and 33 capture groups. Parking that directory restores the previous fingerprint, so this is corpus growth, not a capture change.

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Gergő Magyar <gergomagyar@icloud.com>
Co-authored-by: Gergo Magyar <gergomagyar0@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-09-26 13:21:09 +01:00
..
c fix(scope-resolution): resolve callable reference flows (#2437) (#2522) 2026-07-17 17:20:02 +01:00
cpp perf(cpp): index qualified namespace members once per pipeline run (#2788) (#2794) 2026-08-02 15:52:33 +01:00
csharp fix: bind Razor ViewComponent names to in-repo classes (#3104) 2026-08-30 22:41:13 +00:00
go fix(go, workspace): resolve test siblings and tighten package discovery (#3191) 2026-09-10 12:22:12 +01:00
java fix(resolution): label fallback guesses and preserve export visibility (#3190) 2026-09-10 11:38:19 +01:00
javascript feat(ingestion): add tRPC procedure detection and MCP chain/route surfacing (#3339) 2026-09-21 09:44:42 +01:00
objective-c feat(indexing): add Objective-C semantic indexing support (#3179) 2026-09-09 09:40:21 +00:00
php fix(php): gate imports by Composer autoload map (#2987) 2026-08-25 07:56:41 +01:00
python fix(resolution): label fallback guesses and preserve export visibility (#3190) 2026-09-10 11:38:19 +01:00
ruby fix(ruby): guard gem requires with dependency metadata (#3096) 2026-09-10 16:04:11 +01:00
rust fix(rust): qualify items by their enclosing mod chain so same-named ones stay distinct (#2742) (#2745) 2026-07-30 17:08:00 +01:00
swift fix(swift): resolve imports from Package.swift targets, not path segments (#3105) 2026-09-19 15:50:31 +01:00
typescript feat(ingestion): add tRPC procedure detection and MCP chain/route surfacing (#3339) 2026-09-21 09:44:42 +01:00
callable-flow-captures.test.ts fix(impact): fail closed on id-less targets and follow ??/||/?: callable values (#3354) (#3373) 2026-09-25 21:43:24 +01:00
callable-value-flow-env.test.ts feat: make MAX_CALLABLE_VALUE_TARGETS configurable via env (#2725) 2026-08-01 12:42:36 +01:00
callable-value-flow-worklist.test.ts perf(emit): drop six equivalent redundancies on Java-scale index path (#3129) 2026-09-01 11:22:55 +00:00
callable-value-target-index.test.ts fix(scope-resolution): parse def coordinates after file paths (#2743) 2026-07-30 07:34:32 +01:00
cobol-import-target-parity.test.ts fix(cobol): prefer copybook dirs so COPY EXTERNAL does not hit vendor decoys (#3240) 2026-09-10 15:42:59 +01:00
construction-syntax-wiring.test.ts fix(resolution): type inline constructor receivers in every spelling (#2708) (#2737) 2026-07-29 16:19:53 +01:00
def-index.test.ts feat(shared): DefIndex / ModuleScopeIndex / QualifiedNameIndex (#913, RFC #909 Ring 2 SHARED) (#958) 2026-04-18 15:59:34 +01:00
definition-id.test.ts fix(scope-resolution): parse def coordinates after file paths (#2743) 2026-07-30 07:34:32 +01:00
emit-references.test.ts feat(ingestion): emit-references drains ReferenceIndex to graph edges (#925, RFC #909 Ring 2 PKG) (#973) 2026-04-18 23:36:10 +01:00
esm-export-marker.test.ts fix(resolution): label fallback guesses and preserve export visibility (#3190) 2026-09-10 11:38:19 +01:00
external-import-conformance.test.ts fix(dart): resolve package imports by pubspec identity (#3369) 2026-09-26 13:21:09 +01:00
finalize-algorithm.test.ts fix(check): stop reporting erased and deferred imports as initialization cycles (#2934) 2026-08-12 17:09:32 +00:00
finalize-orchestrator.test.ts fix(python): resolve classes through module imports (#2770) 2026-08-01 06:02:47 +01:00
free-call-fallback-guess-taint.test.ts fix(resolution): label fallback guesses and preserve export visibility (#3190) 2026-09-10 11:38:19 +01:00
function-local-import-chain.test.ts fix(check): stop reporting erased and deferred imports as initialization cycles (#2934) 2026-08-12 17:09:32 +00:00
generic-instantiation.test.ts fix(scope-resolution): make interface dispatch generic-instantiation aware (#2912) (#2939) 2026-08-13 14:50:53 +01:00
graph-bridge-label-split.test.ts fix: type an inference-typed class field so it can act as a call receiver (#2807) (#2810) 2026-08-04 19:31:25 +01:00
heritage-type-arguments.test.ts fix(scope-resolution): make interface dispatch generic-instantiation aware (#2912) (#2939) 2026-08-13 14:50:53 +01:00
import-scope-provenance.test.ts fix(resolution): label fallback guesses and preserve export visibility (#3190) 2026-09-10 11:38:19 +01:00
import-target-adapter.test.ts feat(ingestion): per-language resolveImportTarget adapter (#922, RFC #909 Ring 2 PKG) (#971) 2026-04-18 21:11:24 +01:00
import-target-index-parity.test.ts fix(dart): resolve package imports by pubspec identity (#3369) 2026-09-26 13:21:09 +01:00
import-target-index-reuse.contract.test.ts fix(dart): resolve package imports by pubspec identity (#3369) 2026-09-26 13:21:09 +01:00
imported-return-types.test.ts fix(ingestion): two-channel binding lifecycle (closes #1066) + scope-resolution I8 hardening (#1082) 2026-04-26 12:16:09 +01:00
imports-to-edges-deferred.test.ts fix(check): stop reporting erased and deferred imports as initialization cycles (#2934) 2026-08-12 17:09:32 +00:00
imports-to-edges-type-only.test.ts fix(check): stop reporting erased and deferred imports as initialization cycles (#2934) 2026-08-12 17:09:32 +00:00
method-dispatch-index.test.ts chore(shared): apply Ring 2 SHARED review follow-ups in one diff (#964) 2026-04-18 18:40:29 +01:00
module-scope-index.test.ts feat(shared): DefIndex / ModuleScopeIndex / QualifiedNameIndex (#913, RFC #909 Ring 2 SHARED) (#958) 2026-04-18 15:59:34 +01:00
name-fallback-summary.test.ts fix(resolution): label fallback guesses and preserve export visibility (#3190) 2026-09-10 11:38:19 +01:00
name-fallback-visibility.test.ts fix(rust): respect Cargo target boundaries in name fallback (#3294) 2026-09-16 11:36:07 +01:00
namespace-channel-lookup.test.ts fix(csharp): eliminate global-namespace typeBindings O(files²) OOM (#1871) (#1954) 2026-05-31 18:21:07 +01:00
namespace-targets-import-path.test.ts fix(python): resolve calls through an unaliased dotted namespace import (#2826) (#2828) 2026-08-05 11:35:27 +01:00
node-lookup-determinism.test.ts perf(emit): drop six equivalent redundancies on Java-scale index path (#3129) 2026-09-01 11:22:55 +00:00
overload-narrowing.test.ts feat(cpp): sfinae filter (#1623) 2026-05-16 20:23:13 +01:00
parse-worker-scope-integration.test.ts fix(php): synthesize module scope for namespace-less PHP files (.phtml) (#1801) 2026-05-24 20:37:17 +01:00
php-import-target-parity.test.ts fix(php): gate imports by Composer autoload map (#2987) 2026-08-25 07:56:41 +01:00
pick-implicit-this-overload.test.ts fix(swift): resolve inherited protocol extension calls (#3309) 2026-09-19 07:44:35 +01:00
pick-unique-global-callable.test.ts perf(ingestion): Linux-kernel-scale analysis — worker-pool parse + finalize O(n²) + scope-resolution memory wall (#1983) (#2038) 2026-06-06 22:46:34 +01:00
pick-unique-global-class.test.ts feat(swift): migrate Swift to scope-based registry resolution (#937) (#1948) 2026-05-31 16:56:47 +01:00
position-index.test.ts chore(shared): apply Ring 2 SHARED review follow-ups in one diff (#964) 2026-04-18 18:40:29 +01:00
property-dispatch-fanout-env.test.ts feat: make MAX_PROPERTY_DISPATCH_FANOUT configurable via env (#2726) 2026-08-01 12:18:07 +01:00
property-name-index.test.ts feat: close reported graph blind spots in reference resolution, analyze and storage (#2856) 2026-08-08 09:58:14 +01:00
qualified-name-index.test.ts chore(shared): apply Ring 2 SHARED review follow-ups in one diff (#964) 2026-04-18 18:40:29 +01:00
receiver-chain-fold.test.ts fix(resolution): resolve Go pointer-receiver calls, and report the program boundary instead of hedging (#2766) (#2782) 2026-08-01 22:42:18 +01:00
receiver-chain-wiring.test.ts feat(resolution): type receiver chains from AST structure across all 14 languages (#2708) + epistemic lower-bound (#2744) (#2747) 2026-07-31 07:12:57 +01:00
reconcile-ownership.test.ts fix(cpp): suppress deleted overload winners (#2094) 2026-06-10 18:41:30 +01:00
references-to-edges-call-form.test.ts feat: add Zig language support (#1432) 2026-09-03 13:29:42 +01:00
registries.test.ts perf(scope-resolution): use owner-keyed lookup for Step 2 member resolution (#1657) 2026-05-18 13:14:27 +01:00
resolve-ambiguous-inheritance-base.test.ts fix(ingestion): migrate all languages' inheritance to scope-resolution on the worker path (#1951) (#1956) 2026-06-01 17:04:27 +01:00
resolve-references.test.ts perf(scope-resolution): use owner-keyed lookup for Step 2 member resolution (#1657) 2026-05-18 13:14:27 +01:00
resolve-type-ref.test.ts chore(shared): apply Ring 2 SHARED review follow-ups in one diff (#964) 2026-04-18 18:40:29 +01:00
resolved-callee-names.test.ts fix(resolution): label fallback guesses and preserve export visibility (#3190) 2026-09-10 11:38:19 +01:00
run-progress.test.ts fix(impact): report scope extraction omissions (#3071) 2026-08-29 08:38:20 +01:00
rust-cargo-targets.test.ts fix(rust): respect Cargo target boundaries in name fallback (#3294) 2026-09-16 11:36:07 +01:00
scope-extractor.test.ts fix(swift): resolve inherited protocol extension calls (#3309) 2026-09-19 07:44:35 +01:00
scope-id.test.ts feat(shared): ScopeTree + PositionIndex + makeScopeId (#912, RFC #909 Ring 2 SHARED) (#961) 2026-04-18 16:41:38 +01:00
scope-source-content-policy.test.ts feat(spring): build bean candidate inventory (#2494) 2026-07-20 09:28:23 +01:00
scope-tree.test.ts fix(scope-resolution): allow same-range Module-as-parent for top-level scopes (closes #1086) (#1087) 2026-04-27 11:06:54 +01:00
strip-cast-wrappers.test.ts fix: Java cast-wrapped and this.method() call edges (#2357) 2026-07-02 17:19:33 +01:00
swift-extension-owners.test.ts fix(swift): resolve inherited protocol extension calls (#3309) 2026-09-19 07:44:35 +01:00
swift-target-grouping.test.ts fix(swift): resolve imports from Package.swift targets, not path segments (#3105) 2026-09-19 15:50:31 +01:00
type-parameters.test.ts fix(resolution): resolve calls through a generic-typed field receiver in every language (#2833) (#2855) 2026-08-07 17:14:13 +01:00
undecided-satisfaction.test.ts fix(go): resolve out-of-repo package qualifiers, and stop reporting an undecided interface check as a decided negative (#2873) (#2921) 2026-08-11 10:36:59 +01:00
unresolved-receiver-files.test.ts fix(go): scope and define each type_spec, not the type_declaration (#2837) (#2843) 2026-08-06 00:55:48 +01:00
unresolved-receivers.test.ts fix(resolution): resolve Go pointer-receiver calls, and report the program boundary instead of hedging (#2766) (#2782) 2026-08-01 22:42:18 +01:00
validate-bindings-immutability.test.ts fix(csharp): eliminate global-namespace typeBindings O(files²) OOM (#1871) (#1954) 2026-05-31 18:21:07 +01:00
value-ref-dispatchability.test.ts fix(zig): model callable-value references, and stop reporting their absence as exact (#3219) 2026-09-09 20:12:17 +00:00
value-ref-namespace-precedence.test.ts fix(zig): model callable-value references, and stop reporting their absence as exact (#3219) 2026-09-09 20:12:17 +00:00
walkers-augmentations.test.ts fix(scope-resolution): gate C#/Kotlin free calls by instance ownership (#2563) (#2654) 2026-07-24 13:31:56 +01:00
wildcard-collision-export-evidence.test.ts fix(resolution): label fallback guesses and preserve export visibility (#3190) 2026-09-10 11:38:19 +01:00
wildcard-topLevelOnly-gate.test.ts fix(resolution): label fallback guesses and preserve export visibility (#3190) 2026-09-10 11:38:19 +01:00
workspace-index.test.ts fix(swift): resolve inherited protocol extension calls (#3309) 2026-09-19 07:44:35 +01:00