Skip to content

Commit e3da8da

Browse files
fix(vendor): vendor the upstream db migrations the 79adc433 re-pin left behind (CL-8425) (#863)
The re-pin moved @intx/db's schema to 79adc433 without its SQL, so a fresh database lacked workflow_run_dispatch.sender_address and the stock mail trigger failed its dispatch insert. Upstream's 0090-0092 migrations are vendored verbatim as 0095-0097 behind our delta files.
1 parent 7bdc0c8 commit e3da8da

5 files changed

Lines changed: 50 additions & 2 deletions

File tree

‎vendor/intx/db/VENDORED-FROM‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
Source: https://github.com/faremeter/interchange (packages/db)
2-
Commit: c1b5bb73ff4815414af44e4662214e054e9e70e2 (origin/main, 2026-09-06)
2+
Commit: 79adc433 (origin/main, 2026-09-17; src re-pinned in CL-8206, migrations completed in CL-8425)
33
License: LGPL-2.1-only (see vendor/intx/LICENSE)
4-
Local modifications: exports map repointed from the upstream intx-src condition to direct TypeScript source resolution (types/default -> ./src/...); dist references removed. Upstream test files are not vendored (they import the unvendored @intx/inference-testing and @intx/test-harness test packages); only the tests covering a workbench delta are kept. CL-6324: workflow_definition_version gains a wire_projection jsonb column (migration 0089_workflow_definition_version_wire_projection.sql -- renumbered from 0086 as upstream took 0086/0087/0088; the journal keeps our original `when` values, which still sort after upstream's), schema/workflow-definitions.ts declares it, and workflow-definition-store.ts adds loadFrozenWireProjection (exported from src/index.ts) to read it back beside the approved wire hash. CL-6452: workflow_definition gains an origin column (migration 0090_workflow_definition_origin.sql; declared in schema/workflow-definitions.ts) marking the per-run record a folded run's deploy mints for itself, so launch and refresh resolve the hub-authored definition instead of the newest same-named row. Migration 0091_workflow_definition_version_tolerate_body_failure.sql rewrites the retired `onBodyFailure: "continue"` literal to upstream's `"tolerate"` inside stored wire projections. CL-4455: workflow_definition gains schedule_claimed_minute (migration 0092_workflow_definition_schedule_claimed_minute.sql; declared in schema/workflow-definitions.ts) so the hub's native ScheduleTrigger poller can CAS each UTC minute. CL-8162: the hub-side cron tick is deleted, so schedule_claimed_minute is dropped again (migration 0094_drop_workflow_definition_schedule_claimed_minute.sql, journal idx 94) and schema/workflow-definitions.ts no longer declares it. Workbench applies these files by sorted filename through scripts/db-setup.ts (replay-from-scratch with a filename ledger); the drizzle journal exists for drizzle-kit only. CL-7495 re-pin to c1b5bb73: upstream's 0089_tense_selene.sql (principal_key table) is renumbered to 0093_principal_keys.sql behind our four delta migrations, with journal idx 93 and a 0093_snapshot.json built from upstream's 0089 snapshot reconciled with the wire_projection/origin/schedule_claimed_minute columns; upstream 447ebb08's snapshot-chain repair (relinked 0087 prevId, workflow_run.credential_refs restored) is applied to 0087/0088. Our fork migrations 0089-0092 ship no drizzle snapshots (hand-written SQL, journal only), so there was no fork snapshot chain to repair.
4+
Local modifications: exports map repointed from the upstream intx-src condition to direct TypeScript source resolution (types/default -> ./src/...); dist references removed. Upstream test files are not vendored (they import the unvendored @intx/inference-testing and @intx/test-harness test packages); only the tests covering a workbench delta are kept. CL-6324: workflow_definition_version gains a wire_projection jsonb column (migration 0089_workflow_definition_version_wire_projection.sql -- renumbered from 0086 as upstream took 0086/0087/0088; the journal keeps our original `when` values, which still sort after upstream's), schema/workflow-definitions.ts declares it, and workflow-definition-store.ts adds loadFrozenWireProjection (exported from src/index.ts) to read it back beside the approved wire hash. CL-6452: workflow_definition gains an origin column (migration 0090_workflow_definition_origin.sql; declared in schema/workflow-definitions.ts) marking the per-run record a folded run's deploy mints for itself, so launch and refresh resolve the hub-authored definition instead of the newest same-named row. Migration 0091_workflow_definition_version_tolerate_body_failure.sql rewrites the retired `onBodyFailure: "continue"` literal to upstream's `"tolerate"` inside stored wire projections. CL-4455: workflow_definition gains schedule_claimed_minute (migration 0092_workflow_definition_schedule_claimed_minute.sql; declared in schema/workflow-definitions.ts) so the hub's native ScheduleTrigger poller can CAS each UTC minute. CL-8162: the hub-side cron tick is deleted, so schedule_claimed_minute is dropped again (migration 0094_drop_workflow_definition_schedule_claimed_minute.sql, journal idx 94) and schema/workflow-definitions.ts no longer declares it. Workbench applies these files by sorted filename through scripts/db-setup.ts (replay-from-scratch with a filename ledger); the drizzle journal exists for drizzle-kit only. CL-7495 re-pin to c1b5bb73: upstream's 0089_tense_selene.sql (principal_key table) is renumbered to 0093_principal_keys.sql behind our four delta migrations, with journal idx 93 and a 0093_snapshot.json built from upstream's 0089 snapshot reconciled with the wire_projection/origin/schedule_claimed_minute columns; upstream 447ebb08's snapshot-chain repair (relinked 0087 prevId, workflow_run.credential_refs restored) is applied to 0087/0088. Our fork migrations 0089-0092 ship no drizzle snapshots (hand-written SQL, journal only), so there was no fork snapshot chain to repair. CL-8425: the CL-8206 re-pin to 79adc433 moved src/schema (tenant domain lower-unique index, workflow_run_dispatch.sender_address, sidecar_allocation destroy_failed status) without its SQL; upstream's 0090_tenant_domain_lower_unique, 0091_workflow_run_dispatch_sender_address and 0092_sidecar_destroy_failed are vendored verbatim as 0095/0096/0097 (journal idx 95-97, no snapshots).
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ALTER TABLE "tenant" DROP CONSTRAINT "tenant_domain_unique";--> statement-breakpoint
2+
CREATE UNIQUE INDEX "tenant_domain_lower_idx" ON "tenant" USING btree (lower("domain"));
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
ALTER TABLE "workflow_run_dispatch" ADD COLUMN "sender_address" text;--> statement-breakpoint
2+
-- Fail in-flight mail dispatches that predate the authenticated-sender
3+
-- requirement. They carry no persisted hub-verified sender, and neither
4+
-- fabricating one nor re-reading the signed From is permitted, so they are
5+
-- failed in place rather than delivered unauthenticated. Only unsettled
6+
-- (pending/acknowledged) mail rows are ever re-dispatched and reconstruct a
7+
-- mail.inbound frame; terminal (settled/failed) mail rows never do, so they
8+
-- keep their NULL sender under the status-scoped check below. On a fresh
9+
-- database this affects zero rows.
10+
UPDATE "workflow_run_dispatch"
11+
SET "status" = 'failed',
12+
"failure_code" = 'sender_address_migration',
13+
"failure_message" = 'in-flight mail dispatch predates the authenticated-sender requirement and carries no hub-verified sender',
14+
"next_attempt_at" = NULL,
15+
"delivery_lease_id" = NULL,
16+
"delivery_lease_expires_at" = NULL,
17+
"updated_at" = now()
18+
WHERE "kind" = 'mail'
19+
AND "status" IN ('pending', 'acknowledged')
20+
AND "sender_address" IS NULL;--> statement-breakpoint
21+
ALTER TABLE "workflow_run_dispatch" ADD CONSTRAINT "workflow_run_dispatch_mail_sender_check" CHECK ("workflow_run_dispatch"."kind" <> 'mail' or "workflow_run_dispatch"."status" in ('settled', 'failed') or "workflow_run_dispatch"."sender_address" is not null);
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
ALTER TABLE "sidecar_allocation" DROP CONSTRAINT "sidecar_allocation_status_check";--> statement-breakpoint
2+
DROP INDEX "sidecar_allocation_active_sidecar_idx";--> statement-breakpoint
3+
CREATE UNIQUE INDEX "sidecar_allocation_active_sidecar_idx" ON "sidecar_allocation" USING btree ("sidecar_id") WHERE "sidecar_allocation"."status" in ('provisioning', 'allocated', 'replacing', 'releasing', 'destroy_failed');--> statement-breakpoint
4+
ALTER TABLE "sidecar_allocation" ADD CONSTRAINT "sidecar_allocation_status_check" CHECK ("sidecar_allocation"."status" in ('pending', 'provisioning', 'allocated', 'replacing', 'releasing', 'destroy_failed', 'released', 'failed'));

‎vendor/intx/db/migrations/meta/_journal.json‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -659,6 +659,27 @@
659659
"when": 1789000000000,
660660
"tag": "0094_drop_workflow_definition_schedule_claimed_minute",
661661
"breakpoints": true
662+
},
663+
{
664+
"idx": 95,
665+
"version": "7",
666+
"when": 1789100000000,
667+
"tag": "0095_tenant_domain_lower_unique",
668+
"breakpoints": true
669+
},
670+
{
671+
"idx": 96,
672+
"version": "7",
673+
"when": 1789100000001,
674+
"tag": "0096_workflow_run_dispatch_sender_address",
675+
"breakpoints": true
676+
},
677+
{
678+
"idx": 97,
679+
"version": "7",
680+
"when": 1789100000002,
681+
"tag": "0097_sidecar_destroy_failed",
682+
"breakpoints": true
662683
}
663684
]
664685
}

0 commit comments

Comments
 (0)