Skip to content

Commit b627f34

Browse files
committed
chore(db): drop retired storage whose readers have shipped
Drops tables and an index whose last readers and writers were removed in already-released versions, makes chat.include_tool_calls NOT NULL, and un-declares six dead columns ahead of a next-release DROP COLUMN. embedding_keyword_tin is dropped by script migration 0031 so it runs after 0030 retires the triggers that still write it on skipped-release upgrades.
1 parent 6e3dbf6 commit b627f34

24 files changed

Lines changed: 30380 additions & 314 deletions

File tree

‎apps/sim/app/api/chat/[identifier]/otp/route.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,8 @@ export const PUT = withRouteHandler(
231231
customizations: deployment.customizations,
232232
authType: deployment.authType,
233233
outputConfigs: deployment.outputConfigs,
234-
includeThinking: deployment.includeThinking ?? false,
235-
includeToolCalls: deployment.includeToolCalls ?? false,
234+
includeThinking: deployment.includeThinking,
235+
includeToolCalls: deployment.includeToolCalls,
236236
})
237237
await setChatAuthCookie(response, deployment, email)
238238

‎apps/sim/app/api/chat/[identifier]/route.test.ts‎

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ describe('Chat Identifier API Route', () => {
140140
},
141141
outputConfigs: [{ blockId: 'block-1', path: 'output' }],
142142
includeThinking: false,
143-
includeToolCalls: null,
143+
includeToolCalls: false,
144144
},
145145
]
146146

@@ -362,13 +362,10 @@ describe('Chat Identifier API Route', () => {
362362
})
363363
}, 10000)
364364

365-
/**
366-
* A row predating the column has no tool policy, so it has not opted in.
367-
* Thinking must not drag tool frames along with it.
368-
*/
369-
it('reads a null tool policy as off rather than inheriting thinking', async () => {
365+
/** Thinking and tool calls are independent policies: thinking must not drag tool frames along. */
366+
it('keeps tool calls off when only thinking is enabled', async () => {
370367
const thinkingChatResult = [
371-
{ ...mockChatResult[0], includeThinking: true, includeToolCalls: null },
368+
{ ...mockChatResult[0], includeThinking: true, includeToolCalls: false },
372369
]
373370
dbChainMockFns.select.mockImplementation((fields: Record<string, unknown>) => {
374371
if (fields && fields.isDeployed !== undefined) {

‎apps/sim/app/api/chat/[identifier]/route.ts‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ interface ChatConfigSource {
3333
customizations: unknown
3434
authType: string | null
3535
outputConfigs: unknown
36-
includeThinking?: boolean | null
37-
includeToolCalls?: boolean | null
36+
includeThinking: boolean
37+
includeToolCalls: boolean
3838
}
3939

4040
function toChatConfigResponse(deployment: ChatConfigSource) {
@@ -45,8 +45,8 @@ function toChatConfigResponse(deployment: ChatConfigSource) {
4545
customizations: deployment.customizations,
4646
authType: deployment.authType,
4747
outputConfigs: deployment.outputConfigs,
48-
includeThinking: deployment.includeThinking ?? false,
49-
includeToolCalls: deployment.includeToolCalls ?? false,
48+
includeThinking: deployment.includeThinking,
49+
includeToolCalls: deployment.includeToolCalls,
5050
}
5151
}
5252

@@ -332,8 +332,7 @@ export const POST = withRouteHandler(
332332
variables: (workflowRecord?.variables as Record<string, unknown>) ?? undefined,
333333
}
334334

335-
const includeThinking = deployment.includeThinking ?? false
336-
const includeToolCalls = deployment.includeToolCalls ?? false
335+
const { includeThinking, includeToolCalls } = deployment
337336
const agentEvents = shouldEmitAgentStreamEvents({
338337
includeThinking,
339338
includeToolCalls,

‎apps/sim/app/api/chat/presenters.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export function toChatDetailResponse(deployment: ChatDeploymentView, chatUrl: st
1919
allowedEmails: (deployment.allowedEmails as string[] | null) ?? [],
2020
outputConfigs: (deployment.outputConfigs as ChatDetail['outputConfigs'] | null) ?? [],
2121
includeThinking: deployment.includeThinking,
22-
includeToolCalls: deployment.includeToolCalls ?? false,
22+
includeToolCalls: deployment.includeToolCalls,
2323
customizations: (deployment.customizations as ChatDetail['customizations']) ?? undefined,
2424
isActive: deployment.isActive,
2525
chatUrl,

‎apps/sim/app/api/v2/chat-deployments/route.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ function chatRow(overrides: Record<string, unknown> = {}) {
8787
allowedEmails: [],
8888
outputConfigs: [],
8989
includeThinking: false,
90-
includeToolCalls: null,
90+
includeToolCalls: false,
9191
archivedAt: null,
9292
createdAt: new Date('2026-06-12T10:30:00.000Z'),
9393
updatedAt: new Date('2026-06-12T10:30:00.000Z'),

‎apps/sim/app/api/v2/chat-deployments/utils.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export function toV2ChatDeployment(
9999
customizations: normalizeStoredCustomizations(deployment.customizations),
100100
outputConfigs: normalizeStoredOutputConfigs(deployment.outputConfigs),
101101
includeThinking: deployment.includeThinking,
102-
includeToolCalls: deployment.includeToolCalls ?? false,
102+
includeToolCalls: deployment.includeToolCalls,
103103
createdAt: deployment.createdAt.toISOString(),
104104
updatedAt: deployment.updatedAt.toISOString(),
105105
})
@@ -130,7 +130,7 @@ export function toV2ChatDeploymentListItem(
130130
authType: deployment.authType,
131131
outputConfigs: normalizeStoredOutputConfigs(deployment.outputConfigs),
132132
includeThinking: deployment.includeThinking,
133-
includeToolCalls: deployment.includeToolCalls ?? false,
133+
includeToolCalls: deployment.includeToolCalls,
134134
createdAt: deployment.createdAt.toISOString(),
135135
updatedAt: deployment.updatedAt.toISOString(),
136136
})

‎apps/sim/app/api/v2/workflows/[workflowId]/deployments/chat/route.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ function chatRow(overrides: Record<string, unknown> = {}) {
107107
allowedEmails: [],
108108
outputConfigs: [],
109109
includeThinking: false,
110-
includeToolCalls: null,
110+
includeToolCalls: false,
111111
archivedAt: null,
112112
createdAt: new Date('2026-06-12T10:30:00.000Z'),
113113
updatedAt: new Date('2026-06-12T10:30:00.000Z'),

‎apps/sim/app/api/workflows/[id]/chat/status/route.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ function chatRow(overrides: Record<string, unknown> = {}) {
6767
allowedEmails: ['ceo@victim-corp.com', '@victim-corp.com'],
6868
outputConfigs: [{ blockId: 'block-1', path: 'output' }],
6969
includeThinking: true,
70-
includeToolCalls: null,
70+
includeToolCalls: false,
7171
archivedAt: null,
7272
createdAt: new Date('2026-06-12T10:30:00.000Z'),
7373
updatedAt: new Date('2026-06-12T10:30:00.000Z'),

‎apps/sim/lib/chat-deployments/application/read-chat-deployments.ts‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,7 @@ export interface ChatDeploymentView extends Omit<ChatDeploymentRow, 'password'>
2424

2525
export function toChatDeploymentView(row: ChatDeploymentRow): ChatDeploymentView {
2626
const { password, ...rest } = row
27-
return {
28-
...rest,
29-
includeToolCalls: rest.includeToolCalls ?? false,
30-
hasPassword: Boolean(password),
31-
}
27+
return { ...rest, hasPassword: Boolean(password) }
3228
}
3329

3430
/** A chat can answer only while both it and its workflow deployment are active. */

‎apps/sim/lib/chat-deployments/application/update-chat-deployment.ts‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,7 @@ export const updateChatDeployment = defineAuthorizedWorkspaceUseCase({
217217
if (input.allowedEmails) values.allowedEmails = input.allowedEmails
218218
if (input.outputConfigs) values.outputConfigs = input.outputConfigs
219219
if (input.includeThinking !== undefined) values.includeThinking = input.includeThinking
220-
/** Partial updates keep the stored value; a row predating the column reads false. */
221-
values.includeToolCalls = input.includeToolCalls ?? existing.includeToolCalls ?? false
220+
if (input.includeToolCalls !== undefined) values.includeToolCalls = input.includeToolCalls
222221

223222
const updated = await updateChatDeploymentRow(existing.id, values).catch(
224223
chatIdentifierUniquenessConflict(values.identifier ?? existing.identifier)

0 commit comments

Comments
 (0)