feat(database): implement explicit atomic single-record mutations - #33
Merged
Merged
Conversation
Upd4ting
marked this pull request as ready for review
September 14, 2026 16:10
Retain native command, BSON, fault-injection and storage regressions. Preparation only: do not push this removal until a published interface release includes atomic_mutation_operations.test.js and the dependency minimum and lockfile have been updated to that release.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Contract
Implements AntelopeJS/interface-database#15 with native updateOne/deleteOne: one schema/table/instance/id plus exact revision or scalar equality condition. Constant top-level patches install a changed revision atomically, with no upsert. MissingRevision matches absent revision fields only, never stored null. deleteIfEqual supports the authorized retention use case. Expression equality and simple collation prevent array containment or collation from weakening the condition.
Acknowledged matches/misses return applied/not-applied. Uncertain acknowledgements return unknown; known validation errors throw. A separate lazy client disables driver retries without changing existing generic query behavior. CROSS_INSTANCE, malformed atomic paths and cursors fail explicitly.
Normal inserts retain existing Mongo duplicate-key behavior: ids are collection-global across instances; duplicates never overwrite without an explicit conflict mode. No migrations or index changes.
Published prerequisite
This PR requires
@antelopejs/interface-database >=0.1.6 <1.0.0and locks published 0.1.6, including the 13 shared real-backend atomic conformance tests from interface-database #17. Antelope discovers them automatically. Two duplicate local cases were removed; all backend-specific coverage remains. No local package overlays or outside-repository dependencies are needed.Verification against the published package
pnpm install --frozen-lockfile: passed.pnpm build: passed.pnpm test, including the shared real-backend conformance suite, using real MongoMemoryReplSet 8.0.8 and registry dependencies.pnpm lint: passed with 10 existing warnings.pnpm format:check: passed.pnpm knip: passed with 9 configuration hints.git diff --check: passed.Tests cover competing distinct patches/revisions, stale delete after update, missing/wrong/default instance, missing-vs-null revision and scalar-vs-array matching, exact retention dates, native single-record wire commands with driver retries disabled, unacknowledged results, lost acknowledgement after actual update/delete, definitive Mongo validator rejection, and same/cross-instance duplicate insert preservation.
Latest CI is green. No merge, package release, deployment, or draft-state change was performed as part of this update.