Skip to content

feat(database): implement explicit atomic single-record mutations - #33

Merged
Upd4ting merged 6 commits into
mainfrom
feat/atomic-single-record-mutation
Sep 14, 2026
Merged

Upd4ting merged 6 commits into
mainfrom
feat/atomic-single-record-mutation

Conversation

@Upd4ting

@Upd4ting Upd4ting commented Sep 14, 2026

Copy link
Copy Markdown
Member

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.0 and 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

  • Fresh checkout installation and pnpm install --frozen-lockfile: passed.
  • pnpm build: passed.
  • GitHub CI: 202 passing through 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.

@Upd4ting
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.
@Upd4ting
Upd4ting merged commit fb052f9 into main Sep 14, 2026
2 checks passed
@Upd4ting
Upd4ting deleted the feat/atomic-single-record-mutation branch September 14, 2026 22:51
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