gitnexus 1.6.10-aptos.0 → 1.6.10-aptos.2
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/README.md +25 -0
- package/dist/_shared/graph/types.d.ts +3 -2
- package/dist/_shared/graph/types.d.ts.map +1 -1
- package/dist/_shared/lbug/schema-constants.d.ts +1 -1
- package/dist/_shared/lbug/schema-constants.d.ts.map +1 -1
- package/dist/_shared/lbug/schema-constants.js +1 -0
- package/dist/_shared/lbug/schema-constants.js.map +1 -1
- package/dist/cli/analyze.js +8 -0
- package/dist/core/incremental/subgraph-extract.d.ts +3 -0
- package/dist/core/incremental/subgraph-extract.js +17 -1
- package/dist/core/ingestion/pipeline-phases/standalone-ingest.d.ts +13 -0
- package/dist/core/ingestion/pipeline-phases/standalone-ingest.js +4 -1
- package/dist/core/ingestion/pipeline.d.ts +4 -4
- package/dist/core/ingestion/pipeline.js +5 -0
- package/dist/core/ingestion/process-processor.d.ts +2 -1
- package/dist/core/ingestion/process-processor.js +94 -48
- package/dist/core/lbug/csv-generator.js +1 -0
- package/dist/core/lbug/lbug-adapter.d.ts +20 -9
- package/dist/core/lbug/lbug-adapter.js +51 -22
- package/dist/core/lbug/node-table-layout.d.ts +1 -0
- package/dist/core/lbug/node-table-layout.js +12 -0
- package/dist/core/lbug/schema.d.ts +2 -1
- package/dist/core/lbug/schema.js +9 -0
- package/dist/core/move/compiler-facts.d.ts +5 -0
- package/dist/core/move/concurrency.d.ts +16 -0
- package/dist/core/move/concurrency.js +36 -0
- package/dist/core/move/consistency.d.ts +70 -2
- package/dist/core/move/consistency.js +240 -7
- package/dist/core/move/constants.d.ts +6 -0
- package/dist/core/move/constants.js +6 -0
- package/dist/core/move/facts-mapper.d.ts +4 -45
- package/dist/core/move/facts-mapper.js +385 -433
- package/dist/core/move/function-usage.d.ts +22 -0
- package/dist/core/move/function-usage.js +40 -0
- package/dist/core/move/install.js +21 -0
- package/dist/core/move/mcp-client.d.ts +38 -1
- package/dist/core/move/mcp-client.js +101 -21
- package/dist/core/move/move-ingest.d.ts +9 -5
- package/dist/core/move/move-ingest.js +187 -183
- package/dist/core/move/move-linker.d.ts +40 -0
- package/dist/core/move/move-linker.js +331 -0
- package/dist/core/move/provision.js +66 -8
- package/dist/core/move/refs.d.ts +24 -0
- package/dist/core/move/refs.js +1 -0
- package/dist/core/move/symbol-id.d.ts +2 -0
- package/dist/core/move/symbol-id.js +4 -0
- package/dist/core/move/type-parser.js +17 -2
- package/dist/core/run-analyze.d.ts +6 -0
- package/dist/core/run-analyze.js +71 -48
- package/dist/storage/repo-manager.d.ts +13 -1
- package/dist/storage/repo-manager.js +6 -1
- package/dist/types/pipeline.d.ts +8 -1
- package/package.json +1 -1
- package/web/assets/{agent-Bqxn-abU.js → agent-NGATqfuu.js} +1 -1
- package/web/assets/{index-D1Z3dGGz.js → index-CxGcYetu.js} +3 -3
- package/web/index.html +1 -1
package/README.md
CHANGED
|
@@ -375,6 +375,31 @@ described in [Move compiler provisioning](#move-compiler-provisioning) —
|
|
|
375
375
|
including the `MOVE_FLOW` override and `GITNEXUS_SKIP_MOVE_FLOW=1` for
|
|
376
376
|
air-gapped hosts.
|
|
377
377
|
|
|
378
|
+
### Analyzing real-world Move repositories
|
|
379
|
+
|
|
380
|
+
Real repos routinely contain Move packages that cannot build standalone (test
|
|
381
|
+
fixtures, examples, fuzzer corpora — `aptos-core` alone has 470+). `analyze`
|
|
382
|
+
handles them per package instead of giving up:
|
|
383
|
+
|
|
384
|
+
- **Unbuildable packages are skipped with a warning**, not fatal: their
|
|
385
|
+
`.move` files stay out of the graph and the final summary names each skipped
|
|
386
|
+
package with the compiler's first diagnostic. Set `GITNEXUS_MOVE_STRICT=1`
|
|
387
|
+
to make any build failure abort the analyze instead.
|
|
388
|
+
- **`_` placeholder addresses** (`econia = "_"` in `[addresses]`) are caught
|
|
389
|
+
pre-flight — MoveFlow has no dev-mode build, so set concrete addresses in
|
|
390
|
+
`Move.toml` or exclude the package.
|
|
391
|
+
- **Builds with compiler errors still yield facts, at reduced fidelity**: the
|
|
392
|
+
MoveFlow compiler silently omits inferred `acquires` data from erroring
|
|
393
|
+
builds, so such packages are ingested with a persistent
|
|
394
|
+
"compiled with errors" warning. A common cause is a framework dependency
|
|
395
|
+
newer than MoveFlow's pinned compiler (e.g. unrecognized spec pragmas).
|
|
396
|
+
- **`.gitnexusignore`** (gitignore syntax, repo root) excludes directories from
|
|
397
|
+
analysis entirely — the fastest way to scope large repos to the packages you
|
|
398
|
+
care about, and the remedy the skip warnings suggest.
|
|
399
|
+
- **Cold builds of git-based framework dependencies can exceed the 5-minute
|
|
400
|
+
compile budget**; raise it with `GITNEXUS_MOVE_FLOW_TIMEOUT_MS` (e.g.
|
|
401
|
+
`1800000` for 30 min) for the first analyze.
|
|
402
|
+
|
|
378
403
|
## Release candidates
|
|
379
404
|
|
|
380
405
|
Stable releases publish to the default `latest` dist-tag. When a pull request
|
|
@@ -98,9 +98,10 @@ export type NodeProperties = {
|
|
|
98
98
|
/**
|
|
99
99
|
* Node-location precision. `'precise'` = per-symbol file/span from the
|
|
100
100
|
* move-flow `facts` query; `'module'` = only the containing module/type file
|
|
101
|
-
* is known; `'package'` = coarse package-root fallback
|
|
101
|
+
* is known; `'package'` = coarse package-root fallback; `'external'` =
|
|
102
|
+
* declaration belongs to a dependency outside the indexed repository.
|
|
102
103
|
*/
|
|
103
|
-
locationFidelity?: 'precise' | 'module' | 'package';
|
|
104
|
+
locationFidelity?: 'precise' | 'module' | 'package' | 'external';
|
|
104
105
|
text?: string;
|
|
105
106
|
/** BasicBlock: space-joined leaf callee names invoked in the block — the
|
|
106
107
|
* statement-precise inter-procedural reach substrate for impact mode. */
|
|
@@ -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,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ACX;;;;;;qEAMqE;AAErE,kEAAkE;GAChE,WAAW;AACb,gEAAgE;GAC9D,gBAAgB;AAClB,kEAAkE;GAChE,iBAAiB;AACnB,+DAA+D;GAC7D,UAAU;AACZ,2DAA2D;GACzD,WAAW;AACb,6EAA6E;GAC3E,OAAO,GACP,qBAAqB;AACvB;;;;;;gEAMgE;GAC9D,aAAa;AAOf,6EAA6E;GAC3E,KAAK;AACP;;;;qCAIqC;GACnC,cAAc;AAChB,qDAAqD;GACnD,SAAS;AACX,6CAA6C;GAC3C,WAAW;AACb;8EAC8E;GAC5E,YAAY;AACd;;;;qEAIqE;GACnE,KAAK;AACP;;;;;;0EAM0E;GACxE,eAAe;AACjB;;;;;;;;;;;oCAWoC;GAClC,cAAc,CAAC;AAEnB,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,SAAS,CAAC;IACjB,UAAU,EAAE,cAAc,CAAC;CAC5B;AAED,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,gBAAgB,CAAC;IACvB,UAAU,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;CACL"}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* Full DDL schemas remain in each package's own schema.ts because
|
|
8
8
|
* the CLI uses native LadybugDB and the web uses WASM.
|
|
9
9
|
*/
|
|
10
|
-
export declare const NODE_TABLES: readonly ["File", "Folder", "Function", "Class", "Interface", "Method", "CodeElement", "Community", "Process", "Section", "Struct", "Enum", "EnumVariant", "Macro", "Typedef", "Union", "Namespace", "Trait", "Impl", "TypeAlias", "Const", "Static", "Variable", "Property", "Record", "Delegate", "Annotation", "Constructor", "Template", "Module", "Route", "Tool", "BasicBlock"];
|
|
10
|
+
export declare const NODE_TABLES: readonly ["File", "Folder", "Function", "Class", "Interface", "Method", "CodeElement", "Community", "Process", "Section", "Struct", "Enum", "EnumVariant", "Macro", "Typedef", "Union", "Namespace", "Trait", "Impl", "TypeAlias", "Type", "Const", "Static", "Variable", "Property", "Record", "Delegate", "Annotation", "Constructor", "Template", "Module", "Route", "Tool", "BasicBlock"];
|
|
11
11
|
export type NodeTableName = (typeof NODE_TABLES)[number];
|
|
12
12
|
export declare const REL_TABLE_NAME = "CodeRelation";
|
|
13
13
|
export declare const REL_TYPES: readonly ["CONTAINS", "DEFINES", "IMPORTS", "CALLS", "EXTENDS", "IMPLEMENTS", "HAS_METHOD", "HAS_PROPERTY", "ACCESSES", "METHOD_OVERRIDES", "OVERRIDES", "METHOD_IMPLEMENTS", "MEMBER_OF", "STEP_IN_PROCESS", "HANDLES_ROUTE", "FETCHES", "HANDLES_TOOL", "ENTRY_POINT_OF", "WRAPS", "QUERIES", "INJECTS", "FRIEND_OF", "READS_RESOURCE", "WRITES_RESOURCE", "ACQUIRES", "USES_TYPE", "EMITS", "CFG", "REACHING_DEF", "TAINTED", "SANITIZES", "TAINT_PATH", "CDG", "POST_DOMINATE"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-constants.d.ts","sourceRoot":"","sources":["../../src/lbug/schema-constants.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"schema-constants.d.ts","sourceRoot":"","sources":["../../src/lbug/schema-constants.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,eAAO,MAAM,WAAW,+XAoCd,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzD,eAAO,MAAM,cAAc,iBAAiB,CAAC;AAE7C,eAAO,MAAM,SAAS,qdA2CZ,CAAC;AAEX,MAAM,MAAM,OAAO,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjD,eAAO,MAAM,oBAAoB,kBAAkB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-constants.js","sourceRoot":"","sources":["../../src/lbug/schema-constants.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,MAAM;IACN,QAAQ;IACR,UAAU;IACV,OAAO;IACP,WAAW;IACX,QAAQ;IACR,aAAa;IACb,WAAW;IACX,SAAS;IACT,SAAS;IACT,QAAQ;IACR,MAAM;IACN,aAAa;IACb,OAAO;IACP,SAAS;IACT,OAAO;IACP,WAAW;IACX,OAAO;IACP,MAAM;IACN,WAAW;IACX,OAAO;IACP,QAAQ;IACR,UAAU;IACV,UAAU;IACV,QAAQ;IACR,UAAU;IACV,YAAY;IACZ,aAAa;IACb,UAAU;IACV,QAAQ;IACR,OAAO;IACP,MAAM;IACN,2EAA2E;IAC3E,YAAY;CACJ,CAAC;AAIX,MAAM,CAAC,MAAM,cAAc,GAAG,cAAc,CAAC;AAE7C,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,UAAU;IACV,SAAS;IACT,SAAS;IACT,OAAO;IACP,SAAS;IACT,YAAY;IACZ,YAAY;IACZ,cAAc;IACd,UAAU;IACV,kBAAkB;IAClB,WAAW,EAAE,mEAAmE;IAChF,mBAAmB;IACnB,WAAW;IACX,iBAAiB;IACjB,eAAe;IACf,SAAS;IACT,cAAc;IACd,gBAAgB;IAChB,OAAO;IACP,SAAS;IACT,SAAS;IACT,gEAAgE;IAChE,WAAW;IACX,gBAAgB;IAChB,iBAAiB;IACjB,UAAU;IACV,WAAW;IACX,OAAO;IACP,yEAAyE;IACzE,yEAAyE;IACzE,6EAA6E;IAC7E,KAAK;IACL,cAAc;IACd,SAAS;IACT,WAAW;IACX,YAAY;IACZ,4EAA4E;IAC5E,uEAAuE;IACvE,4EAA4E;IAC5E,8EAA8E;IAC9E,KAAK;IACL,eAAe;CACP,CAAC;AAIX,MAAM,CAAC,MAAM,oBAAoB,GAAG,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"schema-constants.js","sourceRoot":"","sources":["../../src/lbug/schema-constants.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,MAAM;IACN,QAAQ;IACR,UAAU;IACV,OAAO;IACP,WAAW;IACX,QAAQ;IACR,aAAa;IACb,WAAW;IACX,SAAS;IACT,SAAS;IACT,QAAQ;IACR,MAAM;IACN,aAAa;IACb,OAAO;IACP,SAAS;IACT,OAAO;IACP,WAAW;IACX,OAAO;IACP,MAAM;IACN,WAAW;IACX,MAAM;IACN,OAAO;IACP,QAAQ;IACR,UAAU;IACV,UAAU;IACV,QAAQ;IACR,UAAU;IACV,YAAY;IACZ,aAAa;IACb,UAAU;IACV,QAAQ;IACR,OAAO;IACP,MAAM;IACN,2EAA2E;IAC3E,YAAY;CACJ,CAAC;AAIX,MAAM,CAAC,MAAM,cAAc,GAAG,cAAc,CAAC;AAE7C,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,UAAU;IACV,SAAS;IACT,SAAS;IACT,OAAO;IACP,SAAS;IACT,YAAY;IACZ,YAAY;IACZ,cAAc;IACd,UAAU;IACV,kBAAkB;IAClB,WAAW,EAAE,mEAAmE;IAChF,mBAAmB;IACnB,WAAW;IACX,iBAAiB;IACjB,eAAe;IACf,SAAS;IACT,cAAc;IACd,gBAAgB;IAChB,OAAO;IACP,SAAS;IACT,SAAS;IACT,gEAAgE;IAChE,WAAW;IACX,gBAAgB;IAChB,iBAAiB;IACjB,UAAU;IACV,WAAW;IACX,OAAO;IACP,yEAAyE;IACzE,yEAAyE;IACzE,6EAA6E;IAC7E,KAAK;IACL,cAAc;IACd,SAAS;IACT,WAAW;IACX,YAAY;IACZ,4EAA4E;IAC5E,uEAAuE;IACvE,4EAA4E;IAC5E,8EAA8E;IAC9E,KAAK;IACL,eAAe;CACP,CAAC;AAIX,MAAM,CAAC,MAAM,oBAAoB,GAAG,eAAe,CAAC"}
|
package/dist/cli/analyze.js
CHANGED
|
@@ -1193,6 +1193,14 @@ const analyzeCommandImpl = async (inputPath, cliOptions, runnerIdentityAtBootstr
|
|
|
1193
1193
|
` Install it once with network access (GITNEXUS_LBUG_EXTENSION_INSTALL=auto) then rerun, or\n` +
|
|
1194
1194
|
` run \`gitnexus analyze --repair-fts\` when connected. Run \`gitnexus doctor\` for details.`);
|
|
1195
1195
|
}
|
|
1196
|
+
// Standalone-ingest warnings (skipped/degraded Move packages) share the
|
|
1197
|
+
// FTS warning's rationale: mid-run progress lines scroll away, so anything
|
|
1198
|
+
// the operator must act on has to reappear in the final summary.
|
|
1199
|
+
if (result.ingestWarnings && result.ingestWarnings.length > 0) {
|
|
1200
|
+
for (const warning of result.ingestWarnings) {
|
|
1201
|
+
console.log(`\n Warning: ${warning}`);
|
|
1202
|
+
}
|
|
1203
|
+
}
|
|
1196
1204
|
try {
|
|
1197
1205
|
await fs.access(getGlobalRegistryPath());
|
|
1198
1206
|
}
|
|
@@ -9,6 +9,9 @@
|
|
|
9
9
|
* - Every graph-wide node (Community, Process) — these are regenerated
|
|
10
10
|
* each run by the communities/processes phases and must be fully
|
|
11
11
|
* rewritten.
|
|
12
|
+
* - Every external dependency node (`locationFidelity: 'external'`, no
|
|
13
|
+
* filePath) — regenerated each run by the standalone ingest phase and
|
|
14
|
+
* delete-all'd by the orchestrator, same contract as Community/Process.
|
|
12
15
|
* - Every relationship where AT LEAST ONE endpoint is in the writable
|
|
13
16
|
* set above. Relationships entirely between unchanged-file nodes
|
|
14
17
|
* are skipped — their rows are still in the DB and re-inserting
|
|
@@ -9,6 +9,9 @@
|
|
|
9
9
|
* - Every graph-wide node (Community, Process) — these are regenerated
|
|
10
10
|
* each run by the communities/processes phases and must be fully
|
|
11
11
|
* rewritten.
|
|
12
|
+
* - Every external dependency node (`locationFidelity: 'external'`, no
|
|
13
|
+
* filePath) — regenerated each run by the standalone ingest phase and
|
|
14
|
+
* delete-all'd by the orchestrator, same contract as Community/Process.
|
|
12
15
|
* - Every relationship where AT LEAST ONE endpoint is in the writable
|
|
13
16
|
* set above. Relationships entirely between unchanged-file nodes
|
|
14
17
|
* are skipped — their rows are still in the DB and re-inserting
|
|
@@ -49,6 +52,19 @@
|
|
|
49
52
|
*/
|
|
50
53
|
import { createKnowledgeGraph } from '../graph/graph.js';
|
|
51
54
|
const isGraphWide = (label) => label === 'Community' || label === 'Process';
|
|
55
|
+
/**
|
|
56
|
+
* Externally-declared dependency symbols (compiler-backed ingesters stamp
|
|
57
|
+
* `locationFidelity: 'external'`) carry no filePath, so the file-keyed
|
|
58
|
+
* delete/write cycle can never refresh them — an external symbol first
|
|
59
|
+
* referenced during an incremental run would be skipped here while its edges
|
|
60
|
+
* are extracted, and the dangling endpoints would fail the rel COPY into the
|
|
61
|
+
* per-row fallback (which silently drops them). They are regenerated
|
|
62
|
+
* whole-program by every ingest run, so they get the Community/Process
|
|
63
|
+
* treatment: the orchestrator delete-alls them first
|
|
64
|
+
* (`deleteAllExternalNodes`) and this extractor re-includes them from the
|
|
65
|
+
* fresh graph.
|
|
66
|
+
*/
|
|
67
|
+
const isExternalNode = (n) => n.properties?.locationFidelity === 'external';
|
|
52
68
|
/**
|
|
53
69
|
* Relationship types whose VALIDITY is a whole-program property, not a
|
|
54
70
|
* function of their endpoints' files (#2084 M4 U6). `TAINT_PATH` (cross-
|
|
@@ -95,7 +111,7 @@ export const extractChangedSubgraph = (fullGraph, toWriteSet) => {
|
|
|
95
111
|
const writableNodeIds = new Set();
|
|
96
112
|
fullGraph.forEachNode((n) => {
|
|
97
113
|
const filePath = n.properties?.filePath;
|
|
98
|
-
const include = (filePath && toWriteSet.has(filePath)) || isGraphWide(n.label);
|
|
114
|
+
const include = (filePath && toWriteSet.has(filePath)) || isGraphWide(n.label) || isExternalNode(n);
|
|
99
115
|
if (include) {
|
|
100
116
|
sub.addNode(n);
|
|
101
117
|
writableNodeIds.add(n.id);
|
|
@@ -5,6 +5,19 @@ import type { PipelinePhase } from './types.js';
|
|
|
5
5
|
*/
|
|
6
6
|
export interface StandaloneIngestOutput {
|
|
7
7
|
readonly ingestedFiles: ReadonlySet<string>;
|
|
8
|
+
/**
|
|
9
|
+
* Whether this run produced a complete replacement snapshot of external
|
|
10
|
+
* dependency nodes. `false` tells incremental persistence to preserve the
|
|
11
|
+
* prior snapshot because at least one standalone-ingest input was skipped.
|
|
12
|
+
* Omitted is treated as complete for backward-compatible custom phases.
|
|
13
|
+
*/
|
|
14
|
+
readonly externalNodeSnapshotComplete?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Operator-actionable warnings the ingester wants surfaced in the persistent
|
|
17
|
+
* CLI summary (e.g. a package it had to skip or ingest at degraded fidelity).
|
|
18
|
+
* Language-neutral: the pipeline passes these through without interpreting.
|
|
19
|
+
*/
|
|
20
|
+
readonly ingestWarnings?: readonly string[];
|
|
8
21
|
}
|
|
9
22
|
/** Default no-op used when the caller does not supply a standalone ingester. */
|
|
10
23
|
export declare const emptyStandaloneIngestPhase: PipelinePhase<StandaloneIngestOutput>;
|
|
@@ -2,5 +2,8 @@
|
|
|
2
2
|
export const emptyStandaloneIngestPhase = {
|
|
3
3
|
name: 'standaloneIngest',
|
|
4
4
|
deps: ['structure'],
|
|
5
|
-
execute: () => Promise.resolve({
|
|
5
|
+
execute: () => Promise.resolve({
|
|
6
|
+
ingestedFiles: new Set(),
|
|
7
|
+
externalNodeSnapshotComplete: true,
|
|
8
|
+
}),
|
|
6
9
|
};
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
import { type PipelineProgress } from '../../_shared/index.js';
|
|
18
18
|
import { PipelineResult } from '../../types/pipeline.js';
|
|
19
19
|
import { type StandaloneIngestOutput, type PipelinePhase } from './pipeline-phases/index.js';
|
|
20
|
-
export interface PipelineOptions {
|
|
20
|
+
export interface PipelineOptions<TStandaloneIngest extends StandaloneIngestOutput = StandaloneIngestOutput> {
|
|
21
21
|
/**
|
|
22
22
|
* Skip MRO, community detection, and process extraction for faster test runs.
|
|
23
23
|
* The `pruneLocalSymbols` phase still runs — it is graph construction (it cleans
|
|
@@ -187,7 +187,7 @@ export interface PipelineOptions {
|
|
|
187
187
|
*/
|
|
188
188
|
keepLocalValueSymbols?: boolean;
|
|
189
189
|
/** Optional compiler-backed or otherwise standalone ingester. */
|
|
190
|
-
standaloneIngestPhase?: PipelinePhase<
|
|
190
|
+
standaloneIngestPhase?: PipelinePhase<TStandaloneIngest>;
|
|
191
191
|
/**
|
|
192
192
|
* Extra fetch-wrapper function names to treat as HTTP consumers, threaded
|
|
193
193
|
* from `.gitnexusrc` `fetchWrappers` via `AnalyzeOptions` (#1589/#1852
|
|
@@ -217,5 +217,5 @@ export interface PipelineOptions {
|
|
|
217
217
|
* asserts the produced list is byte-identical to the legacy array for every
|
|
218
218
|
* options combination.
|
|
219
219
|
*/
|
|
220
|
-
export declare function buildPhaseList(options?: PipelineOptions): PipelinePhase[];
|
|
221
|
-
export declare const runPipelineFromRepo: (repoPath: string, onProgress: (progress: PipelineProgress) => void, options?: PipelineOptions) => Promise<PipelineResult
|
|
220
|
+
export declare function buildPhaseList<TStandaloneIngest extends StandaloneIngestOutput>(options?: PipelineOptions<TStandaloneIngest>): PipelinePhase[];
|
|
221
|
+
export declare const runPipelineFromRepo: <TStandaloneIngest extends StandaloneIngestOutput = StandaloneIngestOutput>(repoPath: string, onProgress: (progress: PipelineProgress) => void, options?: PipelineOptions<TStandaloneIngest>) => Promise<PipelineResult<TStandaloneIngest>>;
|
|
@@ -81,6 +81,10 @@ export const runPipelineFromRepo = async (repoPath, onProgress, options) => {
|
|
|
81
81
|
const { totalFiles, usedWorkerPool } = getPhaseOutput(results, 'parse');
|
|
82
82
|
let communityResult;
|
|
83
83
|
let processResult;
|
|
84
|
+
// Standalone ingest is always registered (it defaults to the empty phase),
|
|
85
|
+
// so its output — and the language-neutral warnings it passes through — are
|
|
86
|
+
// always present.
|
|
87
|
+
const standaloneIngest = getPhaseOutput(results, 'standaloneIngest');
|
|
84
88
|
const scopeResolutionOutput = getPhaseOutput(results, 'scopeResolution');
|
|
85
89
|
const resolutionOutcomes = scopeResolutionOutput.resolutionOutcomes;
|
|
86
90
|
// Streamed PDG-emit manifest (#2202): present only when streaming was on.
|
|
@@ -110,5 +114,6 @@ export const runPipelineFromRepo = async (repoPath, onProgress, options) => {
|
|
|
110
114
|
resolutionOutcomes,
|
|
111
115
|
usedWorkerPool,
|
|
112
116
|
pdgEmitManifest,
|
|
117
|
+
standaloneIngest,
|
|
113
118
|
};
|
|
114
119
|
};
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* Process Detection Processor
|
|
3
3
|
*
|
|
4
4
|
* Detects execution flows (Processes) in the code graph by:
|
|
5
|
-
* 1. Finding entry points (
|
|
5
|
+
* 1. Finding entry points (explicit graph roots plus functions that call
|
|
6
|
+
* others but have few callers)
|
|
6
7
|
* 2. Tracing forward via CALLS edges (BFS)
|
|
7
8
|
* 3. Grouping and deduplicating similar paths
|
|
8
9
|
* 4. Labeling with heuristic names
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* Process Detection Processor
|
|
3
3
|
*
|
|
4
4
|
* Detects execution flows (Processes) in the code graph by:
|
|
5
|
-
* 1. Finding entry points (
|
|
5
|
+
* 1. Finding entry points (explicit graph roots plus functions that call
|
|
6
|
+
* others but have few callers)
|
|
6
7
|
* 2. Tracing forward via CALLS edges (BFS)
|
|
7
8
|
* 3. Grouping and deduplicating similar paths
|
|
8
9
|
* 4. Labeling with heuristic names
|
|
@@ -33,14 +34,11 @@ export const processProcesses = async (knowledgeGraph, memberships, onProgress,
|
|
|
33
34
|
// Build lookup maps
|
|
34
35
|
const membershipMap = new Map();
|
|
35
36
|
memberships.forEach((m) => membershipMap.set(m.nodeId, m.communityId));
|
|
36
|
-
const callsEdges =
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
// Step 1: Find entry points (functions that call others but have few callers)
|
|
42
|
-
const entryPoints = findEntryPoints(knowledgeGraph, reverseCallsEdges, callsEdges);
|
|
43
|
-
onProgress?.(`Found ${entryPoints.length} entry points, tracing flows...`, 20);
|
|
37
|
+
const { forward: callsEdges, reverse: reverseCallsEdges } = buildCallsAdjacency(knowledgeGraph);
|
|
38
|
+
// Step 1: Find entry points — explicit ENTRY_POINT_OF graph roots plus
|
|
39
|
+
// heuristic ones (functions that call others but have few callers).
|
|
40
|
+
const explicitEntryPointIds = collectExplicitEntryPointIds(knowledgeGraph);
|
|
41
|
+
const entryPoints = findEntryPoints(knowledgeGraph, reverseCallsEdges, callsEdges, explicitEntryPointIds);
|
|
44
42
|
onProgress?.(`Found ${entryPoints.length} entry points, tracing flows...`, 20);
|
|
45
43
|
// Step 2: Trace processes from each entry point
|
|
46
44
|
const allTraces = [];
|
|
@@ -55,14 +53,20 @@ export const processProcesses = async (knowledgeGraph, memberships, onProgress,
|
|
|
55
53
|
}
|
|
56
54
|
onProgress?.(`Found ${allTraces.length} traces, deduplicating...`, 60);
|
|
57
55
|
// Step 3: Deduplicate similar traces (subset removal)
|
|
58
|
-
const uniqueTraces = deduplicateTraces(allTraces);
|
|
56
|
+
const uniqueTraces = deduplicateTraces(allTraces, explicitEntryPointIds);
|
|
59
57
|
// Step 3b: Deduplicate by entry+terminal pair (keep longest path per pair)
|
|
60
58
|
const endpointDeduped = deduplicateByEndpoints(uniqueTraces);
|
|
61
59
|
onProgress?.(`Deduped ${uniqueTraces.length} → ${endpointDeduped.length} unique endpoint pairs`, 70);
|
|
62
|
-
// Step 4:
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
60
|
+
// Step 4: Interleave compiler-declared and heuristic roots so a large
|
|
61
|
+
// explicit API surface cannot consume the entire process budget.
|
|
62
|
+
// Each tier still prefers longer traces.
|
|
63
|
+
const explicitTraces = endpointDeduped
|
|
64
|
+
.filter((trace) => explicitEntryPointIds.has(trace[0]))
|
|
65
|
+
.sort((a, b) => b.length - a.length);
|
|
66
|
+
const heuristicTraces = endpointDeduped
|
|
67
|
+
.filter((trace) => !explicitEntryPointIds.has(trace[0]))
|
|
68
|
+
.sort((a, b) => b.length - a.length);
|
|
69
|
+
const limitedTraces = interleaveTiers(explicitTraces, heuristicTraces).slice(0, cfg.maxProcesses);
|
|
66
70
|
onProgress?.(`Creating ${limitedTraces.length} process nodes...`, 80);
|
|
67
71
|
// Step 5: Create process nodes
|
|
68
72
|
const processes = [];
|
|
@@ -81,8 +85,8 @@ export const processProcesses = async (knowledgeGraph, memberships, onProgress,
|
|
|
81
85
|
// Determine process type
|
|
82
86
|
const processType = communities.length > 1 ? 'cross_community' : 'intra_community';
|
|
83
87
|
// Generate label
|
|
84
|
-
const entryNode =
|
|
85
|
-
const terminalNode =
|
|
88
|
+
const entryNode = knowledgeGraph.getNode(entryPointId);
|
|
89
|
+
const terminalNode = knowledgeGraph.getNode(terminalId);
|
|
86
90
|
const entryName = entryNode?.properties.name || 'Unknown';
|
|
87
91
|
const terminalName = terminalNode?.properties.name || 'Unknown';
|
|
88
92
|
const heuristicLabel = `${capitalize(entryName)} → ${capitalize(terminalName)}`;
|
|
@@ -130,29 +134,55 @@ export const processProcesses = async (knowledgeGraph, memberships, onProgress,
|
|
|
130
134
|
* traces to jump across unrelated code areas.
|
|
131
135
|
*/
|
|
132
136
|
const MIN_TRACE_CONFIDENCE = 0.5;
|
|
133
|
-
|
|
134
|
-
|
|
137
|
+
/** Build forward and reverse CALLS adjacency lists in one relationship scan. */
|
|
138
|
+
const buildCallsAdjacency = (graph) => {
|
|
139
|
+
const forward = new Map();
|
|
140
|
+
const reverse = new Map();
|
|
141
|
+
const push = (adj, key, value) => {
|
|
142
|
+
const bucket = adj.get(key);
|
|
143
|
+
if (bucket === undefined)
|
|
144
|
+
adj.set(key, [value]);
|
|
145
|
+
else
|
|
146
|
+
bucket.push(value);
|
|
147
|
+
};
|
|
135
148
|
for (const rel of graph.iterRelationships()) {
|
|
136
149
|
if (rel.type === 'CALLS' && rel.confidence >= MIN_TRACE_CONFIDENCE) {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
}
|
|
140
|
-
adj.get(rel.sourceId).push(rel.targetId);
|
|
150
|
+
push(forward, rel.sourceId, rel.targetId);
|
|
151
|
+
push(reverse, rel.targetId, rel.sourceId);
|
|
141
152
|
}
|
|
142
153
|
}
|
|
143
|
-
return
|
|
154
|
+
return { forward, reverse };
|
|
144
155
|
};
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
156
|
+
/** IDs of nodes carrying a pre-phase ENTRY_POINT_OF edge (compiler-backed
|
|
157
|
+
* runtime/API roots stamped by the standalone ingest phase). */
|
|
158
|
+
function collectExplicitEntryPointIds(graph) {
|
|
159
|
+
const ids = new Set();
|
|
160
|
+
for (const rel of graph.iterRelationshipsByType('ENTRY_POINT_OF')) {
|
|
161
|
+
// Only callable roots qualify. Route/Tool→Process ENTRY_POINT_OF edges
|
|
162
|
+
// are created after this phase; the label filter keeps them out even if
|
|
163
|
+
// phase ordering ever changes.
|
|
164
|
+
const label = graph.getNode(rel.sourceId)?.label;
|
|
165
|
+
if (label === 'Function' || label === 'Method')
|
|
166
|
+
ids.add(rel.sourceId);
|
|
154
167
|
}
|
|
155
|
-
return
|
|
168
|
+
return ids;
|
|
169
|
+
}
|
|
170
|
+
/** Global cap on heuristic (non-explicit) entry points, to prevent explosion
|
|
171
|
+
* on large polyglot repos. Explicit graph roots are interleaved separately. */
|
|
172
|
+
const HEURISTIC_ENTRY_POINT_BUDGET = 200;
|
|
173
|
+
/** Comparator combinator: explicit items first, then a secondary order. */
|
|
174
|
+
const explicitFirst = (isExplicit, then) => (a, b) => Number(isExplicit(b)) - Number(isExplicit(a)) || then(a, b);
|
|
175
|
+
/** Alternate between two independently ranked tiers, starting with primary. */
|
|
176
|
+
const interleaveTiers = (primary, secondary) => {
|
|
177
|
+
const interleaved = [];
|
|
178
|
+
const length = Math.max(primary.length, secondary.length);
|
|
179
|
+
for (let i = 0; i < length; i++) {
|
|
180
|
+
if (i < primary.length)
|
|
181
|
+
interleaved.push(primary[i]);
|
|
182
|
+
if (i < secondary.length)
|
|
183
|
+
interleaved.push(secondary[i]);
|
|
184
|
+
}
|
|
185
|
+
return interleaved;
|
|
156
186
|
};
|
|
157
187
|
/**
|
|
158
188
|
* Find functions/methods that are good entry points for tracing.
|
|
@@ -164,8 +194,14 @@ const buildReverseCallsGraph = (graph) => {
|
|
|
164
194
|
*
|
|
165
195
|
* Test files are excluded entirely.
|
|
166
196
|
*/
|
|
167
|
-
const findEntryPoints = (graph, reverseCallsEdges, callsEdges) => {
|
|
197
|
+
const findEntryPoints = (graph, reverseCallsEdges, callsEdges, explicitEntryPointIds) => {
|
|
168
198
|
const symbolTypes = new Set(['Function', 'Method']);
|
|
199
|
+
// ENTRY_POINT_OF is the graph-wide, language-neutral signal for a known
|
|
200
|
+
// runtime/API root. Only edges emitted BEFORE this phase count — today
|
|
201
|
+
// that is compiler-backed standalone ingesters; the
|
|
202
|
+
// Route/Tool ENTRY_POINT_OF edges are created after process extraction
|
|
203
|
+
// and point Route/Tool→Process, so they never land here. These roots must
|
|
204
|
+
// survive the global heuristic top-200 budget on large polyglot repos.
|
|
169
205
|
const entryPointCandidates = [];
|
|
170
206
|
for (const node of graph.iterNodes()) {
|
|
171
207
|
if (!symbolTypes.has(node.label))
|
|
@@ -182,17 +218,22 @@ const findEntryPoints = (graph, reverseCallsEdges, callsEdges) => {
|
|
|
182
218
|
// Calculate entry point score using new scoring system
|
|
183
219
|
const { score: baseScore, reasons } = calculateEntryPointScore(node.properties.name, (node.properties.language ?? SupportedLanguages.JavaScript), node.properties.isExported ?? false, callers.length, callees.length, filePath);
|
|
184
220
|
let score = baseScore;
|
|
221
|
+
const explicit = explicitEntryPointIds.has(node.id);
|
|
222
|
+
if (explicit)
|
|
223
|
+
reasons.push('graph-entry-point');
|
|
185
224
|
const astFrameworkMultiplier = node.properties.astFrameworkMultiplier ?? 1.0;
|
|
186
225
|
if (astFrameworkMultiplier > 1.0) {
|
|
187
226
|
score *= astFrameworkMultiplier;
|
|
188
227
|
reasons.push(`framework-ast:${node.properties.astFrameworkReason || 'decorator'}`);
|
|
189
228
|
}
|
|
190
|
-
if (score > 0) {
|
|
191
|
-
entryPointCandidates.push({ id: node.id, score, reasons });
|
|
229
|
+
if (explicit || score > 0) {
|
|
230
|
+
entryPointCandidates.push({ id: node.id, score, reasons, explicit });
|
|
192
231
|
}
|
|
193
232
|
}
|
|
194
|
-
//
|
|
195
|
-
|
|
233
|
+
// Rank each tier independently, then interleave them. This retains the
|
|
234
|
+
// explicit-root guarantee without letting a large compiler-backed package
|
|
235
|
+
// starve every heuristic root before the trace budget is reached.
|
|
236
|
+
const sorted = entryPointCandidates.sort(explicitFirst((candidate) => candidate.explicit, (a, b) => b.score - a.score));
|
|
196
237
|
// DEBUG: Log top candidates with new scoring details
|
|
197
238
|
if (sorted.length > 0 && isDev) {
|
|
198
239
|
logger.info(`[Process] Top 10 entry point candidates (new scoring):`);
|
|
@@ -204,9 +245,11 @@ const findEntryPoints = (graph, reverseCallsEdges, callsEdges) => {
|
|
|
204
245
|
logger.info(` score: ${c.score.toFixed(2)} = [${c.reasons.join(' × ')}]`);
|
|
205
246
|
});
|
|
206
247
|
}
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
.
|
|
248
|
+
const explicit = sorted.filter((candidate) => candidate.explicit);
|
|
249
|
+
const heuristic = sorted
|
|
250
|
+
.filter((candidate) => !candidate.explicit)
|
|
251
|
+
.slice(0, HEURISTIC_ENTRY_POINT_BUDGET);
|
|
252
|
+
return interleaveTiers(explicit, heuristic).map((candidate) => candidate.id);
|
|
210
253
|
};
|
|
211
254
|
// ============================================================================
|
|
212
255
|
// HELPER: Trace from entry point (BFS)
|
|
@@ -262,21 +305,24 @@ const traceFromEntryPoint = (entryId, callsEdges, config) => {
|
|
|
262
305
|
* Merge traces that are subsets of other traces.
|
|
263
306
|
* Keep longer traces, remove redundant shorter ones.
|
|
264
307
|
*/
|
|
265
|
-
const deduplicateTraces = (traces) => {
|
|
308
|
+
const deduplicateTraces = (traces, explicitEntryPointIds = new Set()) => {
|
|
266
309
|
if (traces.length === 0)
|
|
267
310
|
return [];
|
|
268
311
|
// Sort by length descending
|
|
269
312
|
const sorted = [...traces].sort((a, b) => b.length - a.length);
|
|
270
313
|
const unique = [];
|
|
314
|
+
// Cache each kept trace's join key so the redundancy scan below doesn't
|
|
315
|
+
// recompute `existing.join('->')` on every comparison.
|
|
316
|
+
const uniqueKeys = [];
|
|
271
317
|
for (const trace of sorted) {
|
|
272
|
-
// Check if this trace is a subset of any already-added trace
|
|
273
318
|
const traceKey = trace.join('->');
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
if (!
|
|
319
|
+
// Explicit entry points dedupe on exact equality; heuristic traces are
|
|
320
|
+
// dropped when a longer kept trace already contains them as a substring.
|
|
321
|
+
const exactOnly = explicitEntryPointIds.has(trace[0]);
|
|
322
|
+
const isRedundant = uniqueKeys.some((existingKey) => exactOnly ? existingKey === traceKey : existingKey.includes(traceKey));
|
|
323
|
+
if (!isRedundant) {
|
|
279
324
|
unique.push(trace);
|
|
325
|
+
uniqueKeys.push(traceKey);
|
|
280
326
|
}
|
|
281
327
|
}
|
|
282
328
|
return unique;
|
|
@@ -295,12 +295,7 @@ export declare const deleteNodesForFile: (filePath: string, dbPath?: string) =>
|
|
|
295
295
|
}>;
|
|
296
296
|
/**
|
|
297
297
|
* Chunk size for {@link deleteNodesForFiles}. 200 paths keeps each
|
|
298
|
-
* statement ~13KB
|
|
299
|
-
* still collapses from ~13,000 statements to 124: 31 statements per chunk
|
|
300
|
-
* (1 CodeEmbedding join-delete + 30 filePath-bearing node tables — the
|
|
301
|
-
* 32-table NODE_TABLES roster minus Community/Process) × 4 chunks. The
|
|
302
|
-
* original "~40" claim under-counted the per-chunk statement fan-out
|
|
303
|
-
* (tri-review 4669518496 accuracy sweep).
|
|
298
|
+
* statement ~13KB while batching one delete per file-backed table.
|
|
304
299
|
*/
|
|
305
300
|
export declare const DELETE_FILES_CHUNK_SIZE = 200;
|
|
306
301
|
/**
|
|
@@ -320,9 +315,7 @@ export declare const DELETE_FILES_CHUNK_SIZE = 200;
|
|
|
320
315
|
* binder error on the embedding join-delete: a DB created without
|
|
321
316
|
* EMBEDDING_SCHEMA cannot own embedding rows, so skipping that one
|
|
322
317
|
* statement is sound, while failing would brick every incremental run on
|
|
323
|
-
* such a DB until `--force`.
|
|
324
|
-
* multi-label join: 1 embedding join-delete + 30 node-table deletes = 31
|
|
325
|
-
* (the rejected per-label fallback shape would have been 19 + 30 = 49).
|
|
318
|
+
* such a DB until `--force`.
|
|
326
319
|
* Singleton-connection only: the analyze writeback owns the write lock,
|
|
327
320
|
* and `queryAndDrain` routes through `withConnLock` for it (the WAL
|
|
328
321
|
* checkpoint driver is live during this).
|
|
@@ -381,6 +374,24 @@ export declare const queryImportersBatch: (targetFilePaths: readonly string[], o
|
|
|
381
374
|
export declare const deleteAllCommunitiesAndProcesses: () => Promise<{
|
|
382
375
|
nodesDeleted: number;
|
|
383
376
|
}>;
|
|
377
|
+
/**
|
|
378
|
+
* Drop every externally-declared dependency node (and, via DETACH, its
|
|
379
|
+
* edges). Used at the start of an incremental writeback: external nodes have
|
|
380
|
+
* no filePath, so `deleteNodesForFiles` can never remove them and the
|
|
381
|
+
* file-keyed write set can never refresh them. The standalone ingest phase
|
|
382
|
+
* regenerates the full external surface every run and
|
|
383
|
+
* `extractChangedSubgraph` re-includes it (`isExternalNode`), so
|
|
384
|
+
* delete-all-then-rebuild keeps first-referenced externals from dangling
|
|
385
|
+
* their edges — same contract as Community/Process. Crash-recovery matches
|
|
386
|
+
* INJECTS: delete-then-COPY is not atomic, and the `incrementalInProgress`
|
|
387
|
+
* dirty flag forces a full rebuild if we die between them.
|
|
388
|
+
*
|
|
389
|
+
* Every external label is backticked unconditionally so this table list stays
|
|
390
|
+
* safe even if it diverges from BACKTICK_TABLES in the future.
|
|
391
|
+
*/
|
|
392
|
+
export declare const deleteAllExternalNodes: () => Promise<{
|
|
393
|
+
nodesDeleted: number;
|
|
394
|
+
}>;
|
|
384
395
|
/**
|
|
385
396
|
* Drop every interprocedural `TAINT_PATH` relationship (#2084 M4 U6). Used at
|
|
386
397
|
* the start of an incremental `--pdg` writeback so the `taintSummaries` phase
|