Cotal TypeScript packages
    Preparing search index...

    Function commitMigration

    • File the migration, and record that this driver applied it.

      TWO WRITES AND THEY ARE DIFFERENT ACTS. The report is filed create-only under an id derived from its own content, so the retry a crash forces lands on its own record rather than filing a second migration for one decision. The application is a separate, create-only status: two drivers racing to advance one run both find no status and both write, and the store decides. A driver that lost that race hears about it instead of believing it moved a run somebody else moved.

      REFUSED FOR AN INADMISSIBLE REPORT, before anything is written. A migration the check rejected is not a migration with a caveat — filing it would put a decision nobody may act on into the same history a reader trusts, and the refusal is the product the check exists to produce.

      A --release override is HONOURED HERE: the named seats are despawned through the run's own discharge before the migration is filed, so the record never claims a release nothing performed. An ignored row that says nothing outlives a step is honoured the same way, and only while that step is still pending: the handler's endPause claims its pauses before the record is filed, so the row never claims a pause is over while its timer is still armed. A settled orphan already ended its own. An --adopt override is honoured by the driver that next runs the program: the migration's kept spawn rows are what its handler hands to the next spawn of that persona (migrationSeats).

      What is still NOT here, stated rather than implied: the run's pinned program hash does not advance, because RunSpecValue carries no program hash to advance — that pin is declared and unbuilt, and this branch does not invent it. The migration is durable and readable; the run record does not yet name which source it is on.

      Parameters

      • kv: KV
      • endpoint: string
      • report: MigrateReport
      • driver: string
      • Optionalseats: {
            entries: readonly JournalEntry[];
            handler: {
                discharge(entries: readonly JournalEntry[]): Promise<unknown>;
                endPause(entry: JournalEntry): Promise<unknown>;
            };
        }

      Returns Promise<{ created: boolean; migrationId: string; released: readonly string[] }>