Skip to content

Revise node attributes after sealing while keeping provenance - #7548

Draft
agoscinski wants to merge 3 commits into
aiidateam:mainfrom
agoscinski:feat/node-revision
Draft

Revise node attributes after sealing while keeping provenance#7548
agoscinski wants to merge 3 commits into
aiidateam:mainfrom
agoscinski:feat/node-revision

Conversation

@agoscinski

Copy link
Copy Markdown
Collaborator

Allows to change the nodes attributes after sealing while the provenance is tracked. A new node is created with a link from the old one. One can reference the nodes individually by a uuid or by the lineage uuid and a version number. My main motivation is to stop this setup vs configure split in the computer which seamed always arbitrary.

Example

from aiida import load_profile, orm

load_profile()

original = orm.Dict({'temperature': 300, 'pressure': 1.0}).store()

revision_one = original.revise()
revision_one.set_dict({'temperature': 320, 'pressure': 1.0})
revision_one.store()

revision_two = revision_one.revise()
revision_two.set_dict({'temperature': 320, 'pressure': 1.5})
revision_two.store()

# Access individual versions through the lineage-navigation interface.
lineage_uuid = revision_two.base.versions.lineage_uuid
first = revision_two.base.versions.first
second = revision_two.base.versions.get(2)
head = original.base.versions.head
assert first.pk == original.pk
assert second.pk == revision_one.pk
assert head.pk == revision_two.pk
assert revision_one.base.versions.previous.pk == original.pk
assert revision_one.base.versions.next.pk == revision_two.pk

# A lineage UUID can be combined with ``version`` to load a specific
# immutable node. Omitting ``version`` loads the current lineage head.
loaded_first = orm.load_node(uuid=lineage_uuid, version=1)
loaded_second = orm.load_node(lineage_uuid=lineage_uuid, version=2)
loaded_head = orm.load_node(lineage_uuid=lineage_uuid)
assert loaded_first.pk == original.pk
assert loaded_second.pk == revision_one.pk
assert loaded_head.pk == revision_two.pk

print(f'Lineage UUID: {lineage_uuid}')
print(f'Created versions: {[node.pk for node in revision_two.base.versions.all()]}')
print(f'Loaded version 1: pk={loaded_first.pk}, uuid={loaded_first.uuid}')
print(f'Loaded version 2: pk={loaded_second.pk}, uuid={loaded_second.uuid}')
print(f'Loaded head: pk={loaded_head.pk}, version={loaded_head.base.versions.number}')
Lineage UUID: f3418af4-ef5b-4cdc-87c3-11009d4b5b20
Created versions: [7, 8, 9]
Loaded version 1: pk=7, uuid=f3418af4-ef5b-4cdc-87c3-11009d4b5b20
Loaded version 2: pk=8, uuid=c9f46ec5-35fa-4749-a161-84bcb7545086
Loaded head: pk=9, version=3
data-revisions

Introduce NEXT_VERSION links and lineage metadata for immutable
copy-on-write revisions of Data nodes.

Expose version navigation, explicit lineage loading, and query support
for version, lineage_uuid, and is_head. Add migrations and regression
 coverage for storage, graph traversal, archive import, and CLI
traversal rules.
Cover the confirmed Data-only revision scope by checking that process
nodes cannot be revised.

Add SQLite DOS migration coverage for the versioned-node schema changes,
including unique constraint enforcement and downgrade cleanup.
@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: QUIET

Plan: Pro Plus

Run ID: 5f9b7799-f026-4f9f-9bb3-903ab2ee35aa

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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