gitnexus 1.6.11-rc.46 → 1.6.11-rc.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_shared/graph/types.d.ts +28 -0
- package/dist/_shared/graph/types.d.ts.map +1 -1
- package/dist/_shared/scope-resolution/reference-site.d.ts +10 -0
- package/dist/_shared/scope-resolution/reference-site.d.ts.map +1 -1
- package/dist/_shared/scope-resolution/types.d.ts +5 -0
- package/dist/_shared/scope-resolution/types.d.ts.map +1 -1
- package/dist/core/ingestion/call-extractors/zig-static-gating.d.ts +100 -0
- package/dist/core/ingestion/call-extractors/zig-static-gating.js +319 -0
- package/dist/core/ingestion/languages/zig/captures.js +40 -1
- package/dist/core/ingestion/resolve-references.js +1 -0
- package/dist/core/ingestion/scope-extractor.js +7 -0
- package/dist/core/ingestion/scope-resolution/graph-bridge/edges.d.ts +4 -0
- package/dist/core/ingestion/scope-resolution/graph-bridge/edges.js +2 -0
- package/dist/core/ingestion/scope-resolution/graph-bridge/references-to-edges.js +1 -0
- package/dist/core/ingestion/scope-resolution/passes/free-call-fallback.js +27 -10
- package/dist/core/lbug/csv-generator.d.ts +1 -1
- package/dist/core/lbug/csv-generator.js +5 -1
- package/dist/core/lbug/lbug-adapter.js +7 -3
- package/dist/core/lbug/schema.js +2 -1
- package/dist/mcp/local/local-backend.js +8 -2
- package/dist/mcp/tools.js +1 -1
- package/dist/storage/parse-cache.js +4 -1
- package/package.json +1 -1
|
@@ -225,5 +225,33 @@ export interface GraphRelationship {
|
|
|
225
225
|
readonly weight: number;
|
|
226
226
|
readonly note?: string;
|
|
227
227
|
}[];
|
|
228
|
+
/**
|
|
229
|
+
* When `true`, the call site this edge was resolved from sits in a
|
|
230
|
+
* branch that is provably unreachable from the indexed source at
|
|
231
|
+
* compile time — e.g. a Zig `if (CONST_FALSE)` body, or the `else` of
|
|
232
|
+
* `if (CONST_TRUE)`, where the condition folds to a comptime-known
|
|
233
|
+
* boolean.
|
|
234
|
+
*
|
|
235
|
+
* This does NOT change what a `CALLS` edge means. `CALLS` still means
|
|
236
|
+
* "there is a resolved call site from A to B"; it has never meant "B is
|
|
237
|
+
* reachable from A", and this flag does not make it mean that.
|
|
238
|
+
* `staticGated` is additional, statically provable path-feasibility
|
|
239
|
+
* metadata on the edge: an opt-in
|
|
240
|
+
* analysis layer that a consumer may read (for example to rank or
|
|
241
|
+
* filter callers in an impact view) and that no core pass acts on.
|
|
242
|
+
* The edge is emitted, persisted, traversed and counted exactly as it
|
|
243
|
+
* was before the flag existed.
|
|
244
|
+
*
|
|
245
|
+
* Scope: only conditions that fold from constants in the source.
|
|
246
|
+
* Anything the index cannot know (build mode, target, environment) is
|
|
247
|
+
* never marked; the index has no production build configuration and
|
|
248
|
+
* does not claim to.
|
|
249
|
+
*
|
|
250
|
+
* Optional and additive: edges from languages that don't compute
|
|
251
|
+
* static gating leave this `undefined`, which readers treat
|
|
252
|
+
* identically to `false` (live). Currently set only by the Zig
|
|
253
|
+
* scope-capture emitter.
|
|
254
|
+
*/
|
|
255
|
+
staticGated?: boolean;
|
|
228
256
|
}
|
|
229
257
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/graph/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD,MAAM,MAAM,SAAS,GACjB,SAAS,GACT,SAAS,GACT,QAAQ,GACR,QAAQ,GACR,MAAM,GACN,OAAO,GACP,UAAU,GACV,QAAQ,GACR,UAAU,GACV,WAAW,GACX,MAAM,GACN,WAAW,GACX,QAAQ,GACR,MAAM,GACN,aAAa,GACb,WAAW,GACX,SAAS,GAET,QAAQ,GACR,OAAO,GACP,SAAS,GACT,OAAO,GACP,WAAW,GACX,OAAO,GACP,MAAM,GACN,WAAW,GACX,OAAO,GACP,QAAQ,GACR,UAAU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AU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,EAAE,SAAS;QAClB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;QACxB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;KACxB,EAAE,CAAC;IACJ;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB"}
|
|
@@ -184,6 +184,16 @@ export interface ReferenceSite {
|
|
|
184
184
|
* else, so every other language's sites stay byte-identical.
|
|
185
185
|
*/
|
|
186
186
|
readonly embeddedAsPointer?: boolean;
|
|
187
|
+
/**
|
|
188
|
+
* The call sits inside a branch that is provably unreachable from the
|
|
189
|
+
* indexed source at compile time — a Zig `if (CONST_FALSE)` body, or the
|
|
190
|
+
* `else` of `if (CONST_TRUE)`,
|
|
191
|
+
* where the condition folds to a comptime-known boolean. Set only when
|
|
192
|
+
* `kind === 'call'` and only by languages that compute static gating (Zig
|
|
193
|
+
* today); absent everywhere else, so every other site stays byte-identical.
|
|
194
|
+
* Threaded to `Reference.staticGated` and then `GraphRelationship.staticGated`.
|
|
195
|
+
*/
|
|
196
|
+
readonly staticGated?: boolean;
|
|
187
197
|
}
|
|
188
198
|
/**
|
|
189
199
|
* One step in a mixed receiver chain — the decoded form of a receiver that is
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reference-site.d.ts","sourceRoot":"","sources":["../../src/scope-resolution/reference-site.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAEjD;;;;;;GAMG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EAA8E;IAC9E,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB;;;;;;OAMG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B;;;;;;OAMG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3C;;;;;OAKG;IACH,QAAQ,CAAC,mBAAmB,CAAC,EAAE,SAAS,kBAAkB,EAAE,CAAC;IAC7D;;;;;;;;;;;;;OAaG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IACpC;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IACrC;;;;;;;;OAQG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;CAChC;AAED;;;;;;;;;;;;GAYG;AACH;;;;;;;;;GASG;AACH,MAAM,MAAM,cAAc,GACtB;IAAE,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACxC;IAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,SAAS,CAAA;CAAE,CAAC"}
|
|
@@ -675,6 +675,11 @@ export interface Reference {
|
|
|
675
675
|
* without it is emitted exactly as before.
|
|
676
676
|
*/
|
|
677
677
|
readonly callForm?: CallForm;
|
|
678
|
+
/** Copied from `ReferenceSite.staticGated` for `kind === 'call'`: the site is
|
|
679
|
+
* in a branch provably unreachable from the indexed source at compile time.
|
|
680
|
+
* The emit phase writes it to `GraphRelationship.staticGated` as metadata;
|
|
681
|
+
* see the contract note there. Optional and additive. */
|
|
682
|
+
readonly staticGated?: boolean;
|
|
678
683
|
readonly confidence: number;
|
|
679
684
|
readonly evidence: readonly ResolutionE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CAClD;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,aAAa,EAAE,WAAW,CAAC,OAAO,EAAE,SAAS,SAAS,EAAE,CAAC,CAAC;IACnE,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC,KAAK,EAAE,SAAS,SAAS,EAAE,CAAC,CAAC;CAChE;AAID;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAAG,OAAO,CAAC;AAE1C;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,aAAa,EAAE,SAAS,SAAS,EAAE,CAAC;IAC7C,wDAAwD;IACxD,QAAQ,CAAC,sBAAsB,EAAE,OAAO,CAAC;IACzC,QAAQ,CAAC,sBAAsB,EAAE,mBAAmB,GAAG,IAAI,CAAC;IAC5D,gEAAgE;IAChE,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B;;gFAE4E;IAC5E,QAAQ,CAAC,gBAAgB,CAAC,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;CACvD"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zig static-gating resolver.
|
|
3
|
+
*
|
|
4
|
+
* Detects calls inside `if (CONST_FALSE)` blocks (and trivial boolean
|
|
5
|
+
* extensions: `and`, `or`, `==`/`!=`, parentheses, and prefix `!` negation,
|
|
6
|
+
* which tree-sitter-zig parses as `error_union_type`) so the call edge can be
|
|
7
|
+
* tagged with `staticGated: true`. The flag lets impact-analysis
|
|
8
|
+
* consumers filter out paper-tiger callers that live in dead branches
|
|
9
|
+
* gated behind a comptime-known `false` constant.
|
|
10
|
+
*
|
|
11
|
+
* Conservative by design: we only tag an edge when we can prove the
|
|
12
|
+
* gating expression evaluates to `false`. Anything ambiguous → live.
|
|
13
|
+
*
|
|
14
|
+
* Scope of v1:
|
|
15
|
+
*
|
|
16
|
+
* (a) **File-local** consts (`pub const FOO = false;`, plus const-to-const
|
|
17
|
+
* aliases up to 5 hops), built once per file by `buildZigBoolConstMap`.
|
|
18
|
+
* (b) **Cross-file** (`const cfg = @import("./cfg.zig"); if (cfg.FOO)`) is
|
|
19
|
+
* NOT resolved yet. The evaluator keeps the seam for it (`importAliases`
|
|
20
|
+
* + `lookupBoolsForPath`, consumed by the `field_expression` case), but
|
|
21
|
+
* the only caller passes an empty alias map and a lookup that always
|
|
22
|
+
* returns `undefined`, because the capture emitter runs in the parse
|
|
23
|
+
* worker and sees only the current file. Tracked in #3162. Until then
|
|
24
|
+
* every `cfg.FOO` condition folds to unknown, i.e. live.
|
|
25
|
+
*
|
|
26
|
+
* Also out of scope: multi-hop member access (`cfg.sub.FOO`), re-exported
|
|
27
|
+
* consts, runtime-evaluated bools (`const FOO = computeIt();`), and
|
|
28
|
+
* `builtin.mode` gates.
|
|
29
|
+
*
|
|
30
|
+
* Wire-up: `stampZigStaticGating` in ../languages/zig/captures.ts calls
|
|
31
|
+
* `collectZigStaticGatedRanges` once per file and marks every call capture
|
|
32
|
+
* whose position falls inside a dead range with `@reference.static-gated`;
|
|
33
|
+
* the scope-resolution pipeline carries that marker to the CALLS edge.
|
|
34
|
+
*/
|
|
35
|
+
import type { SyntaxNode } from '../utils/ast-helpers.js';
|
|
36
|
+
/**
|
|
37
|
+
* Per-file table of comptime-known booleans:
|
|
38
|
+
* `pub const FOO: bool = false;` → Map { 'FOO' → false }
|
|
39
|
+
* `pub const BAR = true;` → Map { 'BAR' → true }
|
|
40
|
+
*
|
|
41
|
+
* Constants whose RHS is anything other than a bare `boolean` literal
|
|
42
|
+
* (e.g. function calls, struct accesses) are intentionally absent —
|
|
43
|
+
* they resolve to `undefined`.
|
|
44
|
+
*/
|
|
45
|
+
export type ZigBoolConstMap = ReadonlyMap<string, boolean>;
|
|
46
|
+
/**
|
|
47
|
+
* Per-file `@import` alias map, mapping a local identifier to the
|
|
48
|
+
* resolved absolute file path of the imported module. Used for the
|
|
49
|
+
* `cfg.FOO` cross-file lookup pattern.
|
|
50
|
+
*
|
|
51
|
+
* `const cfg = @import("./cfg.zig");` → Map { 'cfg' → 'src/cfg.zig' }
|
|
52
|
+
*/
|
|
53
|
+
export type ZigImportAliasMap = ReadonlyMap<string, string>;
|
|
54
|
+
/**
|
|
55
|
+
* Cross-file lookup: given an alias-resolved file path, return that
|
|
56
|
+
* file's known-bool map. Implemented by the caller — the resolver
|
|
57
|
+
* itself stays stateless.
|
|
58
|
+
*/
|
|
59
|
+
export type ZigBoolConstLookup = (filePath: string) => ZigBoolConstMap | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* Walk the top-level of a Zig source file and collect known-bool
|
|
62
|
+
* constants. Two passes:
|
|
63
|
+
*
|
|
64
|
+
* Pass 1: collect every top-level `const X = <expr>` where the RHS
|
|
65
|
+
* is either a `boolean` literal (recorded in `literals`) or
|
|
66
|
+
* a single `identifier` (recorded in `aliases`).
|
|
67
|
+
* Pass 2: walk each alias entry up to `MAX_ALIAS_HOPS` hops; if the
|
|
68
|
+
* chain terminates at a known-bool literal, record `X` with
|
|
69
|
+
* the literal's value. Cycles, chains exceeding the cap, and
|
|
70
|
+
* chains exiting file scope (unknown identifier at the root)
|
|
71
|
+
* bail to "unknown".
|
|
72
|
+
*
|
|
73
|
+
* Only `const` decls qualify (not `var`). The function is permissive
|
|
74
|
+
* about modifier tokens (`pub`, type annotation) — it reads only the
|
|
75
|
+
* identifier name and the RHS expression shape.
|
|
76
|
+
*/
|
|
77
|
+
export declare function buildZigBoolConstMap(rootNode: SyntaxNode): ZigBoolConstMap;
|
|
78
|
+
/**
|
|
79
|
+
* Every source range that is statically dead in this file: the body of an
|
|
80
|
+
* `if` whose condition folds to `false`, and the `else` clause of an `if`
|
|
81
|
+
* whose condition folds to `true`. Both the statement form (`if (c) { .. }`)
|
|
82
|
+
* and the expression form (`const x = if (c) a else b;`) are walked; the
|
|
83
|
+
* arms differ only in how the grammar exposes them, see `ifExpressionArms`.
|
|
84
|
+
* Line/col ranges, so a capture layer that
|
|
85
|
+
* only keeps `Capture.range` (no node) can still stamp its call sites —
|
|
86
|
+
* that is how the scope-resolution provider consumes this module.
|
|
87
|
+
*
|
|
88
|
+
* One walk per file over every `if`, so a call site is classified by
|
|
89
|
+
* position lookup; nesting needs no special case because an inner branch
|
|
90
|
+
* inside a dead body is inside the dead body's range already.
|
|
91
|
+
*/
|
|
92
|
+
export interface ZigGatedRange {
|
|
93
|
+
readonly startLine: number;
|
|
94
|
+
readonly startCol: number;
|
|
95
|
+
readonly endLine: number;
|
|
96
|
+
readonly endCol: number;
|
|
97
|
+
}
|
|
98
|
+
export declare function collectZigStaticGatedRanges(rootNode: SyntaxNode, localBools: ZigBoolConstMap, importAliases: ZigImportAliasMap, lookupBoolsForPath: ZigBoolConstLookup): readonly ZigGatedRange[];
|
|
99
|
+
/** Is a (1-based line, 0-based col) position inside one of `ranges`? */
|
|
100
|
+
export declare function isPositionStaticGated(line: number, col: number, ranges: readonly ZigGatedRange[]): boolean;
|
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
// gitnexus/src/core/ingestion/call-extractors/zig-static-gating.ts
|
|
2
|
+
/** Maximum recursion depth when evaluating a boolean condition expression. */
|
|
3
|
+
const MAX_COND_DEPTH = 4;
|
|
4
|
+
// ---------------------------------------------------------------------------
|
|
5
|
+
// Phase 2: per-file extraction
|
|
6
|
+
// ---------------------------------------------------------------------------
|
|
7
|
+
/** Cap on alias-chain hops walked when resolving `const A = B; const B = C; ...`. */
|
|
8
|
+
const MAX_ALIAS_HOPS = 5;
|
|
9
|
+
/**
|
|
10
|
+
* Walk the top-level of a Zig source file and collect known-bool
|
|
11
|
+
* constants. Two passes:
|
|
12
|
+
*
|
|
13
|
+
* Pass 1: collect every top-level `const X = <expr>` where the RHS
|
|
14
|
+
* is either a `boolean` literal (recorded in `literals`) or
|
|
15
|
+
* a single `identifier` (recorded in `aliases`).
|
|
16
|
+
* Pass 2: walk each alias entry up to `MAX_ALIAS_HOPS` hops; if the
|
|
17
|
+
* chain terminates at a known-bool literal, record `X` with
|
|
18
|
+
* the literal's value. Cycles, chains exceeding the cap, and
|
|
19
|
+
* chains exiting file scope (unknown identifier at the root)
|
|
20
|
+
* bail to "unknown".
|
|
21
|
+
*
|
|
22
|
+
* Only `const` decls qualify (not `var`). The function is permissive
|
|
23
|
+
* about modifier tokens (`pub`, type annotation) — it reads only the
|
|
24
|
+
* identifier name and the RHS expression shape.
|
|
25
|
+
*/
|
|
26
|
+
export function buildZigBoolConstMap(rootNode) {
|
|
27
|
+
const literals = new Map();
|
|
28
|
+
const aliases = new Map();
|
|
29
|
+
for (const child of rootNode.namedChildren) {
|
|
30
|
+
if (child.type !== 'variable_declaration')
|
|
31
|
+
continue;
|
|
32
|
+
const entry = extractBoolConstOrAlias(child);
|
|
33
|
+
if (!entry)
|
|
34
|
+
continue;
|
|
35
|
+
if (entry.kind === 'literal') {
|
|
36
|
+
literals.set(entry.name, entry.value);
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
aliases.set(entry.name, entry.aliasOf);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
// Pass 2: resolve alias chains.
|
|
43
|
+
for (const [name, target] of aliases) {
|
|
44
|
+
const resolved = resolveAliasChain(name, target, literals, aliases);
|
|
45
|
+
if (resolved !== undefined) {
|
|
46
|
+
literals.set(name, resolved);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return literals;
|
|
50
|
+
}
|
|
51
|
+
function resolveAliasChain(start, firstTarget, literals, aliases) {
|
|
52
|
+
// Walk: start → firstTarget → aliases.get(firstTarget) → ... up to MAX_ALIAS_HOPS.
|
|
53
|
+
// Cycle protection via a visited set seeded with `start` itself.
|
|
54
|
+
const visited = new Set();
|
|
55
|
+
visited.add(start);
|
|
56
|
+
let current = firstTarget;
|
|
57
|
+
for (let hop = 0; hop < MAX_ALIAS_HOPS; hop++) {
|
|
58
|
+
if (visited.has(current))
|
|
59
|
+
return undefined; // cycle
|
|
60
|
+
visited.add(current);
|
|
61
|
+
const lit = literals.get(current);
|
|
62
|
+
if (lit !== undefined)
|
|
63
|
+
return lit;
|
|
64
|
+
const next = aliases.get(current);
|
|
65
|
+
if (next === undefined)
|
|
66
|
+
return undefined; // chain exits file scope or hits unknown
|
|
67
|
+
current = next;
|
|
68
|
+
}
|
|
69
|
+
return undefined; // hop cap exceeded
|
|
70
|
+
}
|
|
71
|
+
function extractBoolConstOrAlias(decl) {
|
|
72
|
+
// Require `const` and exclude `var`. tree-sitter-zig parses both with
|
|
73
|
+
// the same `variable_declaration` shape; the qualifier is an anonymous
|
|
74
|
+
// child token. A `pub var FOO = false;` is mutable global state — its
|
|
75
|
+
// initial value is NOT a comptime constant and must not feed gating.
|
|
76
|
+
let isConst = false;
|
|
77
|
+
let isVar = false;
|
|
78
|
+
for (let i = 0; i < decl.childCount; i++) {
|
|
79
|
+
const c = decl.child(i);
|
|
80
|
+
if (!c || c.isNamed)
|
|
81
|
+
continue;
|
|
82
|
+
if (c.type === 'const')
|
|
83
|
+
isConst = true;
|
|
84
|
+
else if (c.type === 'var')
|
|
85
|
+
isVar = true;
|
|
86
|
+
}
|
|
87
|
+
if (!isConst || isVar)
|
|
88
|
+
return null;
|
|
89
|
+
let name;
|
|
90
|
+
let value;
|
|
91
|
+
let aliasOf;
|
|
92
|
+
for (const c of decl.namedChildren) {
|
|
93
|
+
if (c.type === 'identifier' && name === undefined) {
|
|
94
|
+
name = c.text;
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
if (c.type === 'boolean') {
|
|
98
|
+
const t = c.text;
|
|
99
|
+
if (t === 'true')
|
|
100
|
+
value = true;
|
|
101
|
+
else if (t === 'false')
|
|
102
|
+
value = false;
|
|
103
|
+
}
|
|
104
|
+
else if (c.type === 'identifier' && name !== undefined && aliasOf === undefined) {
|
|
105
|
+
// Second `identifier` child is the RHS alias target:
|
|
106
|
+
// `const B = A;` → name='B', aliasOf='A'.
|
|
107
|
+
aliasOf = c.text;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
if (name === undefined)
|
|
111
|
+
return null;
|
|
112
|
+
if (value !== undefined)
|
|
113
|
+
return { kind: 'literal', name, value };
|
|
114
|
+
if (aliasOf !== undefined)
|
|
115
|
+
return { kind: 'alias', name, aliasOf };
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
export function collectZigStaticGatedRanges(rootNode, localBools, importAliases, lookupBoolsForPath) {
|
|
119
|
+
const out = [];
|
|
120
|
+
for (const node of rootNode.descendantsOfType(['if_statement', 'if_expression'])) {
|
|
121
|
+
const cond = findIfCondition(node);
|
|
122
|
+
const result = cond
|
|
123
|
+
? evalCond(cond, localBools, importAliases, lookupBoolsForPath, 0)
|
|
124
|
+
: undefined;
|
|
125
|
+
let dead = null;
|
|
126
|
+
if (node.type === 'if_statement') {
|
|
127
|
+
if (result === false)
|
|
128
|
+
dead = node.childForFieldName('body');
|
|
129
|
+
if (result === true)
|
|
130
|
+
dead = node.namedChildren.find((c) => c.type === 'else_clause') ?? null;
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
const arms = ifExpressionArms(node);
|
|
134
|
+
if (result === false)
|
|
135
|
+
dead = arms.consequence;
|
|
136
|
+
if (result === true)
|
|
137
|
+
dead = arms.alternative;
|
|
138
|
+
}
|
|
139
|
+
if (dead) {
|
|
140
|
+
out.push({
|
|
141
|
+
startLine: dead.startPosition.row + 1,
|
|
142
|
+
startCol: dead.startPosition.column,
|
|
143
|
+
endLine: dead.endPosition.row + 1,
|
|
144
|
+
endCol: dead.endPosition.column,
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return out;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* The two arms of an `if_expression` (`const x = if (c) a else b;`). Unlike
|
|
152
|
+
* `if_statement` the grammar gives them no field names and no `else_clause`
|
|
153
|
+
* wrapper: the consequence is the first named child after the closing `)`
|
|
154
|
+
* of the condition, the alternative is the first named child after the
|
|
155
|
+
* anonymous `else` token. Either may be absent.
|
|
156
|
+
*/
|
|
157
|
+
function ifExpressionArms(node) {
|
|
158
|
+
let consequence = null;
|
|
159
|
+
let alternative = null;
|
|
160
|
+
let slot = 'none';
|
|
161
|
+
for (let i = 0; i < node.childCount; i++) {
|
|
162
|
+
const c = node.child(i);
|
|
163
|
+
if (!c)
|
|
164
|
+
continue;
|
|
165
|
+
if (!c.isNamed) {
|
|
166
|
+
if (c.type === ')' && slot === 'none')
|
|
167
|
+
slot = 'consequence';
|
|
168
|
+
else if (c.type === 'else')
|
|
169
|
+
slot = 'alternative';
|
|
170
|
+
continue;
|
|
171
|
+
}
|
|
172
|
+
if (slot === 'consequence' && !consequence)
|
|
173
|
+
consequence = c;
|
|
174
|
+
else if (slot === 'alternative' && !alternative)
|
|
175
|
+
alternative = c;
|
|
176
|
+
}
|
|
177
|
+
return { consequence, alternative };
|
|
178
|
+
}
|
|
179
|
+
/** Is a (1-based line, 0-based col) position inside one of `ranges`? */
|
|
180
|
+
export function isPositionStaticGated(line, col, ranges) {
|
|
181
|
+
for (const r of ranges) {
|
|
182
|
+
if (line < r.startLine || line > r.endLine)
|
|
183
|
+
continue;
|
|
184
|
+
if (line === r.startLine && col < r.startCol)
|
|
185
|
+
continue;
|
|
186
|
+
if (line === r.endLine && col >= r.endCol)
|
|
187
|
+
continue;
|
|
188
|
+
return true;
|
|
189
|
+
}
|
|
190
|
+
return false;
|
|
191
|
+
}
|
|
192
|
+
/** Pick the condition node out of an `if_statement`. The condition is
|
|
193
|
+
* the first named child (the body / else branches come after). */
|
|
194
|
+
function findIfCondition(ifNode) {
|
|
195
|
+
return ifNode.namedChildren[0] ?? null;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Evaluate a boolean condition expression to a tribool.
|
|
199
|
+
*
|
|
200
|
+
* Handles only the shapes we can resolve symbolically; everything else
|
|
201
|
+
* returns `undefined` ("unknown — treat as live").
|
|
202
|
+
*/
|
|
203
|
+
function evalCond(node, localBools, importAliases, lookupBoolsForPath, depth) {
|
|
204
|
+
if (depth > MAX_COND_DEPTH)
|
|
205
|
+
return undefined;
|
|
206
|
+
switch (node.type) {
|
|
207
|
+
case 'boolean': {
|
|
208
|
+
// Bare literal: `if (false)`.
|
|
209
|
+
if (node.text === 'true')
|
|
210
|
+
return true;
|
|
211
|
+
if (node.text === 'false')
|
|
212
|
+
return false;
|
|
213
|
+
return undefined;
|
|
214
|
+
}
|
|
215
|
+
case 'identifier': {
|
|
216
|
+
// Bare flag check: `if (FOO)`.
|
|
217
|
+
const v = localBools.get(node.text);
|
|
218
|
+
return v === undefined ? undefined : v;
|
|
219
|
+
}
|
|
220
|
+
case 'field_expression': {
|
|
221
|
+
// `cfg.FOO` — alias hop.
|
|
222
|
+
const obj = node.namedChildren[0];
|
|
223
|
+
const member = node.namedChildren[1];
|
|
224
|
+
if (obj?.type !== 'identifier' || member?.type !== 'identifier') {
|
|
225
|
+
return undefined;
|
|
226
|
+
}
|
|
227
|
+
const targetFile = importAliases.get(obj.text);
|
|
228
|
+
if (!targetFile)
|
|
229
|
+
return undefined;
|
|
230
|
+
const targetBools = lookupBoolsForPath(targetFile);
|
|
231
|
+
if (!targetBools)
|
|
232
|
+
return undefined;
|
|
233
|
+
const v = targetBools.get(member.text);
|
|
234
|
+
return v === undefined ? undefined : v;
|
|
235
|
+
}
|
|
236
|
+
case 'binary_expression': {
|
|
237
|
+
// `lhs and rhs` / `lhs or rhs` / `lhs == rhs` / `lhs != rhs`.
|
|
238
|
+
const op = findOperatorToken(node);
|
|
239
|
+
const lhs = node.namedChildren[0];
|
|
240
|
+
const rhs = node.namedChildren[1];
|
|
241
|
+
if (!lhs || !rhs)
|
|
242
|
+
return undefined;
|
|
243
|
+
const l = evalCond(lhs, localBools, importAliases, lookupBoolsForPath, depth + 1);
|
|
244
|
+
const r = evalCond(rhs, localBools, importAliases, lookupBoolsForPath, depth + 1);
|
|
245
|
+
if (op === 'and') {
|
|
246
|
+
// `false and *` = false; `* and false` = false.
|
|
247
|
+
if (l === false || r === false)
|
|
248
|
+
return false;
|
|
249
|
+
if (l === true && r === true)
|
|
250
|
+
return true;
|
|
251
|
+
return undefined;
|
|
252
|
+
}
|
|
253
|
+
if (op === 'or') {
|
|
254
|
+
// Only `false or false` is provably false.
|
|
255
|
+
if (l === false && r === false)
|
|
256
|
+
return false;
|
|
257
|
+
if (l === true || r === true)
|
|
258
|
+
return true;
|
|
259
|
+
return undefined;
|
|
260
|
+
}
|
|
261
|
+
if (op === '==') {
|
|
262
|
+
// Equality folds when both sides are known booleans.
|
|
263
|
+
// `FOO == false` ↔ `!FOO`; `FOO == true` ↔ `FOO`.
|
|
264
|
+
if (l === undefined || r === undefined)
|
|
265
|
+
return undefined;
|
|
266
|
+
return l === r;
|
|
267
|
+
}
|
|
268
|
+
if (op === '!=') {
|
|
269
|
+
if (l === undefined || r === undefined)
|
|
270
|
+
return undefined;
|
|
271
|
+
return l !== r;
|
|
272
|
+
}
|
|
273
|
+
// Other comparison ops (<, >, …) — not booleans we can prove.
|
|
274
|
+
return undefined;
|
|
275
|
+
}
|
|
276
|
+
case 'parenthesized_expression': {
|
|
277
|
+
// `(cond)`: transparent.
|
|
278
|
+
const inner = node.namedChildren[0];
|
|
279
|
+
if (!inner)
|
|
280
|
+
return undefined;
|
|
281
|
+
return evalCond(inner, localBools, importAliases, lookupBoolsForPath, depth + 1);
|
|
282
|
+
}
|
|
283
|
+
case 'error_union_type': {
|
|
284
|
+
// tree-sitter-zig has no unary `!` node: prefix `!cond` (boolean
|
|
285
|
+
// negation) parses as `error_union_type` because the same `!` token
|
|
286
|
+
// introduces error-union types. In condition position that reading is
|
|
287
|
+
// never a type, so negate whatever the operand folds to: an
|
|
288
|
+
// identifier, a literal, or a parenthesized compound like `!(A and B)`.
|
|
289
|
+
const inner = node.namedChildren[0];
|
|
290
|
+
if (!inner)
|
|
291
|
+
return undefined;
|
|
292
|
+
const v = evalCond(inner, localBools, importAliases, lookupBoolsForPath, depth + 1);
|
|
293
|
+
if (v === undefined)
|
|
294
|
+
return undefined;
|
|
295
|
+
return !v;
|
|
296
|
+
}
|
|
297
|
+
default:
|
|
298
|
+
return undefined;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* Pull the textual operator (e.g. "and", "or") out of a
|
|
303
|
+
* `binary_expression`. In tree-sitter-zig, the operator is an
|
|
304
|
+
* anonymous child token whose `type` equals the operator string.
|
|
305
|
+
*/
|
|
306
|
+
function findOperatorToken(binExpr) {
|
|
307
|
+
for (let i = 0; i < binExpr.childCount; i++) {
|
|
308
|
+
const c = binExpr.child(i);
|
|
309
|
+
if (!c)
|
|
310
|
+
continue;
|
|
311
|
+
if (!c.isNamed) {
|
|
312
|
+
// Anonymous tokens for these ops carry their text as the type.
|
|
313
|
+
if (c.type === 'and' || c.type === 'or' || c.type === '==' || c.type === '!=') {
|
|
314
|
+
return c.type;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
return undefined;
|
|
319
|
+
}
|
|
@@ -5,6 +5,45 @@ import { parseSourceSafe } from '../../../tree-sitter/safe-parse.js';
|
|
|
5
5
|
import { synthesizeCallableFlowCaptures } from '../../utils/callable-flow-captures.js';
|
|
6
6
|
import { hasZigPubKeyword } from '../../export-detection.js';
|
|
7
7
|
import { normalizeZigTypeName } from './interpret.js';
|
|
8
|
+
import { buildZigBoolConstMap, collectZigStaticGatedRanges, isPositionStaticGated, } from '../../call-extractors/zig-static-gating.js';
|
|
9
|
+
/**
|
|
10
|
+
* A call capture inside an `if (CONST_FALSE)` body (or the `else` of an
|
|
11
|
+
* `if (CONST_TRUE)`) gets this extra key; `scope-extractor` turns it into
|
|
12
|
+
* `ReferenceSite.staticGated`
|
|
13
|
+
* and the emitters copy it onto the CALLS edge. Same idiom as Go's
|
|
14
|
+
* `@reference.callee-position`: a zero-range marker, present or absent, so
|
|
15
|
+
* every ungated site's capture set stays byte-identical.
|
|
16
|
+
*/
|
|
17
|
+
const ZERO_RANGE = Object.freeze({ startLine: 0, startCol: 0, endLine: 0, endCol: 0 });
|
|
18
|
+
const STATIC_GATED_MARKER = Object.freeze({
|
|
19
|
+
name: '@reference.static-gated',
|
|
20
|
+
range: ZERO_RANGE,
|
|
21
|
+
text: '',
|
|
22
|
+
});
|
|
23
|
+
const NO_IMPORT_ALIASES = new Map();
|
|
24
|
+
/** Stamp `@reference.static-gated` onto every call capture whose anchor sits
|
|
25
|
+
* in a statically dead range. File-local constants only for now (v1): the
|
|
26
|
+
* cross-file alias walk in `zig-static-gating.ts` needs the repo file list,
|
|
27
|
+
* which the capture layer does not see. */
|
|
28
|
+
function stampZigStaticGating(out, root) {
|
|
29
|
+
// No early return on an empty constant table: `collectZigStaticGatedRanges`
|
|
30
|
+
// also folds bare literals (`if (false) { ... }`), which need no constants.
|
|
31
|
+
const bools = buildZigBoolConstMap(root);
|
|
32
|
+
const ranges = collectZigStaticGatedRanges(root, bools, NO_IMPORT_ALIASES, () => undefined);
|
|
33
|
+
if (ranges.length === 0)
|
|
34
|
+
return out;
|
|
35
|
+
return out.map((m) => {
|
|
36
|
+
const key = Object.keys(m).find((k) => k.startsWith('@reference.call.'));
|
|
37
|
+
if (key === undefined)
|
|
38
|
+
return m;
|
|
39
|
+
const anchor = m[key];
|
|
40
|
+
if (anchor === undefined)
|
|
41
|
+
return m;
|
|
42
|
+
return isPositionStaticGated(anchor.range.startLine, anchor.range.startCol, ranges)
|
|
43
|
+
? { ...m, '@reference.static-gated': STATIC_GATED_MARKER }
|
|
44
|
+
: m;
|
|
45
|
+
});
|
|
46
|
+
}
|
|
8
47
|
/** Zig container node types: `struct`, `enum`, `union` and the fieldless
|
|
9
48
|
* `opaque` all bind through `const T = <container> {…}` and may own methods.
|
|
10
49
|
* Single source for the class/field/method extractor configs. */
|
|
@@ -1661,7 +1700,7 @@ export function emitZigScopeCaptures(sourceText, _filePath, cachedTree) {
|
|
|
1661
1700
|
// second pass rewrites that name inside the receiver text it just minted.
|
|
1662
1701
|
rewriteZigDeepAliasReferences(out, deepAliases.aliases);
|
|
1663
1702
|
rewriteZigFunctionLocalImportNames(out, fnLocalImports);
|
|
1664
|
-
return out;
|
|
1703
|
+
return stampZigStaticGating(out, tree.rootNode);
|
|
1665
1704
|
}
|
|
1666
1705
|
// ─── Use-site rewrites (8.4 / 8.9) and result-location sites (8.6) ────────────
|
|
1667
1706
|
/** The unique spelling a function-local import binding gets: `m$<callable>`
|
|
@@ -256,6 +256,7 @@ function buildReference(site, top) {
|
|
|
256
256
|
// construction sites (`callForm: 'constructor'`) on the CALLS edge it
|
|
257
257
|
// emits — a `Reference` otherwise keeps only the resolved def.
|
|
258
258
|
...(site.kind === 'call' && site.callForm !== undefined ? { callForm: site.callForm } : {}),
|
|
259
|
+
...(site.kind === 'call' && site.staticGated === true ? { staticGated: true } : {}),
|
|
259
260
|
confidence: top.confidence,
|
|
260
261
|
evidence: top.evidence,
|
|
261
262
|
};
|
|
@@ -1031,6 +1031,11 @@ function pass5CollectReferences(matches, positionIndex, filePath, referenceSites
|
|
|
1031
1031
|
// detection knows what to do with that. Absent for every language without
|
|
1032
1032
|
// pointer embedding, so their sites stay byte-identical.
|
|
1033
1033
|
const embeddedAsPointer = match['@reference.embedded-pointer'] !== undefined;
|
|
1034
|
+
// Static-gating marker: the call sits in a branch the language layer proved
|
|
1035
|
+
// dead at index time (Zig `if (CONST_FALSE)`). Recorded on the site and
|
|
1036
|
+
// copied to the CALLS edge; absent everywhere else (see
|
|
1037
|
+
// `ReferenceSite.staticGated`).
|
|
1038
|
+
const staticGated = kind === 'call' && match['@reference.static-gated'] !== undefined;
|
|
1034
1039
|
const site = {
|
|
1035
1040
|
name: nameCap.text,
|
|
1036
1041
|
atRange: anchor.range,
|
|
@@ -1051,6 +1056,7 @@ function pass5CollectReferences(matches, positionIndex, filePath, referenceSites
|
|
|
1051
1056
|
...(receiverChain !== undefined ? { receiverChain } : {}),
|
|
1052
1057
|
...(inCalleePosition ? { inCalleePosition: true } : {}),
|
|
1053
1058
|
...(embeddedAsPointer ? { embeddedAsPointer: true } : {}),
|
|
1059
|
+
...(staticGated ? { staticGated: true } : {}),
|
|
1054
1060
|
};
|
|
1055
1061
|
referenceSites.push(site);
|
|
1056
1062
|
}
|
|
@@ -1469,6 +1475,7 @@ const KNOWN_SUB_TAGS = new Set([
|
|
|
1469
1475
|
'@reference.property-key',
|
|
1470
1476
|
'@reference.callee-position',
|
|
1471
1477
|
'@reference.embedded-pointer',
|
|
1478
|
+
'@reference.static-gated',
|
|
1472
1479
|
'@reference.receiver',
|
|
1473
1480
|
'@reference.operator',
|
|
1474
1481
|
'@reference.arity',
|
|
@@ -55,6 +55,8 @@ export declare function tryEmitEdge(graph: KnowledgeGraph, scopes: ScopeResoluti
|
|
|
55
55
|
/** See {@link isPhantomCalleeRead}. Set by the extractor from the
|
|
56
56
|
* language's `@reference.callee-position` marker; absent otherwise. */
|
|
57
57
|
readonly inCalleePosition?: boolean;
|
|
58
|
+
/** See `ReferenceSite.staticGated`; copied onto the emitted edge. */
|
|
59
|
+
readonly staticGated?: boolean;
|
|
58
60
|
}, targetDef: SymbolDefinition, reason: string, seen: Set<string>, confidence?: number, collapseByCallerTarget?: boolean, calleeCapture?: CalleeIdCaptureCtx): boolean;
|
|
59
61
|
/**
|
|
60
62
|
* Variant of `tryEmitEdge` that takes a pre-resolved target graph id
|
|
@@ -85,4 +87,6 @@ export declare function tryEmitEdgeWithExplicitTargetId(graph: KnowledgeGraph, s
|
|
|
85
87
|
startCol: number;
|
|
86
88
|
};
|
|
87
89
|
readonly kind: string;
|
|
90
|
+
/** See `ReferenceSite.staticGated`; copied onto the emitted edge. */
|
|
91
|
+
readonly staticGated?: boolean;
|
|
88
92
|
}, targetGraphId: string, reason: string, seen: Set<string>, confidence?: number, collapseByCallerTarget?: boolean, calleeCapture?: CalleeIdCaptureCtx): boolean;
|
|
@@ -133,6 +133,7 @@ export function tryEmitEdge(graph, scopes, nodeLookup, site, targetDef, reason,
|
|
|
133
133
|
type: edgeType,
|
|
134
134
|
confidence,
|
|
135
135
|
reason,
|
|
136
|
+
...(site.staticGated === true ? { staticGated: true } : {}),
|
|
136
137
|
});
|
|
137
138
|
return true;
|
|
138
139
|
}
|
|
@@ -184,6 +185,7 @@ export function tryEmitEdgeWithExplicitTargetId(graph, scopes, nodeLookup, site,
|
|
|
184
185
|
type: edgeType,
|
|
185
186
|
confidence,
|
|
186
187
|
reason,
|
|
188
|
+
...(site.staticGated === true ? { staticGated: true } : {}),
|
|
187
189
|
});
|
|
188
190
|
return true;
|
|
189
191
|
}
|
|
@@ -79,6 +79,7 @@ export function emitFreeCallFallback(graph, scopes, parsedFiles, nodeLookup, _re
|
|
|
79
79
|
return owners.has(instanceOwnerKey(ownerId));
|
|
80
80
|
};
|
|
81
81
|
for (const parsed of parsedFiles) {
|
|
82
|
+
const pending = new Map();
|
|
82
83
|
const bindingCandidatesByScope = options.freeCallsRequireInstanceOwnership === true
|
|
83
84
|
? new Map()
|
|
84
85
|
: undefined;
|
|
@@ -462,22 +463,38 @@ export function emitFreeCallFallback(graph, scopes, parsedFiles, nodeLookup, _re
|
|
|
462
463
|
// SiteRecord.at: 1-based line / 0-based col).
|
|
463
464
|
options.calleeIdSink?.add(parsed.filePath, site.atRange.startLine, site.atRange.startCol, tgtGraphId);
|
|
464
465
|
const relId = `rel:CALLS:${callerGraphId}->${tgtGraphId}`;
|
|
466
|
+
// One edge per (caller, callee): `staticGated` is the AND over every site
|
|
467
|
+
// that collapses into it, so a callee reached from one live site and one
|
|
468
|
+
// dead site stays live whichever site the walk meets first. Emission is
|
|
469
|
+
// deferred to the end of this file's sites for that reason.
|
|
470
|
+
const pendingRel = pending.get(relId);
|
|
471
|
+
if (pendingRel !== undefined) {
|
|
472
|
+
if (site.staticGated !== true)
|
|
473
|
+
pendingRel.gatedAll = false;
|
|
474
|
+
continue;
|
|
475
|
+
}
|
|
465
476
|
if (seen.has(relId))
|
|
466
477
|
continue;
|
|
467
478
|
seen.add(relId);
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
479
|
+
pending.set(relId, {
|
|
480
|
+
gatedAll: site.staticGated === true,
|
|
481
|
+
rel: {
|
|
482
|
+
id: relId,
|
|
483
|
+
sourceId: callerGraphId,
|
|
484
|
+
targetId: tgtGraphId,
|
|
485
|
+
type: 'CALLS',
|
|
486
|
+
confidence: 0.85,
|
|
487
|
+
// Match legacy DAG's reason convention so consumers that
|
|
488
|
+
// assert `reason === 'import-resolved'` keep working. The
|
|
489
|
+
// construction-site marker is opt-in for the same reason.
|
|
490
|
+
reason: constructionSiteReason(fnDef.filePath !== parsed.filePath ? 'import-resolved' : 'local-call', site, options.markConstructionSites),
|
|
491
|
+
},
|
|
478
492
|
});
|
|
479
493
|
emitted++;
|
|
480
494
|
}
|
|
495
|
+
for (const { rel, gatedAll } of pending.values()) {
|
|
496
|
+
graph.addRelationship(gatedAll ? { ...rel, staticGated: true } : rel);
|
|
497
|
+
}
|
|
481
498
|
}
|
|
482
499
|
return emitted;
|
|
483
500
|
}
|
|
@@ -115,7 +115,7 @@ export declare const isBinaryContent: (content: string) => boolean;
|
|
|
115
115
|
export declare const normalizeFtsText: (text: string) => string;
|
|
116
116
|
/** Canonical relationship CSV header — shared by the emit pass and the
|
|
117
117
|
* `splitRelCsvByLabelPair` differential oracle. */
|
|
118
|
-
export declare const REL_CSV_HEADER = "from,to,type,confidence,reason,step";
|
|
118
|
+
export declare const REL_CSV_HEADER = "from,to,type,confidence,reason,step,staticGated";
|
|
119
119
|
/** Build the escaped CSV row (no trailing newline) for one relationship.
|
|
120
120
|
* Single source of the relationship row bytes — used by the emit pass and by
|
|
121
121
|
* the byte-identity differential test that feeds the legacy split oracle. */
|
|
@@ -351,7 +351,7 @@ class BufferedCSVWriter {
|
|
|
351
351
|
// ============================================================================
|
|
352
352
|
/** Canonical relationship CSV header — shared by the emit pass and the
|
|
353
353
|
* `splitRelCsvByLabelPair` differential oracle. */
|
|
354
|
-
export const REL_CSV_HEADER = 'from,to,type,confidence,reason,step';
|
|
354
|
+
export const REL_CSV_HEADER = 'from,to,type,confidence,reason,step,staticGated';
|
|
355
355
|
/** Build the escaped CSV row (no trailing newline) for one relationship.
|
|
356
356
|
* Single source of the relationship row bytes — used by the emit pass and by
|
|
357
357
|
* the byte-identity differential test that feeds the legacy split oracle. */
|
|
@@ -362,6 +362,10 @@ export const buildRelRow = (rel) => [
|
|
|
362
362
|
escapeCSVNumber(rel.confidence, 1.0),
|
|
363
363
|
escapeCSVField(rel.reason),
|
|
364
364
|
escapeCSVNumber(rel.step, 0),
|
|
365
|
+
// `staticGated` persists as 0/1 (LadybugDB BOOLEAN COPY accepts both).
|
|
366
|
+
// Every edge that does not carry the flag writes 0, so readers treat
|
|
367
|
+
// absence and `false` identically.
|
|
368
|
+
rel.staticGated === true ? '1' : '0',
|
|
365
369
|
].join(',');
|
|
366
370
|
/** Canonical BasicBlock node CSV header — taint/PDG substrate (issue #2080).
|
|
367
371
|
* No `name` column; blocks are identified by id + source span. Shared by the
|
|
@@ -1259,20 +1259,24 @@ export const fallbackRelationshipInserts = async (validRelLines, validTables, ge
|
|
|
1259
1259
|
for (let i = 1; i < validRelLines.length; i++) {
|
|
1260
1260
|
const line = validRelLines[i];
|
|
1261
1261
|
try {
|
|
1262
|
-
|
|
1262
|
+
// CSV layout: from,to,type,confidence,reason,step[,staticGated]
|
|
1263
|
+
// The trailing `staticGated` column (0/1) is optional so we remain
|
|
1264
|
+
// tolerant of legacy CSVs written before the column existed.
|
|
1265
|
+
const match = line.match(/"([^"]*)","([^"]*)","([^"]*)",([0-9.]+),"([^"]*)",([0-9-]+)(?:,([01]))?/);
|
|
1263
1266
|
if (!match)
|
|
1264
1267
|
continue;
|
|
1265
|
-
const [, fromId, toId, relType, confidenceStr, reason, stepStr] = match;
|
|
1268
|
+
const [, fromId, toId, relType, confidenceStr, reason, stepStr, gatedStr] = match;
|
|
1266
1269
|
const fromLabel = getNodeLabel(fromId);
|
|
1267
1270
|
const toLabel = getNodeLabel(toId);
|
|
1268
1271
|
if (!validTables.has(fromLabel) || !validTables.has(toLabel))
|
|
1269
1272
|
continue;
|
|
1270
1273
|
const confidence = parseFloat(confidenceStr) || 1.0;
|
|
1271
1274
|
const step = parseInt(stepStr) || 0;
|
|
1275
|
+
const staticGated = gatedStr === '1';
|
|
1272
1276
|
await queryAndDrain(conn, `
|
|
1273
1277
|
MATCH (a:${escapeLabel(fromLabel)} {id: ${formatCypherValue(fromId)} }),
|
|
1274
1278
|
(b:${escapeLabel(toLabel)} {id: ${formatCypherValue(toId)} })
|
|
1275
|
-
CREATE (a)-[:${REL_TABLE_NAME} {type: ${formatCypherValue(relType)}, confidence: ${confidence}, reason: ${formatCypherValue(reason)}, step: ${step}}]->(b)
|
|
1279
|
+
CREATE (a)-[:${REL_TABLE_NAME} {type: ${formatCypherValue(relType)}, confidence: ${confidence}, reason: ${formatCypherValue(reason)}, step: ${step}, staticGated: ${staticGated}}]->(b)
|
|
1276
1280
|
`);
|
|
1277
1281
|
}
|
|
1278
1282
|
catch {
|
package/dist/core/lbug/schema.js
CHANGED
|
@@ -627,7 +627,8 @@ ${generatedPairDdl()},
|
|
|
627
627
|
type STRING,
|
|
628
628
|
confidence DOUBLE,
|
|
629
629
|
reason STRING,
|
|
630
|
-
step INT32
|
|
630
|
+
step INT32,
|
|
631
|
+
staticGated BOOLEAN
|
|
631
632
|
)`;
|
|
632
633
|
// ============================================================================
|
|
633
634
|
// EMBEDDING TABLE SCHEMA
|
|
@@ -6023,8 +6023,8 @@ export class LocalBackend {
|
|
|
6023
6023
|
// retains the strongest evidence, the safer default for a blast-radius
|
|
6024
6024
|
// tool. `sourceId` closes the order for edges that tie on both.
|
|
6025
6025
|
const query = direction === 'upstream'
|
|
6026
|
-
? `MATCH (caller)-[r:CodeRelation]->(n) WHERE n.id IN $frontierIds AND r.type IN $relTypes${confidenceFilter} RETURN n.id AS sourceId, caller.id AS id, caller.name AS name, labels(caller)[0] AS type, caller.filePath AS filePath, r.type AS relType, r.confidence AS confidence`
|
|
6027
|
-
: `MATCH (n)-[r:CodeRelation]->(callee) WHERE n.id IN $frontierIds AND r.type IN $relTypes${confidenceFilter} RETURN n.id AS sourceId, callee.id AS id, callee.name AS name, labels(callee)[0] AS type, callee.filePath AS filePath, r.type AS relType, r.confidence AS confidence`;
|
|
6026
|
+
? `MATCH (caller)-[r:CodeRelation]->(n) WHERE n.id IN $frontierIds AND r.type IN $relTypes${confidenceFilter} RETURN n.id AS sourceId, caller.id AS id, caller.name AS name, labels(caller)[0] AS type, caller.filePath AS filePath, r.type AS relType, r.confidence AS confidence, r.staticGated AS staticGated`
|
|
6027
|
+
: `MATCH (n)-[r:CodeRelation]->(callee) WHERE n.id IN $frontierIds AND r.type IN $relTypes${confidenceFilter} RETURN n.id AS sourceId, callee.id AS id, callee.name AS name, labels(callee)[0] AS type, callee.filePath AS filePath, r.type AS relType, r.confidence AS confidence, r.staticGated AS staticGated`;
|
|
6028
6028
|
try {
|
|
6029
6029
|
const related = await executeParameterized(repo.lbugPath, query, {
|
|
6030
6030
|
frontierIds: frontier,
|
|
@@ -6039,6 +6039,9 @@ export class LocalBackend {
|
|
|
6039
6039
|
relType: rel.relType || rel[5],
|
|
6040
6040
|
confidence: rel.confidence ?? rel[6],
|
|
6041
6041
|
sourceId: String(rel.sourceId ?? rel[0] ?? ''),
|
|
6042
|
+
// Set only by languages that compute static gating (Zig); null/undefined
|
|
6043
|
+
// from older indexes or other languages reads as live.
|
|
6044
|
+
...((rel.staticGated ?? rel[7]) === true ? { staticGated: true } : {}),
|
|
6042
6045
|
}));
|
|
6043
6046
|
// The pdg bridge is the ONE consumer here that accumulates sequentially
|
|
6044
6047
|
// rather than per-node: at depth ≥ 2 an edge inherits
|
|
@@ -6112,6 +6115,9 @@ export class LocalBackend {
|
|
|
6112
6115
|
filePath: edge.filePath,
|
|
6113
6116
|
relationType,
|
|
6114
6117
|
confidence: effectiveConfidence,
|
|
6118
|
+
// Surfaced, never acted on: traversal and ranking ignore the flag
|
|
6119
|
+
// (see GraphRelationship.staticGated). Absent = live or unmodelled.
|
|
6120
|
+
...(edge.staticGated === true ? { staticGated: true } : {}),
|
|
6115
6121
|
});
|
|
6116
6122
|
}
|
|
6117
6123
|
}
|
package/dist/mcp/tools.js
CHANGED
|
@@ -442,7 +442,7 @@ Output includes:
|
|
|
442
442
|
- summary: direct callers, processes affected, modules affected
|
|
443
443
|
- affected_processes: which execution flows break and at which step
|
|
444
444
|
- affected_modules: which functional areas are hit (direct vs indirect; classification-unavailable when that secondary query fails)
|
|
445
|
-
- byDepth: affected symbols grouped by traversal depth (paginated by limit/offset; omitted when summaryOnly:true — use byDepthCounts for totals per depth, pagination object when truncated). Each item includes a processes:[{id,label,processType,step}] field listing the execution flows that symbol participates in. Empty when the symbol has no process membership. Can ALSO be empty when partial:true is set — either the process-aggregation pass hit its cap before detecting affected processes, or per-symbol enrichment was capped on a very large page. When partial:true, do NOT treat processes:[] as proof of no participation; cross-check the top-level affected_processes list.
|
|
445
|
+
- byDepth: affected symbols grouped by traversal depth (paginated by limit/offset; omitted when summaryOnly:true — use byDepthCounts for totals per depth, pagination object when truncated). Each item includes a processes:[{id,label,processType,step}] field listing the execution flows that symbol participates in. Empty when the symbol has no process membership. Can ALSO be empty when partial:true is set — either the process-aggregation pass hit its cap before detecting affected processes, or per-symbol enrichment was capped on a very large page. When partial:true, do NOT treat processes:[] as proof of no participation; cross-check the top-level affected_processes list. An item carries staticGated:true only when the edge that reached it is provably unreachable at compile time from the indexed source (today: Zig calls inside an 'if (CONST_FALSE)' body or the else of 'if (CONST_TRUE)'); the field is absent when the edge is live or the language does not model it. Traversal and risk do NOT filter or rank on it: it is metadata for the caller to weigh.
|
|
446
446
|
- epistemic: 'exact' | 'lower-bound' — whether impactedCount is the whole story. 'lower-bound' means the walk provably missed callers, so the count is a floor. Absent only on skipped probes (ambiguous-candidate lists, group fan-out).
|
|
447
447
|
- boundaries: string[] — one plain-language sentence per reason the count is short. Prose for humans; branch on causes instead.
|
|
448
448
|
- causes: { scopeExtractionFiles, receiverTyping, dispatchBoundary, externalBoundary, undecidedSatisfaction } — the machine-readable split of WHY, so an agent gating its own edits can tell a fixable analyzer gap from an irreducible one. Every field counts MISSING THINGS, never sentences:
|
|
@@ -727,7 +727,10 @@ import { copyV8CacheIfPresent, tryLoadV8Cache, writeV8CacheFile } from './v8-sid
|
|
|
727
727
|
// byte-identical graph until `parse-cache/` and `parsedfile-cache/` were
|
|
728
728
|
// deleted by hand. 92 is the next free value above origin/main (91) at merge
|
|
729
729
|
// time. RE-CHECK AGAINST origin/main AND OPEN PRs IMMEDIATELY BEFORE MERGING.
|
|
730
|
-
|
|
730
|
+
// v93: Zig call captures inside a comptime-false branch carry
|
|
731
|
+
// `@reference.static-gated` (feat/zig-static-gated-edges); the site gains
|
|
732
|
+
// `staticGated` and the CALLS edge a BOOLEAN column.
|
|
733
|
+
const SCHEMA_BUMP = 93;
|
|
731
734
|
const GITNEXUS_PKG_VERSION = (() => {
|
|
732
735
|
try {
|
|
733
736
|
// package.json sits at gitnexus/package.json — two levels up from
|
package/package.json
CHANGED