Skip to content

Commit 0719879

Browse files
committed
bubble up storage ref errors
1 parent 06e7b4f commit 0719879

2 files changed

Lines changed: 33 additions & 11 deletions

File tree

apps/sim/lib/execution/payloads/store.test.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,28 @@ describe('large execution payload store', () => {
472472
expect(mockDownloadFile).not.toHaveBeenCalled()
473473
})
474474

475+
it('fails loudly when reference tracking fails before returning cached durable refs', async () => {
476+
const scope = {
477+
workspaceId: 'workspace-1',
478+
workflowId: 'workflow-1',
479+
executionId: 'execution-1',
480+
}
481+
const ref = {
482+
__simLargeValueRef: true,
483+
version: 1,
484+
id: 'lv_TRACKFAIL12',
485+
kind: 'object',
486+
size: 32,
487+
key: 'execution/workspace-1/workflow-1/execution-1/large-value-lv_TRACKFAIL12.json',
488+
executionId: 'execution-1',
489+
} as const
490+
cacheLargeValue(ref.id, { retained: true }, ref.size, scope, { recoverable: true })
491+
mockAddLargeValueReference.mockRejectedValueOnce(new Error('reference cap exceeded'))
492+
493+
await expect(materializeLargeValueRef(ref, scope)).rejects.toThrow('reference cap exceeded')
494+
expect(mockDownloadFile).not.toHaveBeenCalled()
495+
})
496+
475497
it('enforces maxBytes before returning cached refs', async () => {
476498
const scope = {
477499
workspaceId: 'workspace-1',

apps/sim/lib/execution/payloads/store.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -214,18 +214,18 @@ export async function materializeLargeValueRef(
214214
return materializeLargeValueRefSync(ref, context)
215215
}
216216

217-
try {
218-
const { addLargeValueReference } = await import('@/lib/execution/payloads/large-value-metadata')
219-
await addLargeValueReference(
220-
{
221-
workspaceId: context.workspaceId,
222-
workflowId: context.workflowId,
223-
executionId: context.executionId,
224-
source: 'execution_log',
225-
},
226-
ref.key
227-
)
217+
const { addLargeValueReference } = await import('@/lib/execution/payloads/large-value-metadata')
218+
await addLargeValueReference(
219+
{
220+
workspaceId: context.workspaceId,
221+
workflowId: context.workflowId,
222+
executionId: context.executionId,
223+
source: 'execution_log',
224+
},
225+
ref.key
226+
)
228227

228+
try {
229229
const cached = materializeLargeValueRefSync(ref, context)
230230
if (cached !== undefined) {
231231
return cached

0 commit comments

Comments
 (0)