beads/internal/storage/schema
matt wilkie ef3ffd45b3
feat(migrate): add --force flag as CLI twin of BD_ALLOW_REMOTE_MIGRATE (#4654)
* feat(migrate): add --force flag as CLI twin of BD_ALLOW_REMOTE_MIGRATE

The remote-migrate gate (#4259) refuses to auto-apply pending schema
migrations to a remote-backed database because two clones migrating
independently fork the schema unrecoverably. Until now the only unlock
was the env var BD_ALLOW_REMOTE_MIGRATE=1, which is awkward at the CLI
and can leak into child processes (git hooks, dolt subprocesses). The
--force flag is the natural CLI form of the designated-migrator escape
hatch: it is set before both autoMigrateOnVersionBump and the main store
open in the root PersistentPreRunE via a package-level bool, so it never
leaks out of the process. The env var remains supported for scripted/CI
use and is documented as a parenthetical alongside the new primary form.

Agent-Signature: claude-sonnet-4-6-high on behalf of matt wilkie

* fix(embeddeddolt): point lenient-gate guidance at bd migrate --force

The soft-fail (warn-and-continue) gate warning for read-only and
working-set-reconcile opens still named the env-var escape hatch; align
it with the new primary form introduced for the strict gate.

Agent-Signature: claude-fable-5-high on behalf of matt wilkie

* fix(migrate): reject --force with preview flags; harden override lifecycle

Review findings on the --force flag (cross-vendor: codex gpt-5.5 + claude
opus):

- --force combined with --dry-run/--inspect must fail before the store
  opens: with the gate overridden, the open itself applies pending
  migrations, so the preview flag would be honored only after the
  destructive work it exists to prevent (codex P2).
- Set-or-clear the override unconditionally so it is self-clearing under
  any future in-process root-command reuse (reviewer nit).
- Lock the agent-safety contract against the new flag form: AgentDirective
  must not embed 'bd migrate --force' any more than the env form (nit).

Agent-Signature: claude-fable-5-high on behalf of matt wilkie
2026-07-07 15:58:18 -07:00
..
migrations feat(lease): land the leasing stack + schema v54 (claim-TTL, heartbeat, reclaim) (#4537) 2026-07-03 23:28:55 -07:00
aux_row_id_backfill.go fix(schema): crash mid-aux-rekey no longer strands rows behind the 0009 marker (bd-578h9.16) 2026-06-11 18:53:42 -04:00
aux_row_id_backfill_test.go fix(schema): crash mid-aux-rekey no longer strands rows behind the 0009 marker (bd-578h9.16) 2026-06-11 18:53:42 -04:00
backfill.go fix(storage): preserve mixed issue and wisp reads (#3991) 2026-05-21 06:50:42 -07:00
cli_migrations.go feat(lease): land the leasing stack + schema v54 (claim-TTL, heartbeat, reclaim) (#4537) 2026-07-03 23:28:55 -07:00
content_hash_test.go perf(schema): replace content_hash probe with SHOW COLUMNS (#4479) 2026-07-04 13:44:15 -07:00
content_skew.go feat(doctor): detect migration content skew vs the cached remote ref (#4259) 2026-06-09 21:33:26 -04:00
content_skew_test.go feat(doctor): detect migration content skew vs the cached remote ref (#4259) 2026-06-09 21:33:26 -04:00
dep_id_backfill.go fix(deps): deterministic dependency primary keys for cross-clone merge-safety (#4259) 2026-06-07 14:47:58 -07:00
dep_id_backfill_test.go fix(deps): deterministic dependency primary keys for cross-clone merge-safety (#4259) 2026-06-07 14:47:58 -07:00
dirty_tables_error.go fix(embedded): let working-set reconcile commands open past dirty-table migration guard (#4567) 2026-07-03 22:00:20 -07:00
lock.go fix(schema): serialize Dolt schema migrations (#4005) 2026-05-17 15:05:43 -07:00
lock_test.go fix(schema): self-heal migrate/bootstrap - commit each migration atomically (#4566 finish) (#4611) 2026-07-07 07:03:11 -07:00
migration_content_hashes.go feat(gate): state-aware smart remote-migrate gate (#4516) 2026-06-30 14:31:04 -07:00
migration_repairs.go fix(schema): repair v53 wisp dependency drift (#4558) 2026-07-03 12:47:00 -07:00
remote_migrate_gate.go feat(migrate): add --force flag as CLI twin of BD_ALLOW_REMOTE_MIGRATE (#4654) 2026-07-07 15:58:18 -07:00
remote_migrate_gate_test.go feat(migrate): add --force flag as CLI twin of BD_ALLOW_REMOTE_MIGRATE (#4654) 2026-07-07 15:58:18 -07:00
schema.go fix(schema): self-heal migrate/bootstrap - commit each migration atomically (#4566 finish) (#4611) 2026-07-07 07:03:11 -07:00
schema_skew_test.go fix(storage): fail fast on writable opens of a schema-newer DB (#4531) 2026-07-01 23:00:05 -07:00
schema_test.go fix(schema): self-heal migrate/bootstrap - commit each migration atomically (#4566 finish) (#4611) 2026-07-07 07:03:11 -07:00
smart_remote_migrate_gate.go feat(gate): non-destructive fast-forward adopt detection (adopt-ff, #4551 follow-up 2) (#4586) 2026-07-07 05:58:28 -07:00
smart_remote_migrate_gate_test.go feat(gate): non-destructive fast-forward adopt detection (adopt-ff, #4551 follow-up 2) (#4586) 2026-07-07 05:58:28 -07:00