feat(neo4j): Neo4j graph output, schema contract, and incremental Bolt writer#152
Open
rahlk wants to merge 1 commit into
Open
feat(neo4j): Neo4j graph output, schema contract, and incremental Bolt writer#152rahlk wants to merge 1 commit into
rahlk wants to merge 1 commit into
Conversation
Port the codeanalyzer-typescript 0.4.0 Neo4j feature to Java with the same
arg entrypoints:
--emit json|neo4j|schema (default json)
--app-name, --neo4j-uri, --neo4j-user, --neo4j-password, --neo4j-database
New com.ibm.cldk.neo4j package:
- GraphProjector: pure projection of the symbol table (+ level-2 call graph)
to graph rows. Type/Callable share a :Symbol identity; call sites, fields,
parameters, variables, enum constants, record components are first-class
nodes; annotations/packages are shared; entrypoints are a marker label;
every unit-owned node carries a _unit provenance prop.
- CypherWriter: self-contained graph.cypher snapshot (constraints, scoped
wipe, batched UNWIND/MERGE).
- BoltWriter: live incremental push over Bolt — diffs each compilation unit's
content_hash, replaces only changed units (idempotent MERGE), prunes
vanished units on a full run. Uses neo4j-java-driver 4.4.x (JDK 11/native).
- SchemaCatalog + Schema: the in-repo graph contract (labels, relationships,
typed properties, DDL); --emit schema serializes it to schema.json.
Tests:
- Neo4jSchemaConformanceTest (no container): anti-drift guard asserting the
projector never emits a label/rel/property the catalog doesn't declare, and
that schema.neo4j.json is current.
- Neo4jBoltWriterTest (opt-in, Testcontainers Neo4j): full push, idempotent
re-push, and orphan pruning against a real database. Runs only when
RUN_CONTAINER_TESTS is set.
Docs/release/packaging:
- README: install one-liner + Neo4j graph output section + refreshed --help.
- release.yml: publish codeanalyzer.jar, schema.json and the installer as
release assets, with cargo-dist-style release notes.
- packaging/install/codeanalyzer-installer.sh: curl/wget installer that fetches
the jar and drops a `codeanalyzer` launcher on PATH.
- neo4j-schema.drawio: diagram of the emitted property-graph schema.
- schema.neo4j.json: checked-in graph contract. Bump version to 2.4.0.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Ports the codeanalyzer-typescript Neo4j feature to Java, with the same CLI entrypoints.
codeanalyzercan now project the analysis IR into a Neo4j property graph instead ofanalysis.json:--emit neo4j→ writes a self-containedgraph.cyphersnapshot, or (with--neo4j-uri) pushes incrementally to a live Neo4j over Bolt.--emit schema→ emits the machine-readable graph contract (schema.json).New flags:
--emit,--app-name,--neo4j-uri,--neo4j-user,--neo4j-password,--neo4j-database.What's inside
com.ibm.cldk.neo4jpackageGraphProjector— pure projection of the symbol table (+ level-2 call graph) to graph rows.Type/Callableshare a:Symbolidentity; call sites, fields, parameters, variables, enum constants and record components are first-class nodes; annotations/packages are shared; entrypoints are a marker label; every unit-owned node carries a_unitprovenance property.CypherWriter— self-containedgraph.cyphersnapshot (constraints, scoped wipe, batchedUNWIND … MERGE).BoltWriter— live incremental push over Bolt: diffs each compilation unit'scontent_hash, replaces only changed units (idempotentMERGE), prunes vanished units on a full run. Usesneo4j-java-driver4.4.x (kept JDK 11 / native-image compatible).SchemaCatalog+Schema— the in-repo graph contract (labels, relationships, typed properties, DDL);--emit schemaserializes it.Tests
Neo4jSchemaConformanceTest(no container) — anti-drift guard: the projector never emits a label/relationship/property the catalog doesn't declare, andschema.neo4j.jsonis current.Neo4jBoltWriterTest(opt-in, Testcontainers Neo4j) — full push, idempotent re-push, and orphan pruning against a real database. Runs only whenRUN_CONTAINER_TESTSis set.Docs / release / packaging
--help.release.yml: publishescodeanalyzer.jar,schema.jsonand the installer as release assets, with cargo-dist-style release notes.packaging/install/codeanalyzer-installer.sh: curl/wget installer that fetches the jar and drops acodeanalyzerlauncher onPATH.neo4j-schema.drawio: diagram of the emitted property-graph schema.schema.neo4j.json: checked-in graph contract. Version bumped 2.3.8 → 2.4.0.Verification
compileJava/compileTestJavaclean;spotlessCheckclean.--emit schemaproduces the contract;--emit neo4jproduces a validgraph.cypheron thecall-graph-testfixture.Neo4jSchemaConformanceTestpasses.RUN_CONTAINER_TESTS=1 ./gradlew test.