Skip to content

Read all node and group ids from JSON as 64-bit numbers - #557

Merged
paceholder merged 3 commits into
fix-delete-node-idfrom
fix-id-json-reads
Nov 23, 2026
Merged

paceholder merged 3 commits into
fix-delete-node-idfrom
fix-id-json-reads

Conversation

@paceholder

@paceholder paceholder commented Nov 23, 2026 •

Copy link
Copy Markdown
Owner

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation/refactoring

Description

Follow-up to #556 (the branch fix-delete-node-id; this PR is based on it, so the diff shows only the new commits until #556 is merged).

QJsonValue::toInt() returns 0 for a number above the int range, so a node or group id of 2^31 or more was lost. #556 fixed the undo commands and the connection ids. This PR fixes the remaining reads:

  • BasicGraphicsScene: jsonValueToNodeId, the node lookup and the old id in loadItems(), and the node ids of a group in restoreGroup()
  • DataFlowGraphicsScene: jsonValueToGroupId and the node ids of a group on load
  • DataFlowGraphModel::loadNode

All of them now use jsonValueToUInt32(). No id read uses toInt() any more. The last commit adds one line to AGENTS.md for this rule.

Commits, each builds and passes on its own:

  1. Read the remaining node and group ids from JSON as 64-bit numbers
  2. Test that scene load and group restore keep node ids above the int range. Both tests fail on the source before commit 1: the group is not restored, and DataFlowGraphModel::load does not contain the nodes.
  3. Document how to read ids from JSON

The two reads in DataFlowGraphicsScene::load() have no test, because that function opens a file dialog.

Testing

  • Qt version tested: Qt 6.12.0, macOS arm64 (Apple Clang), offscreen platform
  • Existing tests still pass (897 assertions in 85 test cases)
  • Added tests for new functionality
  • Not tested: Qt 5, Windows. CI covers them.

Breaking changes?

No. Ids below 2^31 are read as before. Ids that were lost before are now kept.

Related issue

Follow-up to #556. Related: #554

@paceholder
paceholder added this pull request to stack #558 November 23, 2026 10:02
Scene load, group restore and DataFlowGraphModel::loadNode still used
QJsonValue::toInt(). It returns the default value for a number above the
int range, so an id of 2^31 or more was lost. Use jsonValueToUInt32(), as
the undo commands do.
Without the previous change, the group is not restored and the
DataFlowGraphModel does not contain the loaded nodes.
@paceholder
paceholder merged commit e8d6c47 into master Nov 23, 2026
5 checks passed
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.

1 participant