Skip to content

migrate-dev-db fails on real data: children of filtered experiment rows are copied #49

Closed

Description

@pechhe

vp run migrate-dev-db fails against the real ~/.t3/userdata/statev2.sqlite with MigrateDevDbPhaseError ... during snapshot ... FOREIGN KEY constraint failed, so a worktree cannot be seeded with real data. It fails even with --projects 1 --threads-per-project 3. The source database itself has no foreign-key violations (PRAGMA foreign_key_check is empty).

Cause

copySourceSlice (apps/server/scripts/migrate-dev-db.ts) filters a table to the copied threads only when it has a thread_id column, and copies every other table whole. For the experiment tables that splits parents from children:

  • experiment_assignments has thread_id, so it is filtered.
  • Its children experiment_outcomes, experiment_observations, experiment_evidence and experiment_evaluations have no thread_id, so every row is copied and points at assignments that were left out.

experiment_work_tasks (filtered) and experiment_work_allocations / experiment_work_evidence (not) have the same shape, and so may external_agent_work with external_agent_sessions.

Acceptance

  • vp run migrate-dev-db --base-dir <dir> completes against a database that has experiment assignments belonging to hidden threads.
  • A test seeds a parent that is filtered out and a child without thread_id, and shows the child is not copied.
  • Found while verifying Make SlipJay workspaces first-class in T3 with a Jujutsu driver #21 in a SlipJay workspace, where the default (worktree) .t3 location is unavailable and --base-dir is needed.

Activity

  1. added
    specA delivery or discovery outcome
    on Oct 16, 2026
  2. pechhe commented on Oct 17, 2026

    @pechhe
    OwnerAuthor

    Landed in t3peach a176d5c with #104: snapshot and prune resolve rows whose parents were filtered or pruned by following the schema's foreign keys (SET NULL nulls, others delete), without rowids. Verified against the real database: migrate-dev-db completes and foreign_key_check is empty.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    specA delivery or discovery outcome

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions