GitNexus/MIGRATION.md
glier 3da42dce99
Some checks are pending
Gitleaks / gitleaks (push) Waiting to run
CodeQL / Analyze (javascript-typescript) (push) Waiting to run
CodeQL / Analyze (python) (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
fix(analyze): enforce parser-worker heap caps and stop charging workers the main heap (#4045)
* fix(analyze): enforce parse-worker heap caps under an inherited heap flag

V8 reads --max-old-space-size and --max-semi-space-size when it creates
an isolate, and the process-wide values override a Worker's
resourceLimits. Under the analyze respawn's flags every parser worker
therefore ran with the main heap limit instead of its own cap, and with
a 384 MiB young generation.

The default parser-worker factory now spawns through a process-wide
lease that clears both flags while workers start and restores them when
the last starting worker reports online, posts its first message, or
exits. A synchronous restore right after new Worker() races the isolate
creation on the worker thread, so the lease waits for those events.
Initial spawns, startup retries and replacements all use this factory.

The plan cleared only the old-space flag; measuring showed the
semi-space flag also overrides the worker's young generation (a 512 MiB
worker reported 896 MiB instead of 560 MiB), so the lease clears both.

Admission is unchanged here and still reserves at least the main heap
per worker, which over-reserves safely; the next commit charges each
worker its own cap.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(analyze): charge each parse worker its own heap cap in resource admission

Admission assumed every parser worker inherits the main heap limit, so it
charged each worker max(mainHeap, workerHeap) + 128 MiB, divided the main
heap by (requiredWorkers + 1), and also capped it at 35% of the total. In
a 10 GiB / 4-CPU container that admitted a 2639 MiB main heap, and on a
4-CPU host it admitted one parse worker at every size from 4 to 32 GiB.

The parser pool now enforces each worker's cap (previous commit), so a
worker is charged its own heap plus the 128 MiB native allowance. The
main heap holds the analysis peak and is sized first: it takes what the
pools, headroom and required workers leave, capped at 16384 MiB and at
an unpinned runtime limit. Automatic workers fill the remainder up to
the CPU count. The rejection minimum uses the same inequality.

4 CPUs, 200 MiB supervisor, no model (main / workers / worker heap):
  4 GiB:   957 / 1 /  958  ->  1403 / 1 /  512
  10 GiB: 2639 / 1 / 2639  ->  4206 / 1 / 1072
  16 GiB: 4300 / 1 / 4300  ->  6850 / 3 /  512

A sweep over RAM, CPUs, explicit totals, heaps, workers, models and
supervisor sizes finds no newly rejected request, no smaller main heap
and no reservation above the total. isConstrainedPdgBuild is unchanged;
the measured 6 GiB / one-worker PDG envelope stays constrained.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(analyze): key the constrained PDG write guard on requested workers

isConstrainedPdgBuild serializes LadybugDB COPY/FTS and limits malloc
arenas for the measured 6 GiB, single-worker PDG configuration. It read
the admitted parser worker count. Since admission now charges workers
their own cap, an explicit small budget such as
--pdg --resource-budget 6144 --memory-budget 2048 on 4 CPUs fits three
workers and silently dropped the guard, although the graph write it
protects runs after the parser workers exit and its memory is the same.

The budget now carries the worker count the operator requested (the
explicit --workers value, or 1 when automatic) and the guard reads it.

Predicate sweep over 544,320 requests (158,826 admitted by every
version), pdg on, against upstream/main: 0 configurations lose the
guard; 1,920 gain it (explicit budgets where upstream/main fitted more
than one automatic worker), which only makes their COPY serial. The 416
configurations the previous commit had turned off are all constrained
again. Explicit --workers N > 1 stays unconstrained.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* docs(analyze): describe enforced parser-worker heap caps

Parser workers used to run with the main heap limit by accident; they now
run at their admitted cap, 512 MiB on common hosts. Say so in MIGRATION.md
and next to --max-file-size in the README: files above roughly 2 MB or
large explicit sub-batches can exceed the cap, the file is quarantined,
and GITNEXUS_WORKER_HEAP_MB raises it.

Also fix two stale sentences: the RUNBOOK still said each worker reserves
at least the --memory-budget allocation, and the README named one heap
flag where the pool clears both --max-old-space-size and
--max-semi-space-size.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* test(analyze): cover a parser worker dying at its enforced heap cap

With caps now enforced, an oversized job ending in
ERR_WORKER_OUT_OF_MEMORY is an expected outcome, and no test drove a
worker past its cap. The new case runs a pool of one 512 MiB worker
under --max-old-space-size=3000 and has it allocate up to 1 GiB on one
file. It asserts that dispatch resolves, the log names the cap and
GITNEXUS_WORKER_HEAP_MB, the file is quarantined and counted in stats,
the slot respawns, and the files around it are still parsed.

On upstream/main the worker inherits the main limit, so the same file
parses, nothing is quarantined and the case fails on the missing hint.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* test(analyze): derive the respawned main heap from the mocked host

Three heap-respawn tests pinned the main heap the old admission rule
gave the mocked 16 GiB host (4300 MiB, respawned as
--max-old-space-size=3916). Admission now sizes the main heap first:
75% of RAM (12288 MiB) minus headroom, supervisor, graph pool, vector
pool and embedding queues, which gives 6858 MiB and an old space of
6858 - 3 x 128 = 6474 MiB.

The tests now compute that value from the same host constants instead
of a literal, and pin the supervisor's RSS below its 192 MiB floor: the
main heap now depends on the measured supervisor reservation, which
otherwise varies with the test process.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* perf(analyze): start community workers through the heap lease

Node shares one built-in code cache between a process's isolates and
accepts an entry only under the V8 flag hash it was compiled with. The
parser-worker heap lease clears the inherited heap flags while a worker
starts, so that worker recompiles the built-ins its startup needs and
stores them under the cleared hash. The Leiden worker, created after
the flags were restored, then rejected those entries and recompiled
again: about 14 ms on the analyze-resume incremental scenario, where
the CI benchmark measured a ~0.7% slowdown.

The graphology and icebug workers now start through the same lease, so
their startup reuses the parser worker's entries and their later loads
the main isolate's. They pass inheritedWorkerResourceLimits(), the old
space and three semi-spaces the inherited flags give, so their heap is
unchanged.

CPU profiles of three incremental pairs (16 GiB / 4 CPUs simulated),
built-in compile time added per worker vs the base revision: Leiden
+13.8 ms before, +0.1 ms after; the parser worker's startup recompile
(+11 ms) remains. Clearing the flags once without restoring was also
measured and moved the cost into the parser worker instead (+24.7 ms).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* Keep allocator defaults for multi-worker PDG parsing (#4045)

Apply the two-arena default only for a single admitted parser worker. Keep each worker's young generation inside its reservation, reuse its startup options, and share quoted numeric heap-flag parsing with CLI admission.

Cover allocator selection, real worker caps and reentrant startup events. Document community and loader heaps outside admission.

Validation: six incremental-index tests failed during a full run stopped early. All six passed in isolated reruns on the original and updated revisions.

* perf(analyze): lease community workers only after a parser worker did

Starting a worker under the cleared heap flags pays a one-time
recompile of the built-ins its startup needs, because Node's shared
built-in code cache is keyed by the V8 flag hash. Routing the community
workers through the lease saves that cost only when a parser worker has
already started under the cleared flags. With a warm parse cache, as in
`analyze --force` on an unchanged repository, no parser worker starts,
so the leased Leiden worker became the first to recompile: 6-file
repository, 20 runs each, Leiden spawn to result median 47.5 ms on the
base revision, 71.0 ms with the lease, 49.0 ms with this change.

spawnWithInheritedHeap() now takes the lease, with
inheritedWorkerResourceLimits(), only after a parser worker has used
the cleared flags in this process, and otherwise spawns plainly under
the inherited flags as before. The parser-worker path is unchanged.

Also restore the caveat that a Worker created in the analysis process
without these helpers while a lease is open gets V8's default heap.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(analyze): keep two allocator arenas when several PDG parser workers fit

The constrained PDG guard starts the first analyze child, which runs the
parser pool and then the graph writer, with MALLOC_ARENA_MAX=2 on Linux
with glibc. a7691f8cd limited that to one admitted parser worker. Two
measurements disagree only on what they measured: four workers on 210
TypeScript files parsed in 14.36-17.90 s with allocator defaults and
19.44-20.15 s with two arenas (parse time only); three workers on a Kotlin
repository of 2,448 files in an 8 GiB, 4-CPU container parsed in 30-34 s at
a ~3,050 MiB cgroup peak with two arenas, and in ~27 s at ~3,530 MiB with
defaults. The guard exists for the memory, so two arenas apply again
whenever it does. An operator's MALLOC_ARENA_MAX or glibc.malloc.arena_max
still wins.

The respawn test now runs the Linux branch on every host and covers an
automatic multi-worker admission, --workers 1, and an operator override.
The benchmark note carries both measurement sets.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(analyze): read every heap-flag spelling V8 and Node accept in the shared reader

lib/node-size-flag.ts is the one reader for heap flags in CLI admission and
the worker lease. It only knew `--name`, so `-max-old-space-size=3000` (V8
accepts one leading dash) pinned the heap unseen, and a signed or
space-padded size (`=+3000`, `= 3000`) was skipped although V8 applies it.

The reader now accepts one or two leading dashes, reads sizes like strtoull,
ignores a value V8 rejects as out of bounds (V8 keeps the earlier one), and
reports a value V8 accepts but JavaScript cannot hold exactly as NaN. New
helpers read an option's raw value (for the percentage flag) and a V8
boolean flag with both `--no-` and `--no` negation (for frozen flags), all
by argument so an `--eval` source or a `--title` value is never a flag, plus
process-level variants in which a command-line value wins over NODE_OPTIONS
even when it is zero.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(analyze): derive inherited worker heaps from the live main heap, by argument

The lease read heap flags from `process.execArgv.join(' ')` and treated a
command-line zero as absent, and it restored the main isolate's whole limit
as old space under the percentage flag. On Node 22 that let an `--eval`
source naming the percentage flag grow a later worker from 1,072 to
1,120 MiB, a valid title `--title 'worker --max-old-space-size=2000'` shrink
it from 4,144 to 2,048 MiB, command-line zeros over NODE_OPTIONS 2000/64
leave it at 2,192 instead of 4,144 MiB, and a 12.5% pin with a 64 MiB
semi-space change an ordinary worker's heap between before and after
parsing. `--max-heap-size` was never cleared, so a capped worker kept it, and
under `--freeze-flags-after-init` the first flag write aborted V8.

`inheritedHeap()` now reads the flags argument by argument through the
shared reader (command line over NODE_OPTIONS, zero included) and checks them
against the main isolate's live `heap_size_limit`, which is old space plus a
three-semi-space young generation. When they agree, the lease clears and
restores old space, semi-space and `--max-heap-size` as read, and
community-style workers get the main isolate's old space and young
generation from the live limit. When they disagree, or a heap flag is set
under frozen flags, the lease is skipped before any flag write and admission
charges every parser worker the main heap (`workerHeapCapEnforced: false`).
The percentage's old space follows Node's own formula, checked by the live
limit. The released-once guard for reentrant startup events is kept.

Subprocess tests in test/integration/worker-heap-flags.test.ts reproduce
each case with real flags from execArgv and NODE_OPTIONS, including that a
fresh ordinary worker gets the same heap before and after parsing.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* test(analyze): pin the host-resources wiring of worker-cap enforceability

Replacing `workerHeapCapEnforceable()` with `true` in
`resolveHostAnalysisResources` left every unit test green; only a
subprocess test against a built dist caught it. A unit test now drives the
predicate both ways and checks that an unenforced cap charges each worker
the main heap, and that an explicit `workerHeapCapEnforced` still wins.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(analyze): let a command-line zero hide a NODE_OPTIONS heap pin in the CLI

Node applies the command line after NODE_OPTIONS, so
`node --max-old-space-size=0` runs at V8's default even when NODE_OPTIONS
pins a size. Manual admission and the budget decision already read the
process value with the command line first; the manual-heap check and
ensureHeap's ambient pin did not: under `--max-old-space-size=0` with a
large NODE_OPTIONS pin, analyze took the heap as pinned by the operator and
skipped its own sizing, or warned about a pin that was not in effect.

Both now take a NODE_OPTIONS pin only when the command line sets no
`--max-old-space-size` of its own.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* docs(analyze): name the heap-flag changes the worker-cap lease cannot see

A preload can change heap flags after startup without leaving anything the
live-limit check contradicts (`v8.setFlagsFromString`, or deleting
NODE_OPTIONS), and a module-hooks thread that a preload's `module.register()`
starts in a leased worker gets V8's default heap: Node takes no
`resourceLimits` for it. Neither is fixable from the lease; the module doc
and the README worker-cap paragraph now say so in one sentence each.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* test(analyze): restore process.platform without a non-null assertion

The arena test added a no-non-null-assertion lint warning when it saved the
platform descriptor; fall back to an empty descriptor instead.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* test(analyze): verify worker heap defaults across host sizes (#4045)

Compare ignored and reset heap flags against a clean Node subprocess. Pin the page-size input in the respawn fixture and exercise a real process title whose value starts with a dash.

* test: clarify heap reset and worker recovery coverage

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: Gergő Magyar <gergomagyar@icloud.com>
Co-authored-by: Gergo Magyar <gergomagyar0@gmail.com>
2026-11-24 20:25:03 +00:00

22 KiB

Migration Guide

Upstream impact risk (#3972)

Upstream impact now rates the number of direct dependants. On a complete, nonempty walk, 5 direct dependants trigger MEDIUM, 15 trigger HIGH and 200 trigger CRITICAL. Process membership, module membership and indirect reach remain available in the summary. An edit gate based on HIGH or CRITICAL can therefore fire less often for a symbol with few direct callers on many flows. Downstream thresholds are unchanged.

Impact omits calls inferred solely from a unique name. When a walk encounters these calls, the MCP reports omittedNameOnlyCalls, marks the counts as a lower bound, and returns UNKNOWN for a provisional LOW or MEDIUM rating. The web impact report also shows the omitted count. Raw graph queries can inspect these edges using reason = 'global-name-fallback'.

An explicit gitnexus analyze refreshes counts in the managed instruction block, including when the index is current. A tracked instruction file can therefore change on a count-only update. Use --instruction-file AGENTS.md or --instruction-file CLAUDE.md to update one file, or --index-only to skip instruction files.

Stable community and process IDs (#3855)

The next analysis after upgrading rebuilds the derived graph with new IDs:

  • Communities use comm_<hash>, where hash is the first 12 hexadecimal SHA-1 characters of the smallest member ID.
  • Processes use proc_<hash>_<name>, where hash covers the entry ID, a NUL separator, and the terminal ID; name is the sanitized entry name. The hash is also 12 hexadecimal characters. Colliding IDs receive _2, _3, etc.

Saved positional IDs (comm_<n> or proc_<n>_<entry>) no longer resolve after that rebuild. Re-resolve communities and processes by label and refresh stored IDs. If a Cluster_<id> fallback label also changed, locate the community from its member symbols. Generated skills with those fallback names also change directory names once; skill generation removes stale directories.

IDs remain stable while the community's smallest member or the process's endpoints remain unchanged, except for collision suffix allocation. A community ID follows its anchor if clustering moves that member; it does not identify an unchanging member set. Adding an unrelated component can still cause Leiden to repartition existing communities.

Listings still break equal step-count or symbol-count ties by ID. Those ties now follow hash order, so a limited listing can show different entries after the upgrade. The complete graph retains the other entries.

Per-file parser cache (#3856)

Parser facts and scopes now use per-file records in compressed packs. The format change invalidates old chunk caches, so the first analysis after upgrading parses the source again. Later runs reuse compatible files independently of chunk layout. No manual cache deletion is needed. Files with incomplete or zero-output parser results still require worker dispatch on later runs.

Resumable analysis and separate vector storage (#3598)

Analysis with embeddings publishes a private lbug.generation.<id> graph and stores resumable vector artifacts under embeddings/<identity>/. Metadata names the active graph and sealed vector generation. Once a slot uses this layout, plain analysis, watch and hooks continue using it. Pending embedding work resumes on the next plain gitnexus analyze; --force rebuilds the graph while retaining compatible vectors for reuse. --drop-embeddings explicitly abandons embeddings.

Upgrade every CLI, MCP/serve process and installed hook that accesses the slot. Restart long-running clients and rerun gitnexus setup with the upgraded binary. Older versions do not understand the private graph pointer or separate vectors. Do not run an older analyzer against the migrated slot.

Before upgrading, stop readers and writers and back up the complete storage slot, including metadata, graph files, embeddings/, and any referenced shared store. To roll back, stop clients again and restore that complete backup with the matching older binaries. Renaming a generation file to lbug does not move vectors back into it. There is no reverse conversion for separate vector artifacts; without a backup, rebuilding with an older version requires generating embeddings again and can incur provider charges.

A graph can be ready while embeddings remain pending. Embedding failure after graph publication exits nonzero; the graph remains usable and the next analyze resumes paid work. HTTP clients should read embeddingProgress and capability reasons rather than relying on the former terminal SSE partial field. After three deterministic input rejections, the job publishes healthy nodes and records excludedNodes with reason input-rejected; status reports the omission. On Windows, a legacy reader can prevent retirement of lbug. Stop that reader and rerun analyze; the prepared publication and vector artifacts are retained.

Legacy source receipts now include the file's change time as well as its size and modification time. Receipts from earlier previews without that guard are retained but cannot certify reuse. Keep them with the original source when recovering from a backup or re-exporting a verified source; do not fill in a missing guard from the current file, which may have changed since retirement.

GITNEXUS_LBUG_BUFFER_POOL_SIZE=0 is no longer accepted by analysis: it asks the native engine to allocate an unbounded pool. Remove this setting from CLI, server and auto-sync environments to use automatic sizing, or set a positive byte limit. An explicit --resource-budget must also fit the page-size-scaled COPY floor; increase the budget if admission rejects it.

Automatic analysis now admits all phase reservations within 75% of effective process/container RAM. Earlier versions could expand the reported total above RAM to preserve independently chosen heap and worker limits. Explicit heap, worker and pool overrides that do not fit now fail before work starts. Reduce those overrides, reduce concurrent analyses, use an HTTP embedding provider, or increase available RAM. --memory-budget remains a main-heap limit; --resource-budget sets the ceiling for parser and embedding reservations and cannot exceed RAM. Community-detection workers have separate heaps. Parser workers keep their own heap caps under the numeric old-space and semi-space flags set by the CLI. Admission reserves each worker's old-space cap plus 128 MiB for its young generation and native allocations. The main heap is sized first; automatic worker count fills what remains and may rise compared with earlier versions. Explicit worker counts must fit beside the main heap. Earlier versions ran parser workers with the main heap limit by accident; they now run at their admitted cap. Automatic sizing divides the remaining parser budget among workers, with a 512 MiB minimum old-space cap. A file larger than roughly 2 MB or a large explicit sub-batch can exceed the cap and trigger quarantine. Raise GITNEXUS_WORKER_HEAP_MB when raising --max-file-size.

If a superseded or unverifiable analysis-publication.json blocks recovery, stop every reader and writer and back up the complete storage slot first. Move only that receipt into the backup, outside the slot, then run gitnexus analyze --force. Keep the staged graphs and embedding artifacts until the replacement graph and vectors are verified. A valid receipt should normally be recovered by plain analysis; discarding it abandons its prepared graph work. For an interrupted in-place write, keep clients stopped until the forced rebuild completes; removing the receipt does not make the old graph healthy.

LadybugDB 0.22.0 storage and extensions

LadybugDB 0.22.0 reads indexes written by 0.21.1, but a write/checkpoint upgrades their storage format from version 47 to 49. No manual data conversion is needed. Use the packaged FTS and VECTOR binaries shipped with the new core; older extension binaries can load successfully and then crash when building an index.

Before upgrading, stop index writers and readers and retain a backup of the complete index storage directory if rollback is required. Include shared stores when worktrees or sibling clones share an index. Keep clients sharing a writable index on compatible engine versions.

After an index is written by 0.22.0, downgrading the dependency alone is not enough: 0.21.1 refuses storage version 49. Restore the backup, or rebuild with the older engine using gitnexus analyze --force. A rebuild under an engine that cannot read the upgraded index cannot recover its cached embeddings; use the backup to preserve them, or regenerate them with --embeddings.

Automatic parser cache identities

Parser caches now use artifact-derived base and PDG identities instead of manually assigned semantic version numbers. The worker-result cache and durable ParsedFile store both validate the base identity, and their physical chunk keys include it. PDG-enabled chunks also include the PDG identity and resolved function-line cap. CFG-only changes therefore leave ordinary parse chunks eligible for reuse.

Do I need to migrate?

No. Run npx gitnexus analyze as usual. Legacy numeric caches and indexes without the parser receipt miss once; successful analysis writes the new identities. Plan for a cold parse on the first run after upgrading. Missing, malformed, or foreign identities are also misses, including in shared stores. Plain analysis continues to preserve existing embeddings.

--force rebuilds the graph and may reuse compatible parser output. --no-parse-cache forces a cold parse and publishes a fresh cache generation after successful analysis. If parser identity cannot be verified, analysis uses a bounded transient store without persistent cache reads or writes. Failed staging or build verification leaves the previously published cache pair intact. Cache-write failures after graph publication are reported as warnings and do not roll back the successful graph.

What changes for contributors?

There is no semantic counter or generated digest file to update. Check input coverage and cold/warm behavior instead; see Contributing. When running from source, edits invalidate identity immediately but do not rebuild compiled workers: run npm run build in gitnexus/ before expecting new parser facts. Graph DDL fingerprints, analyzer freshness receipts, and intentional wire-format versions remain separate safeguards.

impact tool may now return { status: 'ambiguous' } (PR #888, issue #470)

Before this change the impact MCP tool silently picked the first match when the target name hit multiple symbols (Class → Interface → Function → Method → Constructor priority UNION). This often produced analysis for the wrong symbol with no signal back to the caller.

After this change, when the resolver finds more than one viable match and the caller supplied none of target_uid / file_path / kind, impact returns a disambiguation response shaped like:

{
  "status": "ambiguous",
  "message": "Found N symbols matching '<target>'. Use target_uid, file_path, or kind to disambiguate.",
  "target": { "name": "<target>" },
  "direction": "upstream",
  "impactedCount": null,
  "risk": "UNKNOWN",
  "candidates": [
    { "uid": "...", "name": "...", "kind": "Function", "filePath": "...", "line": 42, "score": 0.76 }
  ]
}

impactedCount is null, not 0, on an ambiguous result (#2687): no single symbol was resolved, so the blast radius is undetermined. A numeric 0 was indistinguishable from a genuine "nothing depends on this", so a caller testing impactedCount === 0 read a false all-clear. Read maxImpactedCount (callgraph ambiguity) or the per-candidate counts in candidates[] for the real figure. Callers written as impactedCount || 0 are unaffected.

Do I need to migrate?

Probably not, but check for assumptions. Callers that unconditionally read result.byDepth / result.summary / result.affected_processes without first checking result.status will now see undefined in the ambiguous case. The fix is to branch on result.status === 'ambiguous' first and follow up with target_uid (preferred) or file_path / kind.

The context tool's ambiguous response is a strict superset of the existing shape — every candidate gains a score field, no existing field has changed. No migration required for context callers.

What happens on re-index?

Nothing — this is an MCP-surface change only. The graph schema, indexer, and stored data are untouched.


OVERRIDES → METHOD_OVERRIDES (PR #642)

The OVERRIDES relationship type has been renamed to METHOD_OVERRIDES for consistency with the new METHOD_IMPLEMENTS edge type.

Do I need to migrate?

No. Backward compatibility is handled automatically at runtime:

  • local-backend.ts dual-reads both OVERRIDES and METHOD_OVERRIDES in all impact-analysis and context queries. Existing stored graphs with OVERRIDES edges continue to return correct results without any manual intervention.
  • The REL_TYPES array in schema-constants.ts includes both names so Cypher queries that reference either will work.

What happens on re-index?

Running npx gitnexus analyze on a repository produces METHOD_OVERRIDES edges going forward. The old OVERRIDES edges are replaced as part of the normal full re-index.

When will the legacy alias be removed?

The OVERRIDES compat alias will remain until a future major version. Removal will be announced in this file and in the changelog before it happens.

meta.json → gitnexus.json (PR #2363)

The per-repo index metadata file's primary name changed from .gitnexus/meta.json to .gitnexus/gitnexus.json (and from branches/<slug>/meta.json to branches/<slug>/gitnexus.json for multi-branch indexes). This is purely a filename change — the JSON content and every field in it are identical.

Do I need to migrate?

No. Backward compatibility is handled automatically at runtime:

  • saveMeta dual-writes both filenames on every analyze, so meta.json keeps existing and staying current. Older GitNexus binaries, still-running MCP servers, and the shipped editor hooks that read meta.json continue to work unchanged.
  • loadMeta reads gitnexus.json first and falls back to meta.json when the primary file is absent, so a repo indexed by an older version works without re-analysis.
  • Each analyze run also reconciles the two files (the fresher indexedAt wins and is written to both), so even a repo written by a mix of old and new versions converges. Nothing is ever deleted.

What happens on re-index?

Running npx gitnexus analyze writes both gitnexus.json and meta.json with identical content. A pre-existing repo that only has meta.json gets gitnexus.json bootstrapped from it on the first run.

Process ids are not stable across this release

Before #3855, Process ids were positional (proc_<idx>_<entry>). The earlier flow-detection release described here changed both which execution flows are detected and the order they are selected in: tracing is depth-first, sibling branches follow source order, and selection round-robins across terminals so one flow cannot take every slot. A given proc_7_handle before the upgrade is not the same flow afterwards.

Nothing in GitNexus persists or joins on a raw process id across a re-index — the MCP resource keys by label — so this is one-time index churn rather than a broken consumer. If you have external tooling that stored a process id, re- resolve it by label after the next analyze.

What about rollback?

Downgrading to an older GitNexus version is safe: meta.json is always present and current, so the older binary sees the existing index (including the incrementalInProgress crash-recovery flag) instead of treating the repo as never analyzed.

When will the legacy mirror be removed?

The meta.json mirror will remain until a future major version. Removal will be announced in this file and in the changelog before it happens.

Ambiguous responses report the true match count (PR #2796, issue #2787)

The MCP symbol resolver returns at most 20 candidate rows. Every ambiguous response used to take its count from that capped window, so a name with 92 matches (constructor, in this repo's own index) reported 20. The same PR pinned the window with an ORDER BY, which turned that undercount from flaky into stable — and a stable wrong number reads as authoritative.

Three consumer-visible changes follow:

  • impact's totalCandidates changed meaning. It was the length of the capped 20-row window; it is now the true COUNT(*) of matching symbols. Callers using totalCandidates === candidates.length as a "not truncated" proxy will now see the two diverge. This is a bug fix — the old number was wrong — but it is still a value change on a published field.
  • totalCandidates and candidatesTruncated are new on other tools. They now also appear on context, trace, the explain / pdg_query block-anchor path, and on rename (which returns context's ambiguous payload verbatim). candidatesTruncated: true is present only when candidates[] is shorter than totalCandidates — absent otherwise, never false.
  • The message template gained a (showing M) suffix. It follows the total — Found 92 symbols matching 'constructor' (showing 20). … — and appears only when the returned window is smaller than the total. impact uses the longer (showing M of N) form.

Do I need to migrate?

Only if you read totalCandidates or parse message. The last two changes are purely additive — no field was removed or renamed and candidates[] keeps its shape — so PR #888's "no existing field has changed. No migration required for context callers" still holds for context.

  • Reading totalCandidates on impact: it is a true total now. Detect a shortened window with candidatesTruncated (or totalCandidates > candidates.length) rather than by comparing it to an array length.
  • Parsing message for a count: the total is still the first number, but a (showing M) parenthetical may now follow it. Prefer the structured totalCandidates field over the string.

What happens on re-index?

Nothing — this is an MCP-surface change only. The graph schema, indexer, and stored data are untouched.

schemaVersion → schemaFingerprint (issue #2798)

The field that decides whether an existing index can be reused changed in .gitnexus/gitnexus.json (and in each branches/<slug>/gitnexus.json): schemaVersion?: number has been removed and schemaFingerprint?: string added. The new value is a 12-character digest of the graph DDL this build creates, so it describes the schema an index's tables were actually built from rather than asserting a number about it.

An absent fingerprint is treated as a mismatch, and that is the whole backward-compatibility story: every index written by an earlier GitNexus carries no fingerprint, so it is rebuilt exactly once.

Do I need to migrate?

No. There is nothing to run, edit, or pass. The first analyze after upgrading logs one line —

index schema changed (built by an unidentified GitNexus build, this build is <fingerprint>); forcing a full re-analyze so the database is recreated from the current schema.

— and then performs that full re-analyze itself. The same run stamps the fingerprint, and every run after it takes the normal incremental path again.

What happens on re-index?

One automatic full re-analyze, once per index. Nothing else changes; the resulting graph is what the current build would have produced anyway.

The scope of that one-time cost is worth knowing before you hit it. It is per index, not per machine or per repository — branch-scoped index slots (#2106) each keep their own gitnexus.json, so every slot pays for itself the first time it is analyzed after the upgrade. On a very large repository a full re-analyze is substantial, not a blip; plan the first post-upgrade run accordingly.

Why a digest instead of a version number?

schemaVersion was hand-incremented, and it had to predict something a number cannot know: whether the DDL an on-disk database was created from matches this build's. It collided with main eight times, twice exactly — and an exact clash was the quiet failure. Two builds stamp the same number over different DDL, the strict === reuse gate reads the index as current, the CREATE … TABLE statements are skipped as "already exists", and edges whose endpoint pair the live database cannot persist are dropped. A wrong graph, with no error anywhere.

A derived digest cannot fail that way: two builds agree exactly when their DDL agrees, so concurrent branches never need renumbering and a mismatch is always a real mismatch. The retired ladder's per-version rationale (v2 BasicBlock.callees through v35's generated relation cross-product) now lives only in git history: git show 561f913a3:gitnexus/src/storage/repo-manager.ts.

What about rollback?

Downgrading to an older GitNexus is safe. The older binary looks for schemaVersion, does not find one, treats the index as pre-versioning, and forces its own full rebuild — the same one-time cost in the other direction, never a stale or mismatched graph.

What if I alternate between an old and a new binary?

Every switch forces a rebuild. The end-of-run metadata is written as a fresh object literal rather than merged over the previous file, so a new build's write drops schemaVersion and an old build's write drops schemaFingerprint — neither field survives the other's run, and each binary then finds its own gate unsatisfied. This hits anyone running a pinned npx gitnexus@<version> alongside a local build, or an editor hook still on an older release. It is a cost, not a correctness problem: each run rebuilds against its own schema, and the graph it serves is correct for the binary that produced it. Pin one version per index to avoid the churn.