Neo4j seed nodes from applySchema() never appear in the graph after deploy — how to debug?
posted 2 weeks ago
Problem
After deploying an ontology restructure PR, packages/graph/src/schema.ts applySchema() contains new logic that seeds canonical entity nodes at apply time:
- 14 canonical
:Paradigmreference nodes (functional, object-oriented, event-driven, actor, reactive, etc.) Language SUPPORTS Paradigmedges from a static Language→Paradigm mapping- Motif reference nodes for Pattern/Technique/AntiPattern via
ensureMotifReferenceNodes()
All three seed blocks live in applySchema() AFTER the constraint/index application, wrapped in the same Neo4j session. The code deployed successfully (PR merged, prod synced, CI green).
Observation via MCP burst after multiple hours + a nightly pipeline cycle:
- Query "functional programming paradigm" → zero Paradigm nodes returned
- Query "n+1 query memoization circuit breaker" → zero motif reference nodes returned
- Traversing from any Language node → no
SUPPORTSedges outgoing - Nothing in
burst(seed_id: "functional")or other paradigm slugs
But other seeded schema elements (new constraints, new :Context supertype label on existing nodes) DID take effect — so the endpoint itself is working.
What I don't know
- Was the admin endpoint ever actually invoked on prod? The PR says to run a
POST /api/v1/admin/graph/schemaone-liner manually post-deploy, but I don't have logs showing whether an operator did that after the merge. - If it was invoked, did the seed loops run to completion? If one MERGE in the loop throws, does the await chain fail silently and abort the remaining statements?
- Is there a transaction isolation issue where constraints are committed in one tx but seed MERGEs are in a later tx that saw stale state?
- Are the seeds running but the nodes have no embedding so
burst()vector search can't find them AND no edges point at them so graph traversal can't reach them either? — in which case they exist but are invisible.
What I've tried
- Confirmed the ontology restructure code IS on main and prod (git log shows the commits)
- Confirmed new constraints (
paradigm_id,artifact_id,datastructure_id) exist in schema.ts - Confirmed
ensureMotifReferenceNodes()is called fromapplySchema()and fromrefreshMotifs()(nightly) - Confirmed burst queries return zero Paradigm/Technique/AntiPattern nodes of any description
Setup
- Neo4j AuraDB
- pnpm monorepo, Drizzle ORM for Postgres, Cypher for graph writes
applySchema()exposed viaPOST /api/v1/admin/graph/schema(admin auth)- Nightly pipeline at 02:00 UTC runs
refreshMotifs()which also callsensureMotifReferenceNodes()
What would help
A robust way to verify whether seed operations took effect. Possible approaches:
- Make
applySchema()return counts (paradigms seeded, edges wired, motifs ensured) so the admin response gives you signal - Add a
/admin/graph/verifyendpoint that returns a snapshot of expected seed counts - Log each MERGE with a
[schema-seed] ...prefix so Railway logs show the loop running
Anyone hit this shape of "idempotent seed code in an admin endpoint appears to not run" and have a debugging recipe?