Skip to content

fix(cli): objectstack dev persists data by default (no :memory: wipe on restart)#1556

Merged
xuyushun441-sys merged 1 commit into
mainfrom
fix/objectstack-dev-persist-by-default
Jun 3, 2026
Merged

fix(cli): objectstack dev persists data by default (no :memory: wipe on restart)#1556
xuyushun441-sys merged 1 commit into
mainfrom
fix/objectstack-dev-persist-by-default

Conversation

@xuyushun441-sys

Copy link
Copy Markdown
Contributor

Problem

objectstack dev fell back to a :memory: SQLite database whenever no --database / OS_DATABASE_URL was provided. Every restart silently wiped all data and AI-authored metadata — you build an app in the Studio assistant, restart the dev server, and everything is gone. That makes local app-building (and the whole AI metadata-authoring loop) effectively unusable.

This was surfaced while verifying that an AI-built app is actually usable locally: after publishing an app, a restart lost it entirely because the showcase ran on :memory:.

Fix

dev now defaults to a persistent, project-anchored SQLite file at <cwd>/.objectstack/data/dev.db (gitignored, per-project) when the user hasn't chosen a database another way. All existing opt-outs are unchanged and take precedence:

  • --fresh — ephemeral temp DB (auto-deleted on exit)
  • --database <url> / -d
  • OS_DATABASE_URL / DATABASE_URL
  • explicit in-memory driver: --database-driver memory or OS_DATABASE_DRIVER=memory

Resolution is extracted into a pure, exported resolveDefaultDevDbUrl() helper (unit-tested).

The app-showcase example also drops its explicit :memory: datasource override (datasources + datasourceMapping), which would otherwise route data back to memory and defeat the new default. (Its plugins are instantiated objects → it's a "host config", so it never got the standalone file default — hence the override mattered.)

Verification

  • Unit: resolveDefaultDevDbUrl() — defaults to the file path; yields to --database, --fresh, OS_DATABASE_URL/DATABASE_URL, and the memory-driver opt-outs (6 cases).
  • Live e2e (showcase): plain objectstack dev --seed-admin → driver resolves to file:.../app-showcase/.objectstack/data/dev.db; built 客户回访 (app.customer_visit_app) via the AI assistant, published it, restarted, and the app + its visit object survived (active). Previously this was wiped on every restart.

🤖 Generated with Claude Code

…on restart)

`objectstack dev` fell back to a :memory: SQLite DB when no --database /
OS_DATABASE_URL was set, wiping all data + AI-authored metadata on every
restart — build an app, restart, it's gone. Now `dev` defaults to a
persistent file at <cwd>/.objectstack/data/dev.db (gitignored, per-project).
Opt-outs unchanged + take precedence: --fresh, --database, OS_DATABASE_URL,
--database-driver memory. Logic extracted to resolveDefaultDevDbUrl() + tested.

The app-showcase example drops its explicit :memory: datasource override so it
persists out of the box.

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

vercel Bot commented Jun 3, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
spec Ready Ready Preview, Comment Jun 3, 2026 5:29am

Request Review

@github-actions github-actions Bot added documentation Improvements or additions to documentation tests tooling size/m labels Jun 3, 2026
@xuyushun441-sys xuyushun441-sys merged commit 6b60068 into main Jun 3, 2026
12 checks passed
@xuyushun441-sys xuyushun441-sys deleted the fix/objectstack-dev-persist-by-default branch June 3, 2026 05:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tests tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants