diff --git a/CHANGELOG.md b/CHANGELOG.md index a73fed4..372afd9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,11 @@ Full release notes with details on each version: [GitHub Releases](https://github.com/safishamsi/graphify/releases) -## 0.9.44 (unreleased) +## 0.9.45 (unreleased) + +- Fix: loading a `graph.json` that contains a hyperedge with no `id` field (the semantic extractor emits them and they persist verbatim) no longer crashes the incremental re-extract with `KeyError: 'id'`; id-less hyperedges are tolerated and retained (#2775, thanks @ousamabenyounes). + +## 0.9.44 (2026-08-15) - Feature: `graphify hook install` reads a committed `.graphifyrc` (`viz_node_limit=`) and bakes the visualization node limit into the generated git hooks, so a project-wide limit is shared via version control and survives hook regeneration; `hook status` reports it (#2760, thanks @hopstreax). The baked value uses a `${GRAPHIFY_VIZ_NODE_LIMIT:-}` default so an explicit per-run env var still wins, and `hook status` degrades gracefully on a malformed `.graphifyrc`. - Fix: `graphify install` (Claude always-on) now writes the CLAUDE.md registration into `$CLAUDE_CONFIG_DIR` when that env var relocates the Claude profile, instead of always mutating the default `~/.claude/CLAUDE.md` (part of #2694, thanks @AromalBiju1). diff --git a/tests/test_hypergraph.py b/tests/test_hypergraph.py index 10a57e9..a520809 100644 --- a/tests/test_hypergraph.py +++ b/tests/test_hypergraph.py @@ -151,6 +151,26 @@ def test_attach_hyperedges_tolerates_id_less_persisted(): assert len(G.graph["hyperedges"]) == 2 +def test_attach_hyperedges_tolerates_many_id_less_persisted(): + """The real corpus had 183/234 persisted hyperedges id-less: all of them must + load without crashing and be retained (#2775).""" + G = nx.DiGraph() + G.graph["hyperedges"] = [ + {"nodes": ["a", "b"], "type": "project", "attributes": {}} for _ in range(5) + ] + attach_hyperedges(G, [{"id": "flow_a", "nodes": ["A", "B"]}]) + assert len(G.graph["hyperedges"]) == 6 # 5 id-less retained + 1 appended + + +def test_attach_hyperedges_treats_empty_id_as_id_less(): + """An empty-string id is falsy, so it is treated the same as a missing id: + it seeds nothing into the dedup set and does not crash.""" + G = nx.DiGraph() + G.graph["hyperedges"] = [{"id": "", "nodes": ["a", "b"], "type": "project"}] + attach_hyperedges(G, [{"id": "flow_a", "nodes": ["A", "B"]}]) + assert len(G.graph["hyperedges"]) == 2 + + # --------------------------------------------------------------------------- # 3. to_json includes hyperedges key # ---------------------------------------------------------------------------