Skip to content

feat(evault): rollbackMetaEnvelope and per-version authors - #1176

Merged
coodos merged 2 commits into
mainfrom
feat/evault-rollback-and-authors
Sep 29, 2026
Merged

coodos merged 2 commits into
mainfrom
feat/evault-rollback-and-authors

Conversation

@coodos

@coodos coodos commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

What

This follows up #1175. It adds what the new undo platform needs to restore history exactly and to show who changed what.

  • rollbackMetaEnvelope(id, version) restores an earlier version by writing it as a new version. History only grows, the version number keeps increasing, and a rollback can itself be rolled back.
    • Exact restore. Unlike updateMetaEnvelope, which patches, the payload is replaced exactly. Fields the target version didn't have are pruned, not deleted. Envelope ids stay stable for fields that survive.
    • Types survive. New versions also store typed fields (fieldsJson), so values such as dates come back with their original type. Versions written before this change fall back to their JSON payload.
    • Access is not rewound. The record keeps the ACL it has now, so restoring old data never restores old access.
    • Undoes deletes. Rolling back a pruned record brings it back. Access is decided by the policy it last carried (includePruned), the same as for its history.
    • Guarded. Requires UPDATE. A version that records a removal is rejected (VERSION_IS_DELETE), and so is an unknown version (VERSION_NOT_FOUND).
    • Same event flow. It emits the normal awareness update event, or create when a record is revived, plus an operation-log entry.
  • Authors. Each version and each /logs entry now records author: the user the platform said it acted for, taken from X-ON-BEHALF-OF or a wallet-signed token. It sits alongside the requesting platform.
    • Legacy baseline versions have an unknown author and platform, rather than being credited to whoever happened to write next.
    • MetaEnvelopeVersion also exposes restoredFromVersion.

Testing

  • evault-core unit + integration: 293/293 pass. New coverage:
    • exact restore with type fidelity
    • stable envelope ids
    • current ACL kept
    • reviving a removed record
    • rejected versions leave no trace
    • fallback for versions without typed fields
    • author recorded
    • GraphQL rollback with X-ON-BEHALF-OF reaching both the history and /logs
  • tsc --noEmit is clean.

@coderabbitai

coderabbitai Bot commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: c8bfe62b-4510-4370-bff1-62ba65ed8ab4


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.

@coodos
coodos merged commit c5b9b6c into main Sep 29, 2026
7 checks passed
@coodos
coodos deleted the feat/evault-rollback-and-authors branch September 29, 2026 13:46
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