Keep migration numbering append-only in sleep-29-native-chat-progress

Place the company review index before descendant migrations. Preserve all SQL bytes, update exact filename references, and regenerate snapshots in dependency order. Validate each PR against its corrected target branch.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
DottaandPaperclip committed 2026-10-27 01:25:51 -05:00
commit 10fcc2b226
22 files changed
+14604 -14605

No files matched your search

+17 -6
View File
@@ -107,12 +107,23 @@ The grouped startup inventory remains unchanged. Existing company signals,
authority checks, expiry settlement, paging, backoff, and sleep gates remain
owned by their existing services.
The generated additive migration reserves number 0402 because later PRs in this
stack already own 0380 through 0401. It builds the new index concurrently and
idempotently through the existing top-level migration executor. No old SQL
migration is edited. Combined snapshots must be generated from each branch's
merged schema, retaining the five newest snapshots, so the reserved later
number cannot hide descendant schema changes from future generation.
The additive company-expiry index is migration `0380_tool_review_company_expiry`.
It builds the index concurrently and idempotently through the existing top-level
migration executor. It was initially numbered 0402 to avoid existing allocations.
That passed per-branch numbering and schema checks, but CI correctly rejected
later PRs whose migrations then preceded their target branch's 0402. The fix
renumbers this unmerged index migration to 0380 and shifts the stack's former
0380 through 0401 migrations forward by one, preserving their SQL bytes. It
updates filename references, journal tags and indices, and generates snapshots
in the corrected dependency order. The moved journal timestamp is placed after
0379 and before the next migration; other timestamps remain unchanged.
Each PR must pass the exact target-branch migration-order gate, in addition to
the existing numbering, safety, five-snapshot retention, and schema-drift checks.
Local branch checks alone did not establish the stack's append-only ordering.
Fresh application, upgrades from the previous numbered task databases, and
replay also require verification. These unmerged stack migrations have not
changed the SQL of migrations already on master.
Two failures shaped the repair. The first migration attempt omitted its explicit
top-level registration and PostgreSQL rejected the concurrent build inside a
@@ -166,7 +166,7 @@ endpoints to serialize against signed admission ingress.
The existing admission row needs separate authorization and cleanup state. Three
nullable fields record confirmation, retry and the signed provider account.
Migration 0388_lying_trish_tilby.sql was generated with `pnpm db:generate`, made
Migration 0389_lying_trish_tilby.sql was generated with `pnpm db:generate`, made
idempotent, and given a concurrent partial index. It backfills only provable old
termination. The initial two-field unpublished generation was replaced by this
single migration after account-rotation analysis. Five newest snapshots remain;
+11 -11
View File
@@ -503,17 +503,17 @@ const MIGRATIONS_WITH_TOP_LEVEL_STATEMENTS = new Set([
"0369_late_logan.sql",
"0378_mean_scream.sql",
"0379_narrow_the_executioner.sql",
"0381_open_madame_web.sql",
"0382_chemical_madame_web.sql",
"0383_clever_chamber.sql",
"0384_many_reaper.sql",
"0385_normal_blindfold.sql",
"0386_omniscient_luke_cage.sql",
"0387_huge_skrulls.sql",
"0388_lying_trish_tilby.sql",
"0389_workable_spencer_smythe.sql",
"0380_funny_adam_warlock.sql",
"0402_tool_review_company_expiry.sql",
"0382_open_madame_web.sql",
"0383_chemical_madame_web.sql",
"0384_clever_chamber.sql",
"0385_many_reaper.sql",
"0386_normal_blindfold.sql",
"0387_omniscient_luke_cage.sql",
"0388_huge_skrulls.sql",
"0389_lying_trish_tilby.sql",
"0390_workable_spencer_smythe.sql",
"0381_funny_adam_warlock.sql",
"0380_tool_review_company_expiry.sql",
]);
async function applyPendingMigrationsManually(
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -64288,6 +64288,6 @@
"tables": {},
"columns": {}
},
"id": "9c7aee3a-bfe0-4b7c-9cea-4a47e09ddd28",
"prevId": "8bd7f279-1063-4ba6-83bb-b85cba334eb3"
"id": "5db1f039-3778-4473-bfce-211aacfceb62",
"prevId": "c6f680ef-ddfc-4ca7-93ae-4004d9a9e4b5"
}
+23 -23
View File
@@ -2651,78 +2651,78 @@
{
"idx": 380,
"version": "7",
"when": 1792863024087,
"tag": "0380_funny_adam_warlock",
"when": 1792861791950,
"tag": "0380_tool_review_company_expiry",
"breakpoints": true
},
{
"idx": 381,
"version": "7",
"when": 1792863626931,
"tag": "0381_open_madame_web",
"when": 1792863024087,
"tag": "0381_funny_adam_warlock",
"breakpoints": true
},
{
"idx": 382,
"version": "7",
"when": 1792871748836,
"tag": "0382_chemical_madame_web",
"when": 1792863626931,
"tag": "0382_open_madame_web",
"breakpoints": true
},
{
"idx": 383,
"version": "7",
"when": 1792872323806,
"tag": "0383_clever_chamber",
"when": 1792871748836,
"tag": "0383_chemical_madame_web",
"breakpoints": true
},
{
"idx": 384,
"version": "7",
"when": 1792873408795,
"tag": "0384_many_reaper",
"when": 1792872323806,
"tag": "0384_clever_chamber",
"breakpoints": true
},
{
"idx": 385,
"version": "7",
"when": 1792875344101,
"tag": "0385_normal_blindfold",
"when": 1792873408795,
"tag": "0385_many_reaper",
"breakpoints": true
},
{
"idx": 386,
"version": "7",
"when": 1792877330859,
"tag": "0386_omniscient_luke_cage",
"when": 1792875344101,
"tag": "0386_normal_blindfold",
"breakpoints": true
},
{
"idx": 387,
"version": "7",
"when": 1792880971454,
"tag": "0387_huge_skrulls",
"when": 1792877330859,
"tag": "0387_omniscient_luke_cage",
"breakpoints": true
},
{
"idx": 388,
"version": "7",
"when": 1792921047529,
"tag": "0388_lying_trish_tilby",
"when": 1792880971454,
"tag": "0388_huge_skrulls",
"breakpoints": true
},
{
"idx": 389,
"version": "7",
"when": 1792926867183,
"tag": "0389_workable_spencer_smythe",
"when": 1792921047529,
"tag": "0389_lying_trish_tilby",
"breakpoints": true
},
{
"idx": 402,
"idx": 390,
"version": "7",
"when": 1793080350746,
"tag": "0402_tool_review_company_expiry",
"when": 1792926867183,
"tag": "0390_workable_spencer_smythe",
"breakpoints": true
}
]
@@ -8,7 +8,7 @@ import { getEmbeddedPostgresTestSupport, startEmbeddedPostgresTestDatabase } fro
const external = process.env.PAPERCLIP_MIGRATION_TEST_DATABASE_URL;
if (external && !new URL(external).pathname.endsWith("_test")) throw new Error("Migration test URL must name a test database");
const support = external ? { supported: true } : await getEmbeddedPostgresTestSupport();
const migrationFile = "0388_lying_trish_tilby.sql";
const migrationFile = "0389_lying_trish_tilby.sql";
const indexName = "chat_voice_inbound_cleanup_idx";
(support.supported ? describe : describe.skip)("inbound voice cleanup migration", () => {
@@ -96,7 +96,7 @@ const support = external ? { supported: true } : await getEmbeddedPostgresTestSu
it("backfills only provable legacy termination and preserves rejected cleanup debt", async () => {
const confirmed = await admission({ state: "ended" });
const uncertain = await admission({ state: "ended", approvedByUserId: randomUUID(), callerAuthority: "member" });
const migration = await readFile(new URL("../../../packages/db/src/migrations/0388_lying_trish_tilby.sql", import.meta.url), "utf8");
const migration = await readFile(new URL("../../../packages/db/src/migrations/0389_lying_trish_tilby.sql", import.meta.url), "utf8");
const backfill = migration.split("--> statement-breakpoint").at(-1)!;
await db.execute(sql.raw(backfill)); await db.execute(sql.raw(backfill));
expect((await db.select().from(chatVoiceInboundCalls).where(eq(chatVoiceInboundCalls.id, confirmed.id)))[0].cleanupConfirmedAt).not.toBeNull();