Skip to content

feat(export): record extractor backend/model in graph.json (#2077)#2140

Open
HerenderKumar wants to merge 1 commit into
Graphify-Labs:v8from
HerenderKumar:provenance-graph-json-2077
Open

feat(export): record extractor backend/model in graph.json (#2077)#2140
HerenderKumar wants to merge 1 commit into
Graphify-Labs:v8from
HerenderKumar:provenance-graph-json-2077

Conversation

@HerenderKumar

Copy link
Copy Markdown
Contributor

Fixes #2077

Right now graph.json doesn't record which backend or model produced it. If you run a few models over the same corpus, the graphs can come out indistinguishable, and afterwards there's no reliable way to tell which model made which graph.

This stamps a small extractor block into graph.json (right next to built_at_commit), filled from the extract command's --backend / --model / --mode:

"extractor": {
  "backend": "ollama",
  "model": "gemma4:12b",
  "graphify_version": "0.9.25",
  "mode": "deep"
}

Two things worth calling out:

  • It's only written when there's actually something to record, so plain AST runs (no backend/model) keep the exact same graph.json schema as before.
  • If a later step rewrites graph.json without passing these — community labeling or watch — the existing block is carried forward instead of being wiped. That matters because the tool tells you to run cluster-only right after extract, and that step rewrites the file.

Checked it end-to-end: grep gemma4 graph.json now finds the model, and it's still there after a cluster-only relabel.

Tests: three new cases in tests/test_export.py — records provenance, leaves the schema alone when there's no identity, and carries the block forward on relabel. Export + related suites pass (176 passed).

…raphify-Labs#2077)

graph.json carried no record of which backend or model produced it, so
model-vs-model comparisons were unverifiable after the fact and identical
node/edge counts across runs were indistinguishable — a benchmark had to be
discarded over exactly this.

`to_json` now stamps a top-level `extractor` block alongside `built_at_commit`
with backend, model, graphify_version and mode, threaded from the extract
command's `--backend`/`--model`/`--mode`. The block is only written when there
is extractor identity to record, so plain AST runs keep the existing schema.
A re-write that supplies no new provenance (community labeling via
`cluster-only`, watch) carries forward the block already on disk so the
subsequent labeling pass the tool prompts for doesn't strip attribution.
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.

Record the backend and model in graph.json — a graph currently cannot be attributed to what produced it

1 participant