Skip to content

Commit aab9d53

Browse files
authored
fix(neo4j): hold the graph contract at the shared 2.0.0 baseline (#221)
SCHEMA_VERSION on the graph is a shared cross-analyzer number, not this analyzer's own. codeanalyzer-typescript states the rule on its own catalog -- "SCHEMA_VERSION moves only when every analyzer re-baselines together" -- and codeanalyzer-python has stayed at 2.0.0 throughout. This analyzer had drifted off it: 2.1.0 for the L4 SDG overlay, 2.2.0 for the repository-artifact layer, then 3.0.0 when `_module` was removed. The first two were additive over labels that 2.0.0 had already reserved, and the third claimed a MAJOR re-baseline no sibling had agreed to. None was anyone else's to undo, so the number goes back to 2.0.0 and the javadoc now says the rule out loud, so the next change here is recognizable as a cross-repo decision rather than a local one. The uncomfortable half is recorded in the code rather than papered over: removing `_module` IS breaking, and while this number stays put a consumer cannot detect that removal from the version alone. The answer is a coordinated re-baseline across all three analyzers, which is what the epic exists for -- not a unilateral bump here, which is exactly how the drift started. This also stops the graph reporting 3.0.0 while analysis.json reports 2.0.0 for the same analysis, from two fields that share the name `schema_version` and version different things. All three now read 2.0.0. No behaviour change: `_module` is still absent, :JCanNode still present, the prefix-scoped purge untouched.
1 parent 07b4a3b commit aab9d53

3 files changed

Lines changed: 21 additions & 12 deletions

File tree

schema.neo4j.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"schema_version": "3.0.0",
2+
"schema_version": "2.0.0",
33
"generator": "codeanalyzer-java",
44
"marker_labels": [
55
"JEntrypoint",

src/main/java/com/ibm/cldk/neo4j/V2SchemaCatalog.java

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,29 @@
3232
* are {@code :JBodyNode} rows with {@code kind == "call"}, parameters flatten to
3333
* {@code JCallable.parameters_json}, and javadoc collapses to a {@code docstring} property.
3434
*
35-
* <p>{@code SCHEMA_VERSION} bump policy: MAJOR on a breaking change (renamed/removed label,
36-
* relationship or key), MINOR on an additive one. Stamped onto {@code :JApplication} so consumers
37-
* detect producer/consumer mismatch at runtime.
35+
* <p>{@code SCHEMA_VERSION} is the SHARED graph contract version, not this analyzer's own. It moves
36+
* only when every analyzer re-baselines together — codeanalyzer-typescript states the same rule on
37+
* its own catalog — so a change here is a cross-repo decision, not a local one. Stamped onto
38+
* {@code :JApplication} so consumers detect producer/consumer mismatch at runtime.
39+
*
40+
* <p>Bump policy once such a re-baseline happens: MAJOR on a breaking change (renamed/removed
41+
* label, relationship or key), MINOR on an additive one.
3842
*/
3943
public final class V2SchemaCatalog {
4044

4145
private V2SchemaCatalog() {}
4246

43-
// 2.1.0: additive MINOR — L4 SDG overlay (JBodyNode.var/call_node; J_PARAM_IN/J_PARAM_OUT/
44-
// J_SUMMARY, reserved at 2.0.0, now actually emitted).
45-
// 2.2.0: additive MINOR — the repository-artifact layer (#197): Artifact/Package/ConfigKey
46-
// reserved at 2.0.0, now actually emitted, plus HAS_ARTIFACT/DEFINES_CONFIG/
47-
// DECLARES_DEPENDENCY/LOCKS.
48-
public static final String SCHEMA_VERSION = "3.0.0";
47+
// Held at the shared 2.0.0 baseline. This analyzer previously moved it alone — 2.1.0 for the L4
48+
// SDG overlay, 2.2.0 for the repository-artifact layer, then 3.0.0 when `_module` was removed —
49+
// while codeanalyzer-python stayed at 2.0.0. Both of those layers were additive over labels
50+
// 2.0.0 already reserved, and none of them was a re-baseline anyone else agreed to, so the
51+
// drift was this analyzer's alone to undo.
52+
//
53+
// Consequence, recorded rather than papered over: removing `_module` IS breaking, and while this
54+
// number stays put a consumer cannot detect that removal from the version alone. The fix is a
55+
// coordinated re-baseline across all three analyzers, not a unilateral bump here — see
56+
// codellm-devkit/.github#50.
57+
public static final String SCHEMA_VERSION = "2.0.0";
4958

5059
/** Labels layered onto a node in addition to its merge + specific labels. */
5160
/**

src/test/java/com/ibm/cldk/CodeAnalyzerV2CliTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,10 @@ void emitSchemaAlwaysEmitsTheV2Catalog(@TempDir Path tmp) throws IOException {
184184
assertEquals(0, run("--emit", "schema", "-o", out.toString()));
185185
JsonObject doc = JsonParser.parseString(Files.readString(out.resolve("schema.neo4j.json")))
186186
.getAsJsonObject();
187-
assertEquals("3.0.0", doc.get("schema_version").getAsString());
187+
assertEquals("2.0.0", doc.get("schema_version").getAsString());
188188
assertEquals(0, run("--emit", "schema", "-o", out.toString(), "--schema", "v1"),
189189
"--emit schema ignores --schema");
190-
assertEquals("3.0.0", JsonParser.parseString(Files.readString(out.resolve("schema.neo4j.json")))
190+
assertEquals("2.0.0", JsonParser.parseString(Files.readString(out.resolve("schema.neo4j.json")))
191191
.getAsJsonObject().get("schema_version").getAsString());
192192
}
193193

0 commit comments

Comments
 (0)