Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion schema.neo4j.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"schema_version": "3.0.0",
"schema_version": "2.0.0",
"generator": "codeanalyzer-java",
"marker_labels": [
"JEntrypoint",
Expand Down
27 changes: 18 additions & 9 deletions src/main/java/com/ibm/cldk/neo4j/V2SchemaCatalog.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,29 @@
* are {@code :JBodyNode} rows with {@code kind == "call"}, parameters flatten to
* {@code JCallable.parameters_json}, and javadoc collapses to a {@code docstring} property.
*
* <p>{@code SCHEMA_VERSION} bump policy: MAJOR on a breaking change (renamed/removed label,
* relationship or key), MINOR on an additive one. Stamped onto {@code :JApplication} so consumers
* detect producer/consumer mismatch at runtime.
* <p>{@code SCHEMA_VERSION} is the SHARED graph contract version, not this analyzer's own. It moves
* only when every analyzer re-baselines together — codeanalyzer-typescript states the same rule on
* its own catalog — so a change here is a cross-repo decision, not a local one. Stamped onto
* {@code :JApplication} so consumers detect producer/consumer mismatch at runtime.
*
* <p>Bump policy once such a re-baseline happens: MAJOR on a breaking change (renamed/removed
* label, relationship or key), MINOR on an additive one.
*/
public final class V2SchemaCatalog {

private V2SchemaCatalog() {}

// 2.1.0: additive MINOR — L4 SDG overlay (JBodyNode.var/call_node; J_PARAM_IN/J_PARAM_OUT/
// J_SUMMARY, reserved at 2.0.0, now actually emitted).
// 2.2.0: additive MINOR — the repository-artifact layer (#197): Artifact/Package/ConfigKey
// reserved at 2.0.0, now actually emitted, plus HAS_ARTIFACT/DEFINES_CONFIG/
// DECLARES_DEPENDENCY/LOCKS.
public static final String SCHEMA_VERSION = "3.0.0";
// Held at the shared 2.0.0 baseline. This analyzer previously moved it alone — 2.1.0 for the L4
// SDG overlay, 2.2.0 for the repository-artifact layer, then 3.0.0 when `_module` was removed —
// while codeanalyzer-python stayed at 2.0.0. Both of those layers were additive over labels
// 2.0.0 already reserved, and none of them was a re-baseline anyone else agreed to, so the
// drift was this analyzer's alone to undo.
//
// Consequence, recorded 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 fix is a
// coordinated re-baseline across all three analyzers, not a unilateral bump here — see
// codellm-devkit/.github#50.
public static final String SCHEMA_VERSION = "2.0.0";

/** Labels layered onto a node in addition to its merge + specific labels. */
/**
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/com/ibm/cldk/CodeAnalyzerV2CliTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,10 @@ void emitSchemaAlwaysEmitsTheV2Catalog(@TempDir Path tmp) throws IOException {
assertEquals(0, run("--emit", "schema", "-o", out.toString()));
JsonObject doc = JsonParser.parseString(Files.readString(out.resolve("schema.neo4j.json")))
.getAsJsonObject();
assertEquals("3.0.0", doc.get("schema_version").getAsString());
assertEquals("2.0.0", doc.get("schema_version").getAsString());
assertEquals(0, run("--emit", "schema", "-o", out.toString(), "--schema", "v1"),
"--emit schema ignores --schema");
assertEquals("3.0.0", JsonParser.parseString(Files.readString(out.resolve("schema.neo4j.json")))
assertEquals("2.0.0", JsonParser.parseString(Files.readString(out.resolve("schema.neo4j.json")))
.getAsJsonObject().get("schema_version").getAsString());
}

Expand Down