Skip to content

graphify update . replaces a merged doc+code graph with a code-only rebuild (-37% nodes, -74% edges, labels lost) - no shrink guard on the watch path, and its backup step overwrites a same-day snapshot #2053

Closed

Description

@WizardMag1

Summary

On a mixed corpus (personal knowledge vault, ~2,266 docs + ~736 code files) with a completed full build (AST + semantic), running the bare CLI graphify update . replaced the curated merged graph with a code-weighted rebuild:

before (full build) after graphify update .
nodes 29,670 18,536
edges 80,239 21,227
communities labeled (named) 1,970 numeric

Exit code 0, no warning that content fidelity or graph size changed. .graphify_labels.json was overwritten with numeric placeholders and GRAPH_REPORT.md regenerated against the degraded graph.

This looks like the whole-graph-scale version of #2014 (which reports the per-file semantic→heading downgrade on the same path). Filing separately because two additional failure modes are visible here:

1. The shrink guard does not engage on the watch/update write path

The #479 shrink guard refuses to shrink graph.json on the export path, and #1951 extended protection to incomplete extract runs — but the watch._rebuild_code path (which the CLI graphify update uses; all its log lines are prefixed [graphify watch]) wrote a graph 37% smaller in nodes and 74% smaller in edges without triggering anything.

The log also self-contradicts: the fail-closed message says it kept 22,816 nodes from files that left the corpus, but the final rebuilt graph has 18,536 nodes total:

[graphify watch] fail-closed: kept 22816 node(s) from 40 file(s) that left the scan corpus but still exist on disk (ignore rules or filters changed?). Run a full re-extraction to purge them if the exclusion is intentional.
[graphify] backed up curated graph (4 files) -> 2026-07-20/
[graphify watch] Skipped graph.html: Graph has 18536 nodes - too large for HTML viz (limit: 5000). Use --no-viz, raise GRAPHIFY_VIZ_NODE_LIMIT, or reduce input size.
[graphify watch] Rebuilt: 18536 nodes, 21227 edges, 1970 communities
[graphify watch] graph.json and GRAPH_REPORT.md updated in graphify-out
Code graph updated. For doc/paper/image changes run /graphify --update in your AI assistant.

2. The pre-write backup overwrites an existing same-day snapshot

The backup step writes to a date-named directory (graphify-out/2026-07-20/). A snapshot of the just-finished full build already existed there (created hours earlier the same day). The update's backup overwrote it.

In this run that was survivable only by luck: the files it overwrote the snapshot with were the same pre-update curated files, so recovery was possible. But the general shape is bad — one graphify update run can degrade the live graph and destroy the most recent independent backup in the same operation. A time-based or uniquified suffix (2026-07-20-020347/ or 2026-07-20-2/) would fix it.

Repro

  1. Mixed docs+code corpus; full build via the Claude Code skill (AST pass + semantic extraction through an OpenAI-compatible backend). Result: 29,670 nodes / 80,239 edges, communities labeled.
  2. graphify update . from the corpus root (no flags).
  3. Compare node/edge counts and .graphify_labels.json before/after.

Environment

  • graphify 0.9.19 (pip package graphifyy, installed via uv tool install)
  • Windows 11 Pro, Python from the uv tool venv
  • Corpus: ~4,900 files total (Obsidian-style vault + tools/ code)

Suggestions

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions