Skip to content

Commit 89d7544

Browse files
committed
fix(merge): repair three regressions the staging merge surfaced
- cloud-review-tools.test.ts: the merge kept the branch's import line (which had dropped `symlink` along with the test that used it) while taking staging's reinstated test body, so the symlink-escape assertion would have thrown ReferenceError on CI. tsconfig excludes *.test.ts, so type-check could not catch it. Restored the import and the workflow's ripgrep install step, which the branch removed alongside the same test. - createByteRangeResponse defaulted to `public, max-age=31536000` while its sibling createFileResponse defaults to `private, no-cache` and says in a comment why. resolveServeCacheControl returns undefined for any unversioned non-`workspace` context, so those access-verified media responses landed on the public default — storable by a shared cache and re-servable cross-user, where staging sent `private, no-cache`. Defaults now match. - ReadOnlyTextPreview: restored staging's `flex … flex-col` on the rich preview wrapper. Every PreviewPanel renderer sizes itself as a flex item, so in a block parent HtmlPreview measures a zero-height box, never mounts its iframe, and nothing ever grows the container to un-wedge it — shared .html and .svg rendered blank.
1 parent a4984be commit 89d7544

7 files changed

Lines changed: 123 additions & 110 deletions

File tree

.github/workflows/test-build.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,11 @@ jobs:
142142
- name: Type-check all workspaces
143143
run: bunx turbo run type-check
144144

145+
# cloud-review-tools.test.ts runs the real helper on the runner, which shells
146+
# out to rg. Blacksmith's image ships it, GitHub's doesn't.
147+
- name: Install ripgrep
148+
run: command -v rg || (sudo apt-get update && sudo apt-get install -y ripgrep)
149+
145150
# Runs the setup CLI's Bun tests plus each workspace's Vitest suite,
146151
# without `--coverage`. See the Codecov note below.
147152
- name: Run tests

apps/sim/app/api/files/utils.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,11 @@ export async function createByteRangeResponse(options: ByteServeOptions): Promis
306306
const headers: Record<string, string> = {
307307
'Content-Type': contentType,
308308
'Content-Disposition': `${disposition}; ${encodeFilenameForHeader(options.filename)}`,
309-
'Cache-Control': options.cacheControl || 'public, max-age=31536000',
309+
// Same default as createFileResponse, and for the same reason: a byte-served object
310+
// reaches here only after access verification, so an unspecified policy must never
311+
// let a shared cache/CDN store it and re-serve it cross-user. Public assets pass an
312+
// explicit `cacheControl`.
313+
'Cache-Control': options.cacheControl || 'private, no-cache',
310314
'X-Content-Type-Options': 'nosniff',
311315
'Accept-Ranges': 'bytes',
312316
}

apps/sim/components/resources/file-view/file-view.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -394,11 +394,16 @@ const ReadOnlyTextPreview = memo(function ReadOnlyTextPreview({ file }: { file:
394394

395395
const resolvedError = resolvePreviewError((error as Error | null) ?? null, null)
396396
if (resolvedError) return <PreviewError label='file' error={resolvedError} />
397-
if (isLoading || content == null) return <PreviewLoadingFrame className='h-full' tone='surface' />
397+
if (isLoading || content == null)
398+
return <PreviewLoadingFrame className='min-h-0 flex-1' tone='surface' />
398399

399400
if (resolvePreviewType(file.type, file.name)) {
400401
return (
401-
<div className='h-full min-h-0 w-full overflow-auto'>
402+
// `flex flex-col` is load-bearing, not decoration: every PreviewPanel renderer sizes
403+
// itself as a flex item (`flex min-h-0 flex-1`). In a block parent that grow is inert,
404+
// the renderer collapses to auto height, and HtmlPreview — which gates its iframe on a
405+
// measured non-zero box — deadlocks and paints nothing.
406+
<div className='flex min-h-0 w-full flex-1 flex-col overflow-auto'>
402407
<PreviewPanel
403408
content={content}
404409
mimeType={file.type}
@@ -411,7 +416,7 @@ const ReadOnlyTextPreview = memo(function ReadOnlyTextPreview({ file }: { file:
411416
}
412417

413418
return (
414-
<div className='h-full min-h-0 w-full overflow-auto bg-[var(--surface-1)] p-4'>
419+
<div className='min-h-0 w-full flex-1 overflow-auto bg-[var(--surface-1)] p-4'>
415420
<pre className='whitespace-pre-wrap break-words font-mono text-[var(--text-body)] text-small'>
416421
{content}
417422
</pre>

apps/sim/executor/handlers/pi/cloud-review-tools.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* @vitest-environment node
33
*/
44
import { execFile } from 'node:child_process'
5-
import { mkdir, mkdtemp, rm, writeFile as writeLocalFile } from 'node:fs/promises'
5+
import { mkdir, mkdtemp, rm, symlink, writeFile as writeLocalFile } from 'node:fs/promises'
66
import { tmpdir } from 'node:os'
77
import { join } from 'node:path'
88
import { promisify } from 'node:util'

apps/sim/lib/execution/sandbox/bundles/docx.cjs

Lines changed: 21 additions & 21 deletions
Large diffs are not rendered by default.

apps/sim/lib/execution/sandbox/bundles/pdf-lib.cjs

Lines changed: 21 additions & 21 deletions
Large diffs are not rendered by default.

apps/sim/lib/execution/sandbox/bundles/pptxgenjs.cjs

Lines changed: 62 additions & 63 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)