BetaLenzon is in beta — the Free tier is 100% free while we're in beta (bring your own Anthropic key, public repos).See plans →
Lenzon

Graphify-Labs/graphify PR #1868 — Preserve semantic edges across re-extractions — PR #1868

Graphify-Labs/graphify · pull request #1868 ·

Loading…

Transcript

PlainEnglish

Welcome. Today we're walking through pull request 1868 for Graphify — a fix that preserves semantic edges across re-extractions. This is a focused change touching three files, adding 48 lines and removing 12.

PlainEnglish

Here's what we're doing. The primary goal is to preserve semantic edges when a source file is re-extracted. To get there, we're tagging AST-extracted edges with a provenance marker and scoping edge eviction to only the AST tier during rebuilds. And we're keeping deletion-driven eviction provenance-blind — that boundary stays clean.

PlainEnglish

Let's talk about why this fix exists. Before this change, when a Markdown document with both AST and semantic edges got re-extracted, every edge from that source was evicted — including LLM-generated semantic edges that the AST pass couldn't regenerate. That silently lost knowledge while the concept nodes survived, leaving the graph inconsistent. After this PR, only AST edges are evicted during re-extraction. Semantic edges survive until a semantic pass explicitly updates them.

Architecture

Here's where the changes live. In the graphify module, extract dot py now tags edges with an origin marker, and watch dot py implements the tier-scoped eviction logic. The test suite adds validation for the new behavior. Let's walk through each change.

Architecture

First change: in extract dot py, we tag every edge extracted by the AST pass with an underscore origin marker set to ast. This mirrors the node-level provenance tracking introduced in an earlier pull request and gives the watch system the signal it needs to distinguish AST edges from semantic edges during rebuilds.

Architecture

Next, in watch dot py, we decouple edge eviction from node eviction. Before, both deleted and rebuilt sources triggered edge eviction. Now, edge eviction source identities tracks only deleted sources. Rebuilt sources are handled per-edge with a tier check — that's the key to preserving semantic edges.

Architecture

Here's the tier check itself. For each edge, if the source identity is in the rebuilt set and the edge has an underscore origin marker equal to ast, we evict it. Semantic edges, which lack the marker, pass through and are preserved. That's the core of the fix — tier-scoped ownership.

Architecture

And here's the constraint we respected. Deletion-driven eviction remains provenance-blind — when a source is deleted, all its edges are evicted regardless of tier. This maintains fail-closed semantics for data integrity and keeps the boundary between rebuild and deletion logic clean.

Architecture

The test suite now includes a parametrized test covering both full-update and incremental-doc-update scenarios. It explicitly validates that semantic edges survive re-extraction while stale AST edges are evicted, and it covers both rebuild and deletion paths.

PlainEnglish

After this PR lands, the knowledge graph stays consistent. Semantic edges like semantically similar to relations are preserved when their source file undergoes AST-only re-extraction. Only AST-tier edges from that source are replaced with fresh extraction output. The graph won't lose knowledge silently anymore.

CodeQuality

We looked closely at several areas and found them solid. Edge deduplication preserves all attributes including the origin marker. Referential integrity checks confirm both source and target node IDs exist. Unmarked edges from older graphs are safely treated as semantic, providing a clean migration path. And the tier check uses dot get, so it handles missing origin markers gracefully without throwing errors.

PlainEnglish

That's pull request 1868. A focused fix that preserves semantic edges during incremental re-extractions, eliminating silent knowledge loss while respecting tier boundaries and fail-closed deletion semantics. The edge tier check lives in watch dot py, the provenance marker is applied in extract dot py, and the test validates the tier-scoped behavior. Thanks for watching.

How this was made

Lenzon read Graphify-Labs/graphify at pull request #1868 and generated this walkthrough automatically. The narration above is the transcript of what it says.

Explain a pull request from your own repo

Point Lenzon at a repo or a pull request and get a narrated walkthrough like this one.

Try it