Uh oh!
There was an error while loading. Please reload this page.
docs(driver-sql): state the autonumber contract — unique and monotonic, not gapless - #8488
Conversation
…c, not gapless (#8283) Document, beside the existing "an autonumber is an immutable business identifier" sentence, what that identifier does and does not guarantee: unique and monotonic per counter, NOT gapless. A rejected write consumes the number it reserved, because getNextSequenceValue commits the reservation in its own transaction, independent of the caller's insert. Comment and changeset only — no behaviour change. Per the maintainer ruling of 2026-08-13 on #8283 (option 1: document the contract; reservation-reordering rejected, opt-in gapless mode recorded as a restart condition, not built). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VoxQqG5FiUHZKCST7KDoZC
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
📓 Docs Drift CheckThis PR changes 1 package(s): 8 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
⛔ 1 release-owned page(s) also reference the affected code. These are read-only:
|
Uh oh!
There was an error while loading. Please reload this page.
Fixes#8283
Executes the maintainer ruling of 2026-08-13 (option 1): document the contract, change nothing.
What this is
A TSDoc addition and a changeset. Nothing else.
All 45 added lines in
sql-driver.tsare comment lines; there are zero deletions and zero non-comment additions in the whole diff. Verified mechanically rather than by eye:The contract, as stated
Placed next to the existing sentence
an autonumber is an immutable business identifier(anchored by phrase — the neighbour is atsql-driver.ts:4827on this base, and line numbers there have drifted repeatedly). The new section says:(table, tenant, field, scope)keygetNextSequenceValueissues from — and NOT gapless.beforeInsert. The number is issued to no row and never re-issued; the next write gets the one after it.TK-0001, a failed insert, thenTK-0003is the contract behaving correctly.getNextSequenceValuecommits the reservation in its own transaction (runner.transactionoverparentTrx ?? this.knex), deliberately independent of the caller's insert.Accuracy note on the mechanism
I verified the mechanism against the code it sits beside rather than restating the card.
runner.transactionnests when aparentTrxis supplied, so the inside-a-caller-transaction path rolls back with the refused insert and burns nothing — which theupsertretry comment right below already records as measured. The TSDoc states the independent-commit case as the contract-relevant one and notes the nested case parenthetically, so the paragraph does not overstate what the code does.Explicitly not done
getNextSequenceValueis untouched; I did not edit that function at all, and reference it outward via{@link getNextSequenceValue}instead.content/docs/**. The author-facing half of the ruling belongs to the devx lane and is tracked in docs: the autonumber contract ruled on #8283 (unique + monotonic, NOT gapless) is absent from the author-facing pages — a driver TSDoc cannot stop the mis-promise it exists to prevent #8479, which stays open and is not addressed here.Changeset:
patchon@objectstack/driver-sql, deliberatelyReasoned rather than copied, on repo evidence:
check-empty-changeset.mjsrejects a PR that newly adds one (the 182 in the tree are grandfathered by a diff-computed exemption).patchor theskip-changesetlabel. The label is for a PR that "declares no release of its own" — the workflow's own textbook case is editing a CI-internal script.declaration: trueand noremoveComments, andinsertOnlyUpsertColumnsisprotected, so the text is emitted into the published.d.ts; and AGENTS.md frames the changeset body as the channel that reaches consumers asCHANGELOG.md— "what an upgrading agent greps".The honest counter-argument: AGENTS.md scopes changesets to feature work and functional improvement, and this is neither — that is the case for
skip-changeset. I judged the delivery channel to be the deciding factor. Flipping to the label costs one deleted file if the reviewer disagrees.Verification
pnpm --filter @objectstack/driver-sql typecheckpnpm --filter @objectstack/driver-sql testcheck:nul-bytescheck:driver-conformancecheck:changeset-gate-self-testscheck-empty-changeset/check-changeset-no-major/check-adr-0087-registrationcheck:objectui-changeset,check:test-source-alias,check:type-source-resolutionReverse verification does not apply here: there is no behaviour to revert and no diagnostic that could change colour. What I did instead was read the mechanism I describe —
getNextSequenceValue'srunnerassignment and itsrunner.transactionbody — and check the claim against the two independent places in the file that already record it as measured.check:objectui-pin-freshandcheck-dev-prereqsare red on inputs this diff does not touch (a stale.objectui-sha; a workspace needingpnpm build) — known-ambient, reported not chased.Generated by Claude Code