Skip to content

Write the edges the schema promises and delete the ones it lied about - #29

Merged
Phoenixrr2113 merged 1 commit into
mainfrom
fix/batch-three-edge-truthfulness
Aug 21, 2026
Merged

Phoenixrr2113 merged 1 commit into
mainfrom
fix/batch-three-edge-truthfulness

Conversation

@Phoenixrr2113

Copy link
Copy Markdown
Owner

What this fixes

Batch three, final wave: edge-type truthfulness. Seven edge types were declared in the schema but never written anywhere. Three had real data behind them and are now implemented; four were vaporware and are now removed.

Implemented

  • EXPORTS: file to exported top-level declaration, across every language plugin. The first implementation leaked false edges (class members inherit the exported flag; Python marks nested functions by naming convention); both are excluded now with tests locking the exact fixtures that caught them.
  • IMPORTS_SYMBOL: importing file to the imported symbol at its origin, following barrel chains to the declared name. A declaration-merged name (class plus interface sharing a name) gets one edge per merged declaration, which is the truthful cardinality; documented and locked by test. MATCH-based writes drop silently for unparsed targets and never create stub nodes.
  • PARENT_SECTION: markdown section nesting from heading levels. A dead, never-called hierarchy function from the original author was resurrected, rekeyed to how sections are actually identified, and wired in. Incremental reindexing of changed markdown now refreshes sections the same way code files are refreshed, fixing stale hierarchy edges the review round caught.

Removed

INSTANTIATES, HAS_SECTION, CONTAINS_CODE, LINKS_TO: gone from the type union, dead Cypher deleted, and a stale compiled Kuzu driver still carrying INSTANTIATES DDL purged from dist (the graph package build now cleans its output first). Document structure uses CONTAINS, stated at the write site. A compile-time invariant fails the build if any removed label is reintroduced.

Documentation truthfulness

The live MCP query tool's description advertised the old seven-edge list; it now lists the real edge set and is locked to the EdgeLabel union by a doc-consistency test. SAID is documented as what it is: a type value on RELATES_TO edges (the deliberate Graphiti-style design), not an edge label. CLAUDE.md and the markdown plugin README corrected to match.

Review process

One adversarial round of live-index attacks found five defects in the first implementation: two false-EXPORTS classes, the merged-name cardinality question (resolved by amending the contract, since both edges are semantically correct), stale markdown hierarchy after incremental reindex, and the stale dist DDL. All fixed and re-verified against the reviewer's own attack scripts: 20 of 21 assertions pass, the one failure being the script's outdated one-edge assertion superseded by the documented cardinality.

Verification

  • pnpm turbo build 21/21, pnpm turbo test 35/35 (plugin-markdown gained test infrastructure), pnpm release:check passes.
  • Test counts: core 254, graph 88, types 16, plugin-markdown 12, mcp-server 77.

Ledger

  • IMPORTS_SYMBOL adds one more cross-file edge type that pins stale symbol nodes (the pre-existing zombie hazard); further ammunition for the node-identity batch.
  • Markdown section nodes deleted from a document between indexes were already stale before this PR; the new refresh path fixes edges and nodes for changed files.

🤖 Generated with Claude Code

Three declared edge types now actually exist. EXPORTS connects each file
to its exported top-level declarations across every language plugin,
excluding class members and nested functions, which previously inherited
the flag and produced false edges. IMPORTS_SYMBOL connects an importing
file to the imported symbol at its origin, following barrel chains to
the declared name; a declaration-merged name gets one edge per merged
declaration, which is the truthful cardinality, documented and locked.
PARENT_SECTION nests markdown sections by heading level, and incremental
reindexing of a changed markdown file now refreshes its sections instead
of leaving stale hierarchy edges behind.

Four never-implemented edge types (INSTANTIATES, HAS_SECTION,
CONTAINS_CODE, LINKS_TO) are removed from the schema, their dead Cypher
deleted, and a stale compiled Kuzu driver still carrying INSTANTIATES
DDL is purged from dist, with the graph package build now cleaning its
output first. Document structure stays on CONTAINS, stated where it is
written. The MCP query tool's description and the docs now list the
real edge set, and SAID is described as what it is: a type value on
RELATES_TO, not an edge label.

One adversarial review round found five defects in the first
implementation, all reproduced by live-index attacks and all fixed and
re-verified against the same scripts.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Aug 21, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
v0-landing-page-build Ready Ready Preview, v0 Aug 21, 2026 7:43pm

@Phoenixrr2113
Phoenixrr2113 merged commit a0c212f into main Aug 21, 2026
12 checks passed
@Phoenixrr2113
Phoenixrr2113 deleted the fix/batch-three-edge-truthfulness branch August 21, 2026 19:49

This branch was successfully deployed

1 active deployment
Preview — 9e4325c5 Deployed Aug 21, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant