Skip to content

feat(evault): versioned MetaEnvelopes, pruning deletes and a history API - #1175

Merged
coodos merged 4 commits into
mainfrom
feat/evault-metaenvelope-versioning
Sep 29, 2026
Merged

coodos merged 4 commits into
mainfrom
feat/evault-metaenvelope-versioning

Conversation

@coodos

@coodos coodos commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

What

In the eVault, MetaEnvelope writes no longer destroy data. Before this change, updates overwrote Envelope.value in place and removeMetaEnvelope ran DETACH DELETE on the record and its envelopes.

  • Version history. Every write appends an immutable MetaEnvelopeVersion snapshot of the record's full resulting state. This covers create, update, updateEnvelopeValue, bulk create and delete, and the snapshot is written in the same transaction as the change.
    • History is stored in separate nodes (MetaEnvelopeHistory / MetaEnvelopeVersion) keyed by (metaEnvelopeId, eName). It is not linked into the live graph, so existing reads, payloads and envelope ids don't change.
  • Delete now prunes. The record and its envelopes are relabelled PrunedMetaEnvelope / PrunedEnvelope, and a delete version is appended.
    • Every existing MetaEnvelope / Envelope query skips pruned data without any changes.
    • Duplicate-envelope cleanup also prunes now instead of deleting.
  • New query: metaEnvelopeHistory(id, first, after) returns versions newest first and still works after removal.
    • Access to a pruned record's history is decided by the ACL it last carried, so it isn't opened up to any platform token.
  • Legacy records have no history yet. They get a baseline create version from their current state on their first later write, so no data migration is needed.
  • Vault migration (copyMetaEnvelopesToNewEvaultInstance) now copies history too.
  • Indexes: a startup migration adds the history/version indexes and constraint.

The awareness outbox events are unchanged: an update still carries the full merged state, and a delete still sends a data: null tombstone.

Testing

  • pnpm --filter evault-core test --run: 283/283 pass. New coverage:
    • version sequence and snapshots
    • pruning (gone from all reads, raw data kept)
    • legacy baseline
    • duplicate pruning
    • eName isolation
    • history pagination
    • ACL on pruned history
    • the GraphQL history query after create/update/remove
  • 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: 04ac9f5f-8a24-4a74-88f0-c7fca92ba85c


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 aaee130 into main Sep 29, 2026
7 checks passed
@coodos
coodos deleted the feat/evault-metaenvelope-versioning branch September 29, 2026 13:14
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