Skip to content

🔥 Remove vestigial Graph.graph_type attribute - #180

Open
elinscott wants to merge 1 commit into
scinode:mainfrom
elinscott:drop-graph-type
Open

elinscott wants to merge 1 commit into
scinode:mainfrom
elinscott:drop-graph-type

Conversation

@elinscott

Copy link
Copy Markdown
Collaborator

graph_type is vestigial. It exists in exactly three places — the Graph.__init__ argument (graph_type: str = "NORMAL"), the metadata slot to_dict() writes, and the read-back in from_dict() — and nothing reads it. This PR removes all three; from_dict() discards the key when an older payload still carries it, so stored graphs keep loading.

>>> Graph(name="g").to_dict()["metadata"]
{'graph_class': {...}}                                    # was {'graph_type': 'NORMAL', 'graph_class': {...}}
>>> Graph.from_dict({**old_payload, "metadata": {"graph_type": "NORMAL"}})   # still loads

One test added (test_from_dict_discards_stale_graph_type); suite 308 → 309 passed, 1 skipped.

Closes #179

Nothing in node-graph or aiida-workgraph ever read self.graph_type;
its only observed value was the "NORMAL" default. Drop the
constructor argument, the attribute, and its slot in
get_metadata()/to_dict(); from_dict() now discards a stored
graph_type key instead of round-tripping it, so old serialized
graphs still load.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@elinscott
elinscott marked this pull request as ready for review August 26, 2026 16:47
@elinscott
elinscott requested a review from GeigerJ2 August 26, 2026 16:48
elinscott added a commit to elinscott/aiida-workgraph that referenced this pull request Aug 26, 2026
node-graph removes Graph.graph_type (scinode/node-graph#180), so the
disjointness tripwire and the round-trip assertions still naming it
failed against the rebased declared-metadata-keys branch.

- bookkeeping keys are now graph_class, definition and pk
- the legacy-payload fixture no longer seeds graph_type

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

codecov Bot commented Aug 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.68%. Comparing base (8d85e61) to head (9707c34).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #180   +/-   ##
=======================================
  Coverage   89.68%   89.68%           
=======================================
  Files          81       81           
  Lines        8984     8990    +6     
=======================================
+ Hits         8057     8063    +6     
  Misses        927      927           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

elinscott added a commit to elinscott/node-graph that referenced this pull request Aug 27, 2026
elinsc-bot added a commit to elinscott/koopmans that referenced this pull request Aug 27, 2026
The ozone and O₂ regression snapshots recorded graph_type: NORMAL,
which the updated node-graph no longer writes into a graph's metadata,
so both test_build_workgraph checks failed on that one line.

- the two snapshots lose the graph_type line; nothing else moves
- pairs with the patched update carrying scinode/node-graph#180 and #181

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.

Graph.graph_type is never read — drop it?

1 participant