Skip to content

Commit bf87c51

Browse files
authored
fix(tests): cross the large-array threshold with 64 wide rows instead of 120k (#8939)
The durable-manifest test built 120,000 small rows (~16 MB). Compaction walks every element (a promise, Object.entries and JSON.stringify per row and per field), so the test ran 575-1522 ms on healthy CI runners and 10.6 s on a contended one, timing out. 64 rows whose payloads sum to LARGE_VALUE_THRESHOLD_BYTES cross the same threshold with the same assertions; the 9 MB string tests beside it run in ~50 ms.
1 parent c55698a commit bf87c51

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

‎apps/sim/lib/function-execution/execute-request.test.ts‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,10 @@ vi.mock('@/lib/function-execution/sandbox-mounts', () => ({
172172
import { validateExternalUrl } from '@/lib/core/security/input-validation'
173173
import { clearLargeValueCacheForTests } from '@/lib/execution/payloads/cache'
174174
import { isLargeArrayManifest } from '@/lib/execution/payloads/large-array-manifest-metadata'
175-
import { isLargeValueRef } from '@/lib/execution/payloads/large-value-ref'
175+
import {
176+
isLargeValueRef,
177+
LARGE_VALUE_THRESHOLD_BYTES,
178+
} from '@/lib/execution/payloads/large-value-ref'
176179
import * as fileMaterialization from '@/lib/execution/payloads/materialization.server'
177180
import { executeFunctionRequest } from '@/lib/function-execution/execute-request'
178181
import { ResolvedSecretTraceRegistry } from '@/executor/utils/resolved-secret-trace-registry'
@@ -820,11 +823,13 @@ describe('Function execution request', () => {
820823

821824
describe('Basic Function Execution', () => {
822825
it('compacts large array result fields to manifests when execution context is durable', async () => {
826+
// Compaction cost scales with element count, so a few wide rows cross the threshold cheaply.
827+
const rowCount = 64
823828
mockExecuteInIsolatedVM.mockResolvedValueOnce({
824829
result: {
825-
rows: Array.from({ length: 120_000 }, (_, index) => ({
830+
rows: Array.from({ length: rowCount }, (_, index) => ({
826831
key: `SIM-${index}`,
827-
payload: 'x'.repeat(100),
832+
payload: 'x'.repeat(LARGE_VALUE_THRESHOLD_BYTES / rowCount),
828833
})),
829834
},
830835
stdout: '',
@@ -846,7 +851,7 @@ describe('Function execution request', () => {
846851
expect(data.output.result.rows).toMatchObject({
847852
__simLargeArrayManifest: true,
848853
kind: 'array',
849-
totalCount: 120_000,
854+
totalCount: rowCount,
850855
})
851856
})
852857

0 commit comments

Comments
 (0)