GitNexus/gitnexus/test
samuel mbabhazi 51ce19d77a
fix(impact): avoid upstream file seeds for private types (#3740)
* fix(impact): do not seed the owning file for a type the index recorded as not exported

The #480 seed adds the file that DEFINES a Class or Interface to the
walk, so the file's IMPORTS edges stand in for the type's importers.
For a type recorded as isExported = false no importer can name it, and
the file's importers came back as its direct dependants: a private
interface used by one function in its file reported eight route files
at depth 1, direct: 8, MEDIUM (#3602, second reproduction).

The DEFINES seed query now also returns n.isExported, matched on the
target's own label since not every node table has the column, and a
row with false is left out of the frontier. true and NULL keep the seed.

Refs #3602

* fix(impact): skip the owning-file seed only where a false export verdict is file-private

`isExported = false` is a narrower fact than "no other file can name it"
in most languages: Java package-private, C# and Kotlin `internal`, Go
lowercase, Python and Dart `_name`, a Rust item seen from a child module,
a C/C++ `static` in a header. Skipping the #480 file seed on every
`false` turned the over-approximation into a false negative for them.

The meaning of a stored verdict is a property of the language, so it
lives on the provider: `LanguageProvider.notExportedIsFilePrivate`, set
on TypeScript, JavaScript, Vue (an ES module is the file), Swift (false
only for `private`/`fileprivate`) and Zig (no `pub`; `export fn` is
recorded true). The seed resolves the provider from the file's path only
for a `false` row and skips the file only when the flag is set.

Two regressions in the same test file: a Java package-private class and
a Kotlin `internal` class, both recorded `false`, keep their importers
as direct dependants.

Refs #3602

* fix(impact): require an ES export in the file before trusting a false verdict

The stored verdict is the provider's export checker, which for an
ECMAScript file answers "under an `export` statement?" whatever the
module kind: a CommonJS class (`module.exports = Foo`) and a top-level
declaration of a global script are both recorded `false`, and both can
be named from other files. Trusting the provider flag alone skipped the
owning-file seed for them.

The index does not record the module kind, but it records the checker's
`true`, which only ES `export` syntax produces. The skip now also
requires a `true` declaration in the same file (Function, Class or
Interface: the tables that carry the column and that a File DEFINES).
A CommonJS file, a script, or a module whose exports all live in
`Const`/`TypeAlias` keeps the seed, as before this fix.

The Java and Kotlin cases now declare a public sibling class, so only
the provider verdict keeps their seed; two new cases cover a CommonJS
module and a global script.

Refs #3602

* fix(impact): preserve uncertain type dependencies

* fix(impact): retain exported type alias dependencies

---------

Co-authored-by: Gergő Magyar <gergomagyar@icloud.com>
Co-authored-by: Gergo Magyar <gergomagyar0@gmail.com>
2026-10-28 08:09:10 +00:00
..
fixtures feat: add the test scenario map and a Vitest 5 mutation runner (#3686) 2026-10-27 16:46:58 +00:00
helpers fix(taint): avoid false positives for guarded Git arguments (#3703) 2026-10-24 15:37:26 +01:00
integration fix(impact): avoid upstream file seeds for private types (#3740) 2026-10-28 08:09:10 +00:00
unit fix(impact): avoid upstream file seeds for private types (#3740) 2026-10-28 08:09:10 +00:00
utils feat(storage): add configurable index storage and content retention tiers (#3060) 2026-09-12 20:31:55 +00:00