Skip to content

Commit 7ff2edf

Browse files
committed
test(neo4j): feed project() the application object in the container suite (v2 envelope)
project() takes the V2Application envelope (app.application.id, etc.), not the raw TSApplication analyze() returns — neo4j-schema.test.ts already routes through toV2Detailed()/toV2() before calling project(), but the container-only bolt suite (never run outside Docker CI) predates the v2 envelope reshape and passed analyze()'s result straight through, crashing on `root.id` being undefined. Also bumps the suite's default analysisLevel from 1 to 2: 6078c7e gated the call-graph (incl. jelly) solve behind level >= 2 since the v2 emitter discards it at level 1 anyway, so the level-1 default silently stopped producing the TS_CALLS edges this suite's "known resolved call edge" assertion checks for.
1 parent 14dfe78 commit 7ff2edf

1 file changed

Lines changed: 13 additions & 6 deletions

File tree

test/neo4j-bolt.test.ts

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import neo4j, { type Driver } from "neo4j-driver";
1515
import { type BoltConfig, boltWriter, CONSTRAINTS, INDEXES, project } from "../src/build/neo4j";
1616
import { analyze } from "../src/core";
1717
import type { AnalysisOptions } from "../src/options";
18+
import { toV2 } from "../src/schema/v2";
1819
import { Logger } from "../src/utils";
1920

2021
const FIXTURE = path.resolve(import.meta.dir, "fixtures/sample-app");
@@ -36,7 +37,9 @@ function optsFor(overrides: Partial<AnalysisOptions> = {}): AnalysisOptions {
3637
neo4jUser: "neo4j",
3738
neo4jPassword: "",
3839
neo4jDatabase: null,
39-
analysisLevel: 1,
40+
// >= 2: the call graph (incl. jelly) solve is skipped below that level since the v2 emitter
41+
// discards it at -a 1 (#46 sibling fix, 6078c7e) — this suite asserts on TS_CALLS edges.
42+
analysisLevel: 2,
4043
graphs: ["cfg", "dfg", "pdg", "sdg"],
4144
graphFieldDepth: 3,
4245
jobs: 1,
@@ -89,7 +92,8 @@ containerSuite("neo4j bolt writer", () => {
8992
test(
9093
"full push materializes the whole graph + schema",
9194
async () => {
92-
const rows = project(await analyze(optsFor()), "sample-app");
95+
const opts = optsFor();
96+
const rows = project(toV2(await analyze(opts), opts));
9397
await boltWriter(rows, cfg, log, true);
9498

9599
// Every projected node/edge lands (the fixture has no library deps, so endpoints all resolve).
@@ -128,7 +132,8 @@ containerSuite("neo4j bolt writer", () => {
128132
test(
129133
"re-pushing identical analysis is idempotent",
130134
async () => {
131-
const rows = project(await analyze(optsFor()), "sample-app");
135+
const opts = optsFor();
136+
const rows = project(toV2(await analyze(opts), opts));
132137
await boltWriter(rows, cfg, log, true);
133138
expect(await num("MATCH (n) RETURN count(n)")).toBe(rows.nodes.length);
134139
expect(await num("MATCH ()-[r]->() RETURN count(r)")).toBe(rows.edges.length);
@@ -139,11 +144,12 @@ containerSuite("neo4j bolt writer", () => {
139144
test(
140145
"a full run prunes a module whose source vanished",
141146
async () => {
142-
const app = await analyze(optsFor());
147+
const opts = optsFor();
148+
const app = await analyze(opts);
143149
const victim = Object.keys(app.symbol_table).sort()[0];
144150
delete app.symbol_table[victim];
145151

146-
const rows = project(app, "sample-app");
152+
const rows = project(toV2(app, opts));
147153
await boltWriter(rows, cfg, log, true);
148154

149155
// The victim's nodes are gone.
@@ -175,7 +181,8 @@ containerSuite("neo4j bolt writer", () => {
175181
}
176182

177183
// A full 2.0.0 push against the same DB must detect the version mismatch and wipe the residue.
178-
const rows = project(await analyze(optsFor()), "sample-app");
184+
const opts = optsFor();
185+
const rows = project(toV2(await analyze(opts), opts));
179186
await boltWriter(rows, cfg, log, true);
180187

181188
// Exactly one :Application survives — the fresh v2 one (id set, version bumped). The 1.x app,

0 commit comments

Comments
 (0)