|
Some checks are pending
CodeQL / Analyze (javascript-typescript) (push) Waiting to run
CodeQL / Analyze (python) (push) Waiting to run
Gitleaks / gitleaks (push) Waiting to run
Publish / Classify release event (push) Waiting to run
Publish / RC guard (marker + release-PR skip) (push) Blocked by required conditions
Publish / ci (push) Blocked by required conditions
Publish / Publish to npm (push) Blocked by required conditions
Publish / Build & Push RC Docker images (push) Blocked by required conditions
Scorecard / Scorecard analysis (push) Waiting to run
Trivy Image Scan / Trivy (gitnexus-cli) (push) Waiting to run
Trivy Image Scan / Trivy (gitnexus-web) (push) Waiting to run
* test(java): pin on-demand import behaviour to JLS scenarios Fourteen scenarios for `import pkg.*;` taken from JLS SE 21 (7.5.2, 6.4.1, 6.5.5.1, 6.5.4.2, 6.6.1), each asserting the exact CALLS, EXTENDS and IMPORTS edges the resolver emits today. Nine agree with the JLS. Five are labelled as known semantic gaps (a name supplied by one on-demand package resolves only for the class link, accessibility is not applied, member types of a class are not imported on demand); they are pinned so a change of import representation cannot move them by accident, not endorsed. Baseline for the import-group memory work, which must leave every row unchanged. Refs #3695 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * refactor(scope-resolution): put import visibility behind one interface `ScopeResolutionIndexes.imports` was a public map of edge arrays, so every reader depended on one stored edge per imported file. It is now an `ImportVisibility`: the only way to ask what a scope imports, with one operation per question a reader has. - `edgesAt`: the imports a reader can select by name, definition or kind - `reaches` / `reachesDirectory`: does this scope import that file or any file of that directory - `membership`: the same question asked repeatedly at one scope - `forEachTarget`: every imported file in statement order, with the edge that describes how it is imported - `scopes`: every scope finalize recorded `createEagerImportVisibility` implements it over the edge map finalize already produces; storage is unchanged. All 26 readers of the map are migrated to the operation they need. The two file-grounding checks ask `reaches`; inheritance disambiguation asks `reaches` and `reachesDirectory`; File->File IMPORTS emission and the Java on-demand fallback use `forEachTarget`; unique-name property narrowing asks a cached `membership` per importing scope instead of building a set of imported files for every file up front; readers that select by name or kind, and each language's own provider code, use `edgesAt`. No intended semantic change. Test fixtures that built an index by hand wrap their edge map with the eager implementation; no expected result changes. The import-emission benchmark gains `--map-input` for an emitter that predates the interface. Refs #3695 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * test(scope-resolution): contract suite for ImportVisibility and a graph-identity helper The contract is checked against a description of each import relation (per scope, the statements as written and the files each resolves to), not against any implementation's storage: 11 hand-written relations and 60 from a seeded generator, covering duplicates, overlaps, self-targets, unresolved targets, empty lists and explicit imports interleaved with wildcards. Each case compares scope order, recorded-versus-absent scopes, the imports selectable by name, definition or kind, ordered targets with the metadata a consumer reads, and every membership answer. A second implementation runs the same cases by passing its builder. `graphIdentity` gives a canonical form of a knowledge graph (node ids, labels and properties; relationship ids, types, endpoints and properties) for comparing two runs. It normalizes storage order only. Refs #3695 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * test(scope-resolution): address review notes on the contract tests - The duplicate-target coverage check compared target arrays by identity. It now compares them by content, which is what "the same list written twice" means. - The contract helper's header named a function that does not exist; it now says how to run the cases against an implementation. - The JLS scenario comment said every importer uses `T` three ways; S12 and S14 do not, and the comment says so. Tests and comments only. Refs #3695 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> --------- Co-authored-by: Gergo Magyar <gergomagyar0@gmail.com> Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| baseline.json | ||
| measure.mjs | ||
| probe.mts | ||
| README.md | ||
Import-emission memory benchmark (#3695)
CI uses the checked-in baseline.json and the measurement
runner below (from gitnexus/):
node bench/import-emission/measure.mjs --check --output /tmp/import-emission/measure.json
The runner starts three fresh processes with a 512 MiB old-space limit and checks every sample's workload, edge count, ordered-edge hash and CSV hash. It rejects more than 16 MiB of heap growth from the live-input checkpoint to the first emitted edge. The previous global collector measured about 86.7 MiB at this boundary; the optimized emitter measured about -1 MiB. The allowance absorbs GC/runtime bookkeeping variation without accepting the old collector. Elapsed time, RSS and later heap checkpoints remain diagnostic measurements.
measure.json retains the raw samples and check outcome, including failed
checks. Choose a new output path for each run; existing files are protected.
--emitter /path/to/baseline/imports-to-edges.ts checks another revision with
the same workload and sink. The runner never rewrites baseline.json.
The scope-resolution-benchmark job in .github/workflows/ci-tests.yml runs
this command and retains measure.json in its always-uploaded artifact.
For a single-process probe or custom workload:
node --expose-gc --max-old-space-size=512 --import tsx \
bench/import-emission/probe.mts --files 17095 --imports 32
The probe retains synthetic inputs and uses the real streaming graph sink. It reports heap after GC before emission, at the first and last edge, and after return, plus process peak RSS and hashes of the complete ordered edge records and persisted CSV. The default workload has 547,040 distinct import pairs and 140-character paths. It does not parse Java or perform database COPY.
To compare an older checkout, pass --emitter with the path to its
src/core/ingestion/scope-resolution/graph-bridge/imports-to-edges.ts; that checkout
must have its dependencies available. An emitter older than ImportVisibility
takes the edge map itself: add --map-input when running the probe against
one. Alternate baseline and candidate order
in fresh processes. Compare both hashes, not just edge counts. GC and hashing
are part of the probe, so its elapsed time is not a speed benchmark. The signed
first-emission heap delta includes runtime bookkeeping and may be negative;
use the actual heap checkpoints for revision comparisons.
On Node 22.23.3/Linux, three paired fresh-process runs against the emitter at
3c068dd11d53c1c8f373957d0c144da0acbfbc17 measured these median checkpoints:
| Heap after GC | Baseline | Per-file collector |
|---|---|---|
| First emitted edge | 137.96 MiB | 51.01 MiB |
| Last emitted edge | 345.84 MiB | 258.19 MiB |
All six runs produced CSV SHA-256
4558668a68f94f4069ed0d471c553db82e0c370877bb3e145b3ac1f9e9f7a1bc
and ordered-edge SHA-256
780b5304a9656029612806468d0fb1f38acbb7f7da5f62fc8e8887a4c8823865.
In a separate pair with --max-old-space-size=288, the baseline exhausted the
V8 heap and the per-file collector completed with the same hashes. Disable
core dumps before intentionally running the baseline under this limit.
The sink still retains graph data; these measurements do not establish that
the reporter's whole-repository OOM is fixed.
With GITNEXUS_DEBUG_HEAP=1, import emission now records
sr-emit-imports-start, plan-progress/plan-end, collect-progress,
emit-progress, and complete under the same sr-emit-imports- prefix.
Planning reports every 1,024 scopes; collection and emission report every
65,536 imports or pairs. plan-end identifies per-file or global mode.
The global compatibility path also records sr-emit-imports-collected before
emission. GITNEXUS_HEAP_PROBE_FILE retains these checkpoints synchronously.
The existing caller's sr-emit-imports-end marker remains unchanged.