Skip to content

fix(store): migrate workspace archive column before startup validation - #1496

Merged
tallcode merged 1 commit into
mainfrom
fix/workspace-archive-upgrade
Nov 4, 2026
Merged

tallcode merged 1 commit into
mainfrom
fix/workspace-archive-upgrade

Conversation

@tallcode

@tallcode tallcode commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator

Nightly 110 made workspaces.archived_at a required startup field without advancing the app database contract from version 4. An existing nightly 109 database therefore fails core validation before the desktop event loop starts, which can appear as no response when the Windows executable is double-clicked.

Advance the database contract to version 5 and add a transactional, checksummed migration before core validation. Databases without the column gain a nullable archive timestamp; fresh/nightly-110 databases that already contain it retain their existing values. Keep the existing pre-upgrade snapshot mechanism and roll back schema changes together with the migration ledger on failure.

Add regression cases for both released version-4 layouts, repeated initialization, preservation of history/database identity, and rollback/retry after a ledger-write failure. Update the older migration fixture to rewind all later ledger entries.

Validation:

  • cargo fmt -p future-host -p future-app-settings --check passed.
  • cargo clippy -p future-host -p future-app-settings --all-targets --locked --offline -- -D warnings passed (with RUSTC_WRAPPER= to bypass unavailable local sccache).
  • Isolated SQLite diagnostics using nightly 109's committed DDL and the new migration SQL confirmed upgrade, preservation of existing archive values, and transactional rollback.
  • Unit tests were not run locally, per project owner instruction; the added regression tests are for PR CI.
  • Windows desktop startup has not yet been retested on a physical Windows machine.

@tallcode
tallcode enabled auto-merge (squash) November 4, 2026 07:03
@tallcode
tallcode merged commit 5dfbffd into main Nov 4, 2026
25 checks passed
huichen added a commit that referenced this pull request Nov 16, 2026
The choice mark reached SCHEMA (and the best-effort ADDED_COLUMNS list)
without a contract step, so a database already at version 6 — the released
contract, and every desktop written by it — has no such column. Startup reads
the header, sees �ersion == APP_DB_SCHEMA_VERSION, runs �alidate_core
before any migration can touch the table, and refuses to open:

  Desktop database is incomplete: required runs.offers_choice is missing.

The same shape as #1496 (workspaces.archived_at): ADDED_COLUMNS only runs
from �pply_schema, i.e. on a fresh database, never on the current-version
path. Adopt the column under contract 7, with the released 6 kept immutable:

- 
uns_offers_choice.sql adds the column; ADDITIVE_COLUMN_STEPS skips the
  ALTER on a fresh install or a build that wrote the column early, so an
  existing mark and its row survive either layout.
- APP_DB_SCHEMA_VERSION 6 -> 7, so the upgrade is checksummed, transactional
  and snapshotted before it runs.
- Drop the ADDED_COLUMNS entry: the contract step now owns the column.

Tests cover both layouts (missing column fails �alidate_core first, an early
column is recorded without replaying), the double-open idempotence, and a
rollback that retries from its ledger like the other steps.

ER.md documents the run field.
huichen added a commit that referenced this pull request Nov 16, 2026
…bile share cache (#1630)

* fix(mobile): reclaim the share export cache instead of refusing

Opening or sharing an attachment hands the OS a copy under
`futureos-exports`, kept for 24 hours. The cap that guarded that directory
only ever counted, never reclaimed: once 100 MB of copies (or 128 of them)
accumulated, every later handoff threw `attachment_export_cache_full` and
kept throwing until retention expired — a burst of 7 MB podcast wavs was
enough to lock sharing for a whole day.

Reclaim instead of refusing. Copies older than `EXPORT_PROTECT_MS` go first,
because a handoff is a live `content://` grant an app may still be reading;
if a burst inside that window leaves no room, a second pass reclaims the
oldest anyway. Refusal now survives only for a single file larger than the
whole budget, which the transfer layer already rules out, and it deletes
nothing on the way out.

The refusal code also reached the user verbatim, because the handoff alert
appends the failure's own words on Android. Keep that for native failures —
they name the URI grant or chooser that refused — but map our own code to
`attachment.exportCacheFull` in both locales.

* fix(store): migrate runs.offers_choice before startup validation

The choice mark reached SCHEMA (and the best-effort ADDED_COLUMNS list)
without a contract step, so a database already at version 6 — the released
contract, and every desktop written by it — has no such column. Startup reads
the header, sees �ersion == APP_DB_SCHEMA_VERSION, runs �alidate_core
before any migration can touch the table, and refuses to open:

  Desktop database is incomplete: required runs.offers_choice is missing.

The same shape as #1496 (workspaces.archived_at): ADDED_COLUMNS only runs
from �pply_schema, i.e. on a fresh database, never on the current-version
path. Adopt the column under contract 7, with the released 6 kept immutable:

- 
uns_offers_choice.sql adds the column; ADDITIVE_COLUMN_STEPS skips the
  ALTER on a fresh install or a build that wrote the column early, so an
  existing mark and its row survive either layout.
- APP_DB_SCHEMA_VERSION 6 -> 7, so the upgrade is checksummed, transactional
  and snapshotted before it runs.
- Drop the ADDED_COLUMNS entry: the contract step now owns the column.

Tests cover both layouts (missing column fails �alidate_core first, an early
column is recorded without replaying), the double-open idempotence, and a
rollback that retries from its ledger like the other steps.

ER.md documents the run field.
@huichen
huichen deleted the fix/workspace-archive-upgrade branch November 20, 2026 01:09
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