Repository navigation
Revert HTML preview by default for the release (#31575) - #31893
Conversation
Restore source/diff opening for general HTML file-opening routes for the release. This reverts commit 524fa00, retaining the published files.readDocPreview capability for mixed-version clients and removing an unnecessary restored test assertion to satisfy the current lint gate. Existing explicit previews and terminal HTML links retain their previous behavior; the underlying local-file preview exposure remains tracked in STA-11670.
Keep the existing owner checks after file-drop uploads and tab-entry stats so an ownership change cannot reopen a file through a stale host. Preserve local preview source checks so symlinks outside the workspace keep user-file access. The race and symlink tests reproduce failures on the mechanical revert before these guards are retained. Cover HTML source opening for folder workspaces, Explorer, and Source Control without restoring preview-by-default.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ⬆️ High Merge Risk: 🔵 Low · up to
|
There was a problem hiding this comment.
Actionable comments posted: 5
ℹ️ Review info
⚙️ Run configuration
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
f9e9cf5b-a1b0-4bf8-b7d2-3d6c5d11ec56
📒 Files selected for processing: 62
src/renderer/src/components/QuickOpen.mount-gating.test.tsxsrc/renderer/src/components/browser-pane/assemble-chrome/browser-page-toolbar.tsxsrc/renderer/src/components/browser-pane/host-guest/browser-page-webview.tssrc/renderer/src/components/browser-pane/navigate/browser-file-editor-open.test.tssrc/renderer/src/components/browser-pane/navigate/browser-file-editor-open.tssrc/renderer/src/components/browser-pane/navigate/local-html-preview-freshness.test.tssrc/renderer/src/components/browser-pane/navigate/local-html-preview-freshness.tssrc/renderer/src/components/browser-pane/workspace-doc/doc-preview-document-actions.test.tssrc/renderer/src/components/browser-pane/workspace-doc/doc-preview-document-actions.tssrc/renderer/src/components/editor/editor-dropped-file-open.escaping-link.test.tssrc/renderer/src/components/editor/editor-dropped-file-open.tssrc/renderer/src/components/editor/use-editor-group-file-drop-owner.remote.test.tsxsrc/renderer/src/components/editor/use-editor-group-file-drop-owner.test.tsxsrc/renderer/src/components/quick-open-file-navigation.test.tssrc/renderer/src/components/quick-open-file-navigation.tssrc/renderer/src/components/right-sidebar/SourceControl.preview-open.test.tsxsrc/renderer/src/components/right-sidebar/file-explorer-drag-scroll-marker.test.tsxsrc/renderer/src/components/right-sidebar/file-explorer-instant-dir-toggle.test.tssrc/renderer/src/components/right-sidebar/source-control-branch-section-heading.test.tsxsrc/renderer/src/components/right-sidebar/source-control/listing/active-open-file-keys.tssrc/renderer/src/components/right-sidebar/source-control/listing/branch-entry-row.tsxsrc/renderer/src/components/right-sidebar/source-control/listing/branch-section.tsxsrc/renderer/src/components/right-sidebar/source-control/listing/open-uncommitted-entry.test.tssrc/renderer/src/components/right-sidebar/source-control/listing/open-uncommitted-entry.tssrc/renderer/src/components/right-sidebar/source-control/listing/section-action-buttons.test.tsxsrc/renderer/src/components/right-sidebar/source-control/listing/section-file-list.tsxsrc/renderer/src/components/right-sidebar/source-control/listing/uncommitted-sections.tsxsrc/renderer/src/components/right-sidebar/source-control/listing/use-file-listing.tssrc/renderer/src/components/right-sidebar/source-control/listing/use-row-opening.tssrc/renderer/src/components/right-sidebar/source-control/listing/use-selection.tssrc/renderer/src/components/right-sidebar/source-control/notes/use-note-opening.tssrc/renderer/src/components/right-sidebar/source-control/panel/panel-content.tsxsrc/renderer/src/components/right-sidebar/source-control/panel/use-panel-model.tssrc/renderer/src/components/right-sidebar/use-file-explorer-tree-pane-state.tssrc/renderer/src/components/right-sidebar/useFileExplorerHandlers.test.tssrc/renderer/src/components/right-sidebar/useFileExplorerHandlers.tssrc/renderer/src/components/status-bar/workspace-space-open-change.test.tssrc/renderer/src/components/status-bar/workspace-space-open-change.tssrc/renderer/src/components/tab-bar/tab-create-entry-absolute-file.tssrc/renderer/src/components/tab-bar/tab-create-entry-action.test.tssrc/renderer/src/components/tab-bar/tab-create-entry-action.tssrc/renderer/src/components/tab-bar/tab-create-entry-local-path.test.tssrc/renderer/src/components/tab-bar/tab-create-entry-preview.test.tssrc/renderer/src/components/terminal-pane/terminal-file-link-editor-open.tssrc/renderer/src/components/terminal-pane/terminal-file-open-routing.tssrc/renderer/src/components/terminal-pane/terminal-link-file-open-routing.test.tssrc/renderer/src/components/terminal-pane/terminal-link-handlers-test-fixtures.tssrc/renderer/src/components/terminal-pane/terminal-link-handlers-test-harness.tssrc/renderer/src/components/terminal-pane/terminal-link-handlers.tssrc/renderer/src/components/terminal-pane/terminal-link-open-beside-source.test.tssrc/renderer/src/components/terminal-pane/terminal-link-remote-runtime-ssh-open.test.tssrc/renderer/src/lib/file-preview-tab.tssrc/renderer/src/lib/file-preview.test.tssrc/renderer/src/lib/file-preview.tssrc/renderer/src/lib/open-html-file-preview.test.tssrc/renderer/src/lib/open-html-file-preview.tssrc/renderer/src/lib/workspace-file-open.test.tssrc/renderer/src/lib/workspace-file-open.tssrc/renderer/src/lib/workspace-file-preview-page.tssrc/shared/html-file-url.tstests/e2e/html-file-url-opening.spec.tstests/e2e/html-source-control-preview.spec.ts
💤 Files with no reviewable changes: 12
- src/renderer/src/components/QuickOpen.mount-gating.test.tsx
- src/renderer/src/components/browser-pane/navigate/local-html-preview-freshness.test.ts
- src/renderer/src/lib/workspace-file-open.test.ts
- src/renderer/src/lib/file-preview-tab.ts
- tests/e2e/html-source-control-preview.spec.ts
- src/renderer/src/components/browser-pane/host-guest/browser-page-webview.ts
- src/renderer/src/components/right-sidebar/source-control/listing/branch-entry-row.tsx
- src/renderer/src/lib/workspace-file-preview-page.ts
- src/renderer/src/lib/workspace-file-open.ts
- src/renderer/src/components/right-sidebar/source-control/listing/active-open-file-keys.ts
- src/renderer/src/components/tab-bar/tab-create-entry-local-path.test.ts
- src/renderer/src/components/browser-pane/navigate/local-html-preview-freshness.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
| if (refuseExplicitNonEditorRoute()) { | ||
| return | ||
| } | ||
| activateAndRevealWorktree(worktreeId, { providesInitialSurface: true }) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
#!/bin/bash
# Check whether the removed activateAndRevealWorkspace/executionHostId call in the HTML route came from a later change.
git log -S"activateAndRevealWorkspace" --oneline -- src/renderer/src/components/terminal-pane/terminal-file-open-routing.ts | head -10
rg -n -C3 "activateAndRevealWorkspace|activateAndRevealWorktree" src/renderer/src/components/terminal-pane/terminal-file-open-routing.tsRepository: stablyai/orca
Length of output: 2172
Activate the workspace with activateAndRevealWorkspace and pass the resolved executionHostId.
The browser route can receive a folder-workspace key or a worktree ID that exists on multiple execution hosts. Use the workspace dispatcher and preserve the resolved host, as the editor route already does.
Suggested fix
--- "a/src/renderer/src/components/terminal-pane/terminal-file-open-routing.ts"
+++ "b/src/renderer/src/components/terminal-pane/terminal-file-open-routing.ts"
@@ -254,7 +254,12 @@
if (refuseExplicitNonEditorRoute()) {
return
}
- activateAndRevealWorktree(worktreeId, { providesInitialSurface: true })
+ activateAndRevealWorkspace(worktreeId, {
+ providesInitialSurface: true,
+ ...(hostWorkspaceFile?.executionHostId
+ ? { executionHostId: hostWorkspaceFile.executionHostId }
+ : {})
+ })
openFileInBrowserTab({ filePath: mappedFilePath, worktreeId })
return
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| activateAndRevealWorktree(worktreeId, { providesInitialSurface: true }) | |
| activateAndRevealWorkspace(worktreeId, { | |
| providesInitialSurface: true, | |
| ...(hostWorkspaceFile?.executionHostId | |
| ? { executionHostId: hostWorkspaceFile.executionHostId } | |
| : {}) | |
| }) |
| function openDocPreviewTab( | ||
| state: AppState, | ||
| params: { filePath: string; worktreeId: string; activate: boolean }, | ||
| placement?: Pick<CreateBrowserTabOptions, 'targetGroupId' | 'split'> | ||
| ): void { | ||
| const docLocation = { | ||
| kind: 'workspace-doc' as const, | ||
| worktreeId: params.worktreeId, | ||
| filePath: params.filePath | ||
| } | ||
| // Why reuse and not a second tab: previewing a document already on screen is a request to look at | ||
| // it, and two tabs of one document would each hold their own grant on the same file. | ||
| const existing = findWorkspaceShowingDoc(state, docLocation) | ||
| if (existing) { | ||
| if ( | ||
| !params.activate || | ||
| !activateBrowserWorkspaceTab({ | ||
| worktreeId: params.worktreeId, | ||
| ...existing | ||
| }) | ||
| ) { | ||
| state.setActiveBrowserTab(existing.workspaceId) | ||
| state.setActiveBrowserPage(existing.workspaceId, existing.pageId) | ||
| } | ||
| return | ||
| } | ||
| state.createBrowserTab(params.worktreeId, ORCA_BROWSER_BLANK_URL, { | ||
| docLocation, | ||
| title: basename(params.filePath) || params.filePath, | ||
| ...placement, | ||
| // Why explicitly client-local: the document is read through a grant this desktop mints, so the | ||
| // page never belongs to a remote runtime even when the worktree does. | ||
| browserRuntimeEnvironmentId: null, | ||
| // Why the caller decides: opening a file is a request to look at it, while a preview opened to | ||
| // the side belongs beside the source the reader is still working in. | ||
| activate: params.activate | ||
| }) | ||
| } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
sed -n '145,230p' src/renderer/src/lib/file-preview.ts
rg -n 'targetGroupId|openFileInBrowserTab|openDocPreviewTab' src/renderer/src/lib/open-html-file-preview.ts src/renderer/src/lib/file-preview.test.ts src/renderer/src/components/tab-bar/tab-create-entry-action.tsRepository: stablyai/orca
Length of output: 5644
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- diff file-preview against merge base ---'
git diff --unified=80 95f8f73b9a373948e1b97d6d012a7df26a7f984c 043552c12a4dc50507ce860ba75cf643660e9e84 -- src/renderer/src/lib/file-preview.ts
printf '%s\n' '--- activation helper definitions and usages ---'
rg -n -F --glob '*.ts' --glob '*.tsx' -e 'function activateBrowserWorkspaceTab' -e 'activateBrowserWorkspaceTab' -e 'findWorkspaceShowingPage' -e 'findWorkspaceShowingDoc' src/renderer/src
printf '%s\n' '--- focused tests ---'
sed -n '1,330p' src/renderer/src/lib/file-preview.test.ts
printf '%s\n' '--- tab/group state declarations and create implementation references ---'
rg -n -F --glob '*.ts' --glob '*.tsx' -e 'browserTabsByWorktree' -e 'browserPagesByWorkspace' -e 'createBrowserTab' -e 'targetGroupId' src/renderer/src/lib src/renderer/src/store src/renderer/src/components | head -240Repository: stablyai/orca
Length of output: 41465
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- current activation helper ---'
sed -n '1,180p' src/renderer/src/lib/browser-workspace-tab-activation.ts
printf '%s\n' '--- old openFilePreviewTab at merge base ---'
git show 95f8f73b9a373948e1b97d6d012a7df26a7f984c:src/renderer/src/lib/file-preview-tab.ts
printf '%s\n' '--- current HTML preview caller ---'
sed -n '1,100p' src/renderer/src/lib/open-html-file-preview.ts
printf '%s\n' '--- current caller context ---'
sed -n '120,225p' src/renderer/src/components/tab-bar/tab-create-entry-action.ts
printf '%s\n' '--- relevant tests with existing document and target group ---'
rg -n -C 12 -F --glob 'file-preview.test.ts' -e 'group-2' -e 'browserPagesByWorkspace' -e 'existing' -e 'targetGroupId'
printf '%s\n' '--- browser create contract and implementation ---'
rg -n -F --glob '*.ts' -e 'export type CreateBrowserTabOptions' -e 'interface CreateBrowserTabOptions' -e 'createBrowserTab:' -e 'createBrowserTab (' src/renderer/src/store/slices/browser src/renderer/src/store | head -160Repository: stablyai/orca
Length of output: 32621
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- old page lookup contract ---'
git show 95f8f73b9a373948e1b97d6d012a7df26a7f984c:src/renderer/src/lib/workspace-file-preview-page.ts
printf '%s\n' '--- current page lookup and browser tab options ---'
sed -n '1,115p' src/renderer/src/lib/workspace-file-preview-page.ts
sed -n '1,105p' src/renderer/src/store/slices/browser/browser-tab-actions.ts
sed -n '30,70p' src/renderer/src/store/slices/browser/browser-slice-contract.tsRepository: stablyai/orca
Length of output: 6760
Honor targetGroupId when reusing document previews.
When a document is open in another group, openDocPreviewTab finds it globally and activates that group before it applies targetGroupId. This breaks explicit group placement. Scope the existing-page lookup to the requested group, as the previous openFilePreviewTab implementation did.
Suggested fix
- const existing = findWorkspaceShowingDoc(state, docLocation)
+ const existing = findWorkspaceShowingDoc(state, docLocation, placement?.targetGroupId)
...
function findWorkspaceShowingDoc(
state: AppState,
- docLocation: BrowserPageDocLocation
+ docLocation: BrowserPageDocLocation,
+ targetGroupId?: string
): { workspaceId: string; pageId: string } | null {
for (const tab of state.browserTabsByWorktree[docLocation.worktreeId] ?? []) {
+ if (
+ targetGroupId &&
+ !state.unifiedTabsByWorktree[docLocation.worktreeId]?.some(
+ (candidate) =>
+ candidate.contentType === 'browser' &&
+ candidate.entityId === tab.id &&
+ candidate.groupId === targetGroupId
+ )
+ ) {
+ continue
+ }
const page = (state.browserPagesByWorkspace[tab.id] ?? []).find((candidate) =>
browserPageDocLocationsEqual(candidate.docLocation ?? null, docLocation)
)
ELI5
Clicking an HTML file in Explorer, Quick Open, an editor file drop, or Source Control returns to showing its source or diff, as before #31575. This defers automatic HTML rendering so the rest of the release can proceed while preview security is addressed separately.
What Changed
Revert #31575 (524fa00) on current main, preserving later changes where Git merged them. Retain the published
files.readDocPreviewruntime capability for compatibility with newer clients.The review found and fixed three regressions in the mechanical rollback by retaining the existing guards: ownership changes during file-drop uploads, ownership changes during tab-bar file checks, and source opening through symlinks that lead outside the workspace. These checks apply independently of preview-by-default.
Explicit HTML preview actions, HTML file URLs, and terminal Cmd/Ctrl-click retain their previous behavior.
Why
Preview-by-default expanded an existing local HTML preview vulnerability to ordinary file-inspection actions. This rollback reduces the new exposure without waiting for a restricted local preview implementation. It does not fix the pre-existing explicit-preview or terminal-link exposure.
Supersedes the previously closed revert #31770 following the decision to defer preview-by-default for this release.
Linked Issue
Release mitigation for STA-11670. The underlying preview vulnerability remains open.
Visual Proof
Before: general HTML file-opening actions create a live preview. After: those actions open the editor or existing diff view. Screenshots were not captured; no desktop app was launched. The restored routing is covered by the automated checks below.
Testing
Broad affected-area suite: 388 files, 3,384 tests passed after the review fixes. Covers Source Control, Explorer, Quick Open, terminal links, file drops, tab entry, browser file sources, explicit previews, and workspace file routing.
Reproduced both ownership regressions on the mechanical rollback with HTML and ordinary text files (4 failing cases), then verified they pass with the retained checks.
Reproduced the symlink source-access regression before retaining the existing local-source checks, then verified it passes.
Added coverage for source opening in folder workspaces and extended the existing Explorer and Source Control cases to
.htmland.HTMfiles.ORCA_BACKGROUND_LAUNCH=1 pnpm tc: passed all four projects.ORCA_BACKGROUND_LAUNCH=1 pnpm run build:electron-vite: passed after the fixes.ORCA_BACKGROUND_LAUNCH=1 pnpm run check:code-quality:changed: passed all scans, no new findings.E2E typecheck ratchet: passed, matching the repository's 222 grandfathered errors. The raw E2E typecheck is not clean; the changed HTML spec has no diagnostics.
git diff --check: passed.macOS unit/type/lint/build validation only. Rendered Electron checks were not run locally because the
$electronskill required by the repo is unavailable in this session. Native Windows/Linux and live SSH/mobile checks remain for CI.I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Review
Audited the reverse patch against #31575, inspected later overlapping Source Control and terminal changes, checked removed module callers and mixed-version runtime compatibility, and reproduced/fixed the three incidental regressions described above. The deliberate behavior change is restoring source/diff opening for general HTML file actions. The previously shipped live-preview exposure remains tracked separately.
The revert and review fixes are isolated from the existing Cmd+J workspace; its staged diff is unchanged. Cross-platform/Electron CI is still required before merging.
Agent skill upstream boundary
Notes
Restores existing cross-platform file-opening, remote, and folder-workspace routing. No RPC method is removed;
files.readDocPreviewremains advertised for mixed-version compatibility. Mobile code is unchanged. This is a release mitigation; existing live local previews still need the security fix tracked in STA-11670.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)Relevant local checks passed as listed above; full checks remain for CI.