refactor(neo4j): consolidate the graph schema into one source of truth (closes #15)#16
Open
rahlk wants to merge 1 commit into
Open
refactor(neo4j): consolidate the graph schema into one source of truth (closes #15)#16rahlk wants to merge 1 commit into
rahlk wants to merge 1 commit into
Conversation
closes #15) The graph contract was split across catalog.ts (labels, relationships, marker labels, version) and schema.ts (the CONSTRAINTS/INDEXES DDL), and the constraint list hand-duplicated the (mergeLabel, key) pairs already in NODE_LABELS — a second place to update whenever a label was added. - Fold the DDL into the schema module and delete the separate schema.ts; rename catalog.ts -> schema.ts to mirror src/schema/schema.ts (the IR schema). - Derive CONSTRAINTS from NODE_LABELS (one per distinct mergeLabel/key), so a new label brings its own uniqueness constraint with no second list to maintain. - Keep the curated INDEXES list co-located; export MARKER_LABELS from the barrel so consumers stop deep-importing. Behavior-preserving: same 8 constraints + 3 indexes. The only delta is cosmetic constraint naming/ordering (derived names like symbol_signature, bind variable x); Neo4j's IF NOT EXISTS matches on schema+type, so existing databases are unaffected. Guarded by the schema-conformance test; schema.neo4j.json regenerated. Follow-up (out of scope): make project.ts emission schema-driven so label tuples and property names aren't restated in code.
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.
The Neo4j graph contract was split across
catalog.ts(node labels, relationship types + endpoints, marker labels, schema version) andschema.ts(the CypherCONSTRAINTS/INDEXESDDL), and the constraint list hand-duplicated the(mergeLabel, key)pairs already declared inNODE_LABELS— a second place to update whenever a label was added. This consolidates the entire schema into one source-of-truth module mirroringsrc/schema/schema.ts: the DDL is folded in and the separateschema.tsdeleted,catalog.tsis renamed toschema.ts, the uniquenessCONSTRAINTSare now derived fromNODE_LABELS(one per distinct(mergeLabel, key), so a new label brings its own constraint with no second list to maintain), the curatedINDEXESstay co-located, andMARKER_LABELSis exported from the barrel so consumers stop deep-importing. Behavior-preserving — same 8 constraints + 3 indexes; the only delta is cosmetic constraint naming/ordering (derived names likesymbol_signature, bind variablex), and since Neo4j'sIF NOT EXISTSmatches on schema+type, existing databases are unaffected. Verified by typecheck, the schema-conformance suite (11 pass/5 skip/0 fail), aschema.neo4j.jsonregen, and a neo4j-emit smoke (graph.cypher still renders 8 constraints + 3 indexes). Git shows the move ascatalog.tsdeleted +schema.tsrewritten because the thin oldschema.tsalready occupied that path. Follow-up, out of scope: makeproject.tsemission schema-driven so label tuples/property names aren't restated in code. Closes #15.