Skip to content

Commit 3e22b87

Browse files
committed
feat: atomic updates
1 parent e654f0a commit 3e22b87

1 file changed

Lines changed: 7 additions & 11 deletions

File tree

infrastructure/evault-core/src/core/db/db.service.ts

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -657,17 +657,13 @@ export class DbService {
657657
}
658658
}
659659

660-
// Delete envelopes that are no longer in the payload
661-
const newOntologies = new Set(Object.keys(meta.payload));
662-
const idsToDelete = workingEnvelopes
663-
.filter((e) => !newOntologies.has(e.ontology))
664-
.map((e) => e.id);
665-
if (idsToDelete.length > 0) {
666-
await tx.run(
667-
`MATCH (e:Envelope) WHERE e.id IN $ids DETACH DELETE e`,
668-
{ ids: idsToDelete },
669-
);
670-
}
660+
// PATCH semantics: fields absent from the new payload are
661+
// left alone. Callers (notably web3-adapter) project partial
662+
// platform updates through toGlobal — if the platform only
663+
// touched one column, only one ontology reaches us, and
664+
// deleting "stale" envelopes here would clobber every other
665+
// field on the meta-envelope (e.g. wiping participantIds when
666+
// a read-receipt update arrives).
671667

672668
return {
673669
metaEnvelope: {

0 commit comments

Comments
 (0)