Skip to content

Commit 53a31fd

Browse files
icecrasher321claude
andcommitted
fix(ci): validate live-column builders and inline aliases in the pending-drop audit
Hardens check-pending-drop-tables per review: the audit now derives each guarded table's doomed columns from schema.ts (@deprecated tags and column-level contract-pending markers), so a sanctioned omit(getTableColumns(t), [...]) or destructure-omit must name every doomed column away — an unrelated or incomplete key list is reported with the columns it misses, and schema.ts itself is no longer skipped, so the <table>Columns helpers fail the audit if a later deprecation is not added to their omit lists. Inline alias(t, ...) expressions passed directly to from()/getTableColumns()/insert/update/delete now resolve to their canonical table instead of escaping the checks. The testing mirror's *Columns aliases now omit the same doomed keys as the real helpers (and gain the missing proPeriodCostSnapshotAt entry), so tests cannot keep passing against doomed-column references the app no longer serves. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 8b81d09 commit 53a31fd

2 files changed

Lines changed: 199 additions & 99 deletions

File tree

packages/testing/src/mocks/schema.mock.ts

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { omit } from '@sim/utils/object'
2+
13
/**
24
* Comprehensive mock for `@sim/db/schema`.
35
*
@@ -74,6 +76,7 @@ const userStatsMock = {
7476
lastPeriodCost: 'userStats.lastPeriodCost',
7577
billedOverageThisPeriod: 'userStats.billedOverageThisPeriod',
7678
proPeriodCostSnapshot: 'userStats.proPeriodCostSnapshot',
79+
proPeriodCostSnapshotAt: 'userStats.proPeriodCostSnapshotAt',
7780
creditBalance: 'userStats.creditBalance',
7881
totalCopilotCost: 'userStats.totalCopilotCost',
7982
currentPeriodCopilotCost: 'userStats.currentPeriodCopilotCost',
@@ -277,7 +280,7 @@ export const schemaMock = {
277280
updatedAt: 'secretUsage.updatedAt',
278281
},
279282
workflowExecutionLogs: workflowExecutionLogsMock,
280-
workflowExecutionLogColumns: workflowExecutionLogsMock,
283+
workflowExecutionLogColumns: omit(workflowExecutionLogsMock, ['cost']),
281284
executionLargeValues: {
282285
key: 'executionLargeValues.key',
283286
workspaceId: 'executionLargeValues.workspaceId',
@@ -504,7 +507,27 @@ export const schemaMock = {
504507
},
505508
billingBlockedReasonEnum: 'billingBlockedReasonEnum',
506509
userStats: userStatsMock,
507-
userStatsColumns: userStatsMock,
510+
userStatsColumns: omit(userStatsMock, [
511+
'totalManualExecutions',
512+
'totalApiCalls',
513+
'totalWebhookTriggers',
514+
'totalScheduledExecutions',
515+
'totalChatExecutions',
516+
'totalMcpExecutions',
517+
'totalTokensUsed',
518+
'totalCost',
519+
'currentPeriodCost',
520+
'proPeriodCostSnapshot',
521+
'proPeriodCostSnapshotAt',
522+
'totalCopilotCost',
523+
'currentPeriodCopilotCost',
524+
'totalCopilotTokens',
525+
'totalCopilotCalls',
526+
'totalMcpCopilotCalls',
527+
'totalMcpCopilotCost',
528+
'currentPeriodMcpCopilotCost',
529+
'lastActive',
530+
]),
508531
customBlock: {
509532
id: 'customBlock.id',
510533
organizationId: 'customBlock.organizationId',
@@ -591,7 +614,7 @@ export const schemaMock = {
591614
updatedAt: 'chat.updatedAt',
592615
},
593616
organization: organizationMock,
594-
organizationColumns: organizationMock,
617+
organizationColumns: omit(organizationMock, ['departedMemberUsage']),
595618
member: {
596619
id: 'member.id',
597620
userId: 'member.userId',

0 commit comments

Comments
 (0)