Skip to content

test(driver-sql): autonumber survives a driver restart (#1603)#1609

Merged
xuyushun441-sys merged 1 commit into
mainfrom
test/autonumber-persistence-across-restart
Jun 6, 2026
Merged

test(driver-sql): autonumber survives a driver restart (#1603)#1609
xuyushun441-sys merged 1 commit into
mainfrom
test/autonumber-persistence-across-restart

Conversation

@xuyushun441-sys
Copy link
Copy Markdown
Contributor

Summary

Locks in the persistence guarantee behind the #1603 autonumber consolidation (merged in #1608) with a deterministic regression test — no manual restart of a running server required.

A file-backed sqlite DB and two independent SqlDriver instances pointed at the same file:

  1. Driver Add metamodel interfaces for ObjectQL/ObjectUI contract #1 creates records → CTR-0001, CTR-0002, then disconnect() (in-memory state gone).
  2. Driver ✨ Set up Copilot instructions #2 (fresh instance, cold caches, same file) creates more → continues at CTR-0003, CTR-0004.

A non-persistent counter would reset to CTR-0001 here and mint a duplicate. A second case proves per-tenant sequences stay independent across the restart.

This is the "survives restart" verification that was previously only argued via the bootstrap-from-existing-data test; now it's exercised directly through teardown + reconnect.

Testing

pnpm --filter @objectstack/driver-sql test — new file sql-driver-autonumber-persistence.test.ts (2 tests) passes; no changeset (test-only).

🤖 Generated with Claude Code

Deterministic proof of the persistence guarantee behind the autonumber
consolidation: a FILE-backed sqlite DB and two independent SqlDriver
instances on the same file. After tearing down driver #1 (in-memory
counters gone), a fresh driver #2 continues the sequence (CTR-0003,
CTR-0004) instead of resetting to CTR-0001, and per-tenant sequences
stay independent across the restart. A non-persistent counter would
re-mint a duplicate here.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 6, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
spec Building Building Preview, Comment Jun 6, 2026 8:08am

Request Review

@xuyushun441-sys xuyushun441-sys merged commit 5bb44f1 into main Jun 6, 2026
10 of 11 checks passed
@xuyushun441-sys xuyushun441-sys deleted the test/autonumber-persistence-across-restart branch June 6, 2026 08:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants