Skip to content

feat(database): add atomic single-record mutations - #23

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

Upd4ting merged 6 commits into
mainfrom
feat/atomic-mutation

Conversation

@Upd4ting

@Upd4ting Upd4ting commented Sep 14, 2026

Copy link
Copy Markdown
Member

Outcome

Implements the published atomic mutation contract from AntelopeJS/interface-database#15 for revision-conditional update/delete and scalar deleteIfEqual cleanup. The native single-primary-key replace function checks existence, instance, and condition together, uses hard durability, and never upserts or retries. Supplied nested fields replace their entire previous value.

Normal database write atoms reject errors/first_error, including duplicate primary keys. Scoped get retains its instance filter for reads and ordinary writes. It is not advertised as compare-and-set; only the dedicated atomic primitive supplies that guarantee.

Published prerequisite

This PR requires @antelopejs/interface-database >=0.1.6 <1.0.0 and locks registry 0.1.6. Its 13 shared real-backend atomic conformance tests are discovered automatically by Antelope. Five duplicate local cases were removed; backend-specific acknowledgement, storage, and fault coverage remains. No local overlays are required.

Verification

  • Registry installation and pnpm install --frozen-lockfile: passed.
  • pnpm build, pnpm typecheck, pnpm lint, pnpm knip, pnpm format:check: passed locally against the published interface. Lint retains three existing stream.ts max-params warnings; Knip retains configuration hints.
  • GitHub CI is green: pnpm test passed 198 tests, including shared conformance, against the disposable RethinkDB 2.4 service with published interface 0.1.6. Build, lint, format, Knip, and typecheck also passed.

Tests cover competing unequal patches, conditional deletion/update races with alternating submission order, absent versus null revision, no upsert, wrong instance, default instance, literal nested replacement/Date, duplicate insert rejection, scalar/Date equality cleanup versus refresh, malformed stages/results, and uncertainty without retry.

Acknowledgement loss uses deterministic fault injection after a real write completes, plus typed transport/indeterminate error injection. It does not simulate physical network partition or multi-node failover.

Limits

Uncertain acknowledgements and untyped write-result failures return unknown, never not-applied. Input validation and definitive typed query errors throw. Callers must reconcile unknown outcomes and never reuse revision tokens or immutable identities across incarnations. deleteIfEqual is field equality, not revision-based no-ABA protection. Ordinary multi-record writes can partially succeed before reporting errors.

No merge, release, deployment, draft-state change, or shared-database writes were performed.

@Upd4ting
Upd4ting marked this pull request as ready for review September 14, 2026 16:10
Retain native acknowledgements, declared-field and Date 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 4479732 into main Sep 14, 2026
2 checks passed
@Upd4ting
Upd4ting deleted the feat/atomic-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