Skip to content

Commit 6e6a992

Browse files
committed
fix(db): renumber cancelled->canceled migration 000082 to 000084
Main now tops at migration 000083 (ladder_execution_enabled, PR #1396). golang-migrate applies only versions strictly greater than the current schema version, so a 000082 migration would be silently skipped on any DB already advanced to 000083 (prod / staging): the cancelled->canceled rename would never run. Renumber to 000084, the next free slot above main's max (PR #808 is taking 000085, so use 000084 exactly). Renames the up/down SQL and the integration test file, bumps the pinned version constants (renameCanceledVersion 82->84, renameCanceledPrevVersion 81->83, the version immediately below now that 000083 sits directly beneath), and updates every 000082 reference in comments, OpenAPI, the frontend history/riexchange notes, and the .golangci.yml misspell exemption path. Collision-checked: no 000084 exists on origin/main. Verified on a fresh testcontainer PG that the full chain migrates cleanly through 000084 (Database migrations completed successfully (version: 84)) and the expand/rollback integration tests pass.
1 parent 631ff73 commit 6e6a992

12 files changed

Lines changed: 35 additions & 35 deletions

‎.golangci.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ linters:
135135
text: "cancelled|initialised"
136136
- linters:
137137
- misspell
138-
path: internal/database/postgres/migrations/000082_rename_cancelled_to_canceled_test\.go
138+
path: internal/database/postgres/migrations/000084_rename_cancelled_to_canceled_test\.go
139139
paths:
140140
- third_party$
141141
- builtin$

‎frontend/src/__tests__/history.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -403,15 +403,15 @@ describe('History Module', () => {
403403
});
404404
});
405405

406-
// Migration 000082 (expand-contract rename cancelled -> canceled): during
406+
// Migration 000084 (expand-contract rename cancelled -> canceled): during
407407
// the rolling deploy window the backend returns BOTH spellings on
408408
// /api/history. Each must render as the muted "Cancelled" badge, be
409409
// counted under the Cancelled chip, and be visible when that chip is
410410
// clicked. Pre-fix the FE only matched 'cancelled', so 'canceled' rows
411411
// fell through to the green Completed badge and were silently bucketed
412412
// into the Completed total -- a user-facing regression that defeats the
413413
// purpose of the rename.
414-
test('Cancelled badge + chip surface BOTH spellings during deploy window (migration 000082)', async () => {
414+
test('Cancelled badge + chip surface BOTH spellings during deploy window (migration 000084)', async () => {
415415
(api.getHistory as jest.Mock).mockResolvedValue({
416416
summary: {},
417417
purchases: [

‎frontend/src/history.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ function statusBadgeHTML(status: string): string {
380380
return '<span class="badge badge-warning">In Progress</span>';
381381
case 'canceled':
382382
case 'cancelled':
383-
// Migration 000082 (expand-contract rename): the backend may return
383+
// Migration 000084 (expand-contract rename): the backend may return
384384
// either the new US spelling ('canceled') or the legacy British
385385
// spelling ('cancelled') during the rolling deploy window. Match both
386386
// so a row written by EITHER old or new code renders the muted Cancelled
@@ -414,7 +414,7 @@ function buildStatusChipRowHTML(purchases: HistoryPurchase[], active: StatusFilt
414414
for (const p of purchases) {
415415
const s = normalizeStatus(p).toLowerCase();
416416
if (s === 'pending' || s === 'notified' || isInFlightStatus(s)) counts.pending++;
417-
// Migration 000082 (expand-contract rename): the backend may return
417+
// Migration 000084 (expand-contract rename): the backend may return
418418
// either spelling during the rolling deploy window. Counting only the
419419
// British spelling would silently bucket new 'canceled' rows into the
420420
// Completed total, hiding them from the user.
@@ -745,7 +745,7 @@ function renderHistoryList(purchases: HistoryPurchase[]): void {
745745
const s = normalizeStatus(p).toLowerCase();
746746
if (activeStatusFilter === 'pending') return s === 'pending' || s === 'notified' || isInFlightStatus(s);
747747
if (activeStatusFilter === 'completed') return s === 'completed' || s === 'partially_completed' || !p.status;
748-
// Migration 000082: the Cancelled chip key is 'cancelled' (British, kept
748+
// Migration 000084: the Cancelled chip key is 'cancelled' (British, kept
749749
// stable for URL/state compatibility) but it must surface BOTH spellings
750750
// during the expand-contract deploy window so new 'canceled' rows aren't
751751
// hidden from the filter.
@@ -765,7 +765,7 @@ function renderHistoryList(purchases: HistoryPurchase[]): void {
765765
const s = normalizeStatus(p).toLowerCase();
766766
if (activeStatusFilter === 'pending') return s === 'pending' || s === 'notified' || isInFlightStatus(s);
767767
if (activeStatusFilter === 'completed') return s === 'completed' || s === 'partially_completed' || !p.status;
768-
// Migration 000082: surface BOTH spellings under the Cancelled chip during
768+
// Migration 000084: surface BOTH spellings under the Cancelled chip during
769769
// the expand-contract deploy window (see the equivalent guard above).
770770
if (activeStatusFilter === 'cancelled') return s === 'cancelled' || s === 'canceled';
771771
return s === activeStatusFilter;

‎frontend/src/riexchange.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1796,7 +1796,7 @@ function getStatusBadgeClass(status: string): string {
17961796
case 'pending': return 'status-badge pending';
17971797
case 'processing': return 'status-badge running';
17981798
case 'failed': return 'status-badge failed';
1799-
// Migration 000082 (expand-contract rename, ri_exchange_history.status):
1799+
// Migration 000084 (expand-contract rename, ri_exchange_history.status):
18001800
// backend may return either spelling during the rolling deploy window.
18011801
// Match both so a row written by EITHER old or new code keeps the muted
18021802
// "disabled" visual treatment instead of falling through to the default

‎internal/api/handler_history.go‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ func (h *Handler) getHistory(ctx context.Context, req *events.LambdaFunctionURLR
116116
// the Revoke button unreachable (issue #290, second-wave CR Finding E).
117117
// Both the US-spelling status (config.StatusCanceled) and the legacy British
118118
// spelling (config.LegacyStatusCanceled) are listed: during the expand-contract
119-
// rename (migration 000082) old code may still write the legacy value before
119+
// rename (migration 000084) old code may still write the legacy value before
120120
// the rolling deploy completes. The contract migration (#1278) normalizes the
121121
// data once the deploy is verified stable; drop the legacy entry here then.
122122
var historyExecutionStatuses = []string{"pending", "notified", "scheduled", "approved", "running", "paused", "completed", "partially_completed", "failed", "expired", config.StatusCanceled, config.LegacyStatusCanceled}
@@ -336,7 +336,7 @@ func annotateHistoryRowByStatus(row *config.PurchaseHistoryRecord, exec config.P
336336
row.StatusDescription = "approval link expired (not approved within 7 days)"
337337
case config.StatusCanceled, config.LegacyStatusCanceled:
338338
// The legacy British spelling is still matched during the
339-
// expand-contract rename (migration 000082) until the contract
339+
// expand-contract rename (migration 000084) until the contract
340340
// migration (#1278) normalizes and drops it.
341341
annotateCancelled(row, exec, approver)
342342
default:
@@ -1019,7 +1019,7 @@ func summarizePurchaseHistory(purchases []config.PurchaseHistoryRecord) HistoryS
10191019
// realized savings (issue #736). Exclude from all dollar KPIs and
10201020
// from TotalCompleted -- the money was never committed. The legacy
10211021
// British spelling is matched alongside the US one during the
1022-
// expand-contract rename (migration 000082) so legacy rows can't
1022+
// expand-contract rename (migration 000084) so legacy rows can't
10231023
// inflate KPIs mid-deploy; the contract migration (#1278) drops it
10241024
// once the deploy is stable.
10251025
continue

‎internal/api/handler_history_test.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1712,7 +1712,7 @@ func TestSummarizePurchaseHistory_CancelledExcludedFromKPIs(t *testing.T) {
17121712
// appear in the dollar KPIs or TotalCompleted. One uses the new US
17131713
// spelling (config.StatusCanceled) and one the legacy British spelling
17141714
// (config.LegacyStatusCanceled): during the expand-contract rename
1715-
// (migration 000082) a mixed fleet still emits the legacy spelling, so
1715+
// (migration 000084) a mixed fleet still emits the legacy spelling, so
17161716
// the dual-spelling read path must exclude BOTH. The constant carries
17171717
// the legacy value without a literal the US-locale misspell linter would
17181718
// flag (and without a nolint). Drop the legacy fixture once the contract

‎internal/api/handler_purchases.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ func (h *Handler) cancelOrRecoverExecution(ctx context.Context, executionID stri
398398
return nil, fmt.Errorf("disable plan: failed to get execution %s after conflict: %w", executionID, getErr)
399399
}
400400
// Accept both spellings: during the expand-contract rename (migration
401-
// 000082) a concurrent legacy cancel may have written the legacy value
401+
// 000084) a concurrent legacy cancel may have written the legacy value
402402
// before the rolling deploy completes. The contract migration (#1278)
403403
// normalizes the data, after which LegacyStatusCanceled can be removed.
404404
if existing.Status != config.StatusCanceled && existing.Status != config.LegacyStatusCanceled {

‎internal/api/openapi.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2441,7 +2441,7 @@ components:
24412441
type: string
24422442
status:
24432443
type: string
2444-
# Migration 000082 (expand-contract rename, cancelled -> canceled):
2444+
# Migration 000084 (expand-contract rename, cancelled -> canceled):
24452445
# both spellings are valid during the rolling deploy window. New code
24462446
# writes "canceled" (US); rows written by old code retain "cancelled"
24472447
# until the CONTRACT migration (#1278) normalizes them, at which

‎internal/config/types.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ type PurchaseExecution struct {
287287
// endpoint). Nil on legacy token-only approve/cancel paths; the
288288
// handler / History UI falls back to the notification email as the
289289
// accountable party in that case. Nullable TEXT in Postgres.
290-
// DB column: canceled_by (migration 000082 adds it alongside the legacy
290+
// DB column: canceled_by (migration 000084 adds it alongside the legacy
291291
// British-spelled column; reads COALESCE the two during EXPAND).
292292
ApprovedBy *string `json:"approved_by,omitempty" dynamodbav:"approved_by,omitempty"`
293293
CanceledBy *string `json:"canceled_by,omitempty" dynamodbav:"canceled_by,omitempty"`
@@ -370,7 +370,7 @@ type PurchaseExecution struct {
370370
const StatusCanceled = "canceled"
371371

372372
// LegacyStatusCanceled is the British-spelling status value old code writes
373-
// during the expand-contract rename (migration 000082). It is constructed by
373+
// during the expand-contract rename (migration 000084). It is constructed by
374374
// concatenation rather than a single literal so the US-locale misspell linter
375375
// does not flag it -- this lets the dual-spelling read paths reference the
376376
// legacy value without a //nolint:misspell directive. The CONTRACT migration

internal/database/postgres/migrations/000082_rename_cancelled_to_canceled.down.sql renamed to internal/database/postgres/migrations/000084_rename_cancelled_to_canceled.down.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
-- Rollback 000082: reverse the EXPAND migration.
1+
-- Rollback 000084: reverse the EXPAND migration.
22
--
33
-- Restores the single-spelling constraints (British 'cancelled' only),
44
-- removes the canceled_by column added in the up migration, and converts any

0 commit comments

Comments
 (0)