Skip to content

Preview HTML files by default - #31575

Merged
AmethystLiang merged 7 commits into
mainfrom
open-html-in-html
Oct 21, 2026
Merged

AmethystLiang merged 7 commits into
mainfrom
open-html-in-html

Conversation

@AmethystLiang

@AmethystLiang AmethystLiang commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 27 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1654 $\color{#cf222e}{\Huge{\mathbf{−}}}$​213 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1441
Prod 36 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​856 $\color{#cf222e}{\Huge{\mathbf{−}}}$​477 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​379

Problem

Opening an HTML file often showed its source or a diff instead of the rendered page, depending on where it was opened.

Solution

Use one file-opening path so HTML opens as a preview by default across Explorer, quick open, tabs, terminal links, file drops, and Source Control. Explicit source and line-link actions still open the editor; deleted, conflicted, or unavailable files still open as diffs.

ELI5

What Changed

HTML files now render in Orca by default and expose an "Open source file" action for editing. File-opening behavior is centralized, preserves split placement, reuses existing previews, and routes remote files through their owning host.

Why

This makes opening HTML consistent regardless of entry point while retaining source editing and diff views when rendering is not appropriate.

Linked Issue

No linked issue.

Fixes #

Visual Proof

E2E coverage captures Explorer and Source Control HTML previews. Attach before/after screenshots or videos to the PR.

Testing

Added/updated unit and E2E coverage for HTML previews, source opening, Source Control, terminal links, file drops, and host changes.

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

AI Disclosure

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Considered Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, backwards compatibility, and performance.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@coderabbitai

coderabbitai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f58b97a4-9d79-4ab5-8d02-824955d65f8b
📥 Commits

Reviewing files that changed from the base of the PR and between 39df511 and 24836c0.

📒 Files selected for processing: 2
  • src/renderer/src/components/QuickOpen.mount-gating.test.tsx
  • src/renderer/src/components/editor/editor-dropped-file-open.escaping-link.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.

📝 Walkthrough

The change adds openWorkspaceFile as a shared route for workspace files, previews, links, and change entries. File Explorer, quick open, tab creation, Source Control, editor drops, and terminal links now use this route. HTML files can open in browser previews when eligible, with editor or diff fallbacks for other intents or unsupported preview plans. Preview handling supports client-local paths and page reuse by tab group. Source-file actions and host-change checks are also updated.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to 24836

The reviewed routing fixes both previously reported opening issues, and no concrete merge-blocking risk remains.

Pre-merge checks: Passed 3 · Failed 2

Failed Failed checks: 2 warnings

Check name Status Explanation Resolution
Description check Warning The description explains the problem, solution, scope, and testing coverage. It does not provide the required linked issue, visual proof, manual-testing status, or confirmation that the standard check… Add an actual issue reference in the Fixes section, attach before-and-after screenshots or a video for this UI change, mark manual testing complete if performed, and report the status of pnpm lint, pnpm typecheck, pnpm test, and pnpm build …
Docstring Coverage Warning Docstring coverage is 20.83% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 72 functions across 59 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 3 passed
Check name Status Explanation
Title check Passed The title clearly summarizes the primary change: HTML files now open as previews by default.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description explains the problem, solution, scope, and testing coverage. It does not provide the required linked issue, visual proof, manual-testing status, or confirmation that the standard checks pass or that CI will cover them.

Resolution

Add an actual issue reference in the Fixes section, attach before-and-after screenshots or a video for this UI change, mark manual testing complete if performed, and report the status of pnpm lint, pnpm typecheck, pnpm test, and pnpm build or state that CI will cover them.

✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments: 1
tests/e2e/html-file-url-opening.spec.ts: 1

66-74: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Prefer DOM assertions for the single-page and tab-ownership checks.

The e2e guidelines say to assert user-visible behavior through the DOM, not through store state. Two assertions read window.__store directly:

  • The page count at Lines 66-74.
  • The tab.url === url && !tab.docLocation check at Lines 113-121.

Store reads can pass while rendering is broken. The guest-content poll at Lines 103-112 already covers rendering. For reuse, you can assert that only one tab with the file name is visible in the tab bar. For the plain-browser versus doc-preview distinction, assert that the "Open source file" control is visible, as Line 123 does.

If you keep the store assertions as a model-level backstop, treat them as secondary to a DOM assertion.

As per coding guidelines, tests/e2e/**: "Use window.__store for setup; assert user-visible behavior through the DOM (getByRole, toBeVisible, toHaveText)."

Also applies to: 113-121

Source: Coding guidelines


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c1d0621b-d03b-4c77-a198-7f5e88b300e5
📥 Commits

Reviewing files that changed from the base of the PR and between cfd9e9c and ab96d02.

📒 Files selected for processing: 53
  • src/renderer/src/components/browser-pane/assemble-chrome/browser-page-toolbar.tsx
  • src/renderer/src/components/browser-pane/navigate/browser-file-editor-open.test.ts
  • src/renderer/src/components/browser-pane/navigate/browser-file-editor-open.ts
  • src/renderer/src/components/browser-pane/workspace-doc/doc-preview-document-actions.test.ts
  • src/renderer/src/components/browser-pane/workspace-doc/doc-preview-document-actions.ts
  • src/renderer/src/components/editor/editor-dropped-file-open.ts
  • src/renderer/src/components/editor/use-editor-group-file-drop-owner.remote.test.tsx
  • src/renderer/src/components/quick-open-file-navigation.test.ts
  • src/renderer/src/components/quick-open-file-navigation.ts
  • src/renderer/src/components/right-sidebar/SourceControl.preview-open.test.tsx
  • src/renderer/src/components/right-sidebar/file-explorer-drag-scroll-marker.test.tsx
  • src/renderer/src/components/right-sidebar/file-explorer-instant-dir-toggle.test.ts
  • src/renderer/src/components/right-sidebar/source-control-branch-section-heading.test.tsx
  • src/renderer/src/components/right-sidebar/source-control/listing/branch-entry-row.tsx
  • src/renderer/src/components/right-sidebar/source-control/listing/branch-section.tsx
  • src/renderer/src/components/right-sidebar/source-control/listing/open-uncommitted-entry.test.ts
  • src/renderer/src/components/right-sidebar/source-control/listing/section-action-buttons.test.tsx
  • src/renderer/src/components/right-sidebar/source-control/listing/section-file-list.tsx
  • src/renderer/src/components/right-sidebar/source-control/listing/uncommitted-sections.tsx
  • src/renderer/src/components/right-sidebar/source-control/listing/use-file-listing.ts
  • src/renderer/src/components/right-sidebar/source-control/listing/use-row-opening.ts
  • src/renderer/src/components/right-sidebar/source-control/listing/use-selection.ts
  • src/renderer/src/components/right-sidebar/source-control/notes/use-note-opening.ts
  • src/renderer/src/components/right-sidebar/source-control/panel/panel-content.tsx
  • src/renderer/src/components/right-sidebar/source-control/panel/use-panel-model.ts
  • src/renderer/src/components/right-sidebar/use-file-explorer-tree-pane-state.ts
  • src/renderer/src/components/right-sidebar/useFileExplorerHandlers.test.ts
  • src/renderer/src/components/right-sidebar/useFileExplorerHandlers.ts
  • src/renderer/src/components/status-bar/workspace-space-open-change.test.ts
  • src/renderer/src/components/status-bar/workspace-space-open-change.ts
  • src/renderer/src/components/tab-bar/tab-create-entry-absolute-file.ts
  • src/renderer/src/components/tab-bar/tab-create-entry-action.test.ts
  • src/renderer/src/components/tab-bar/tab-create-entry-action.ts
  • src/renderer/src/components/tab-bar/tab-create-entry-local-path.test.ts
  • src/renderer/src/components/tab-bar/tab-create-entry-preview.test.ts
  • src/renderer/src/components/terminal-pane/terminal-file-open-routing.ts
  • src/renderer/src/components/terminal-pane/terminal-link-file-open-routing.test.ts
  • src/renderer/src/components/terminal-pane/terminal-link-handlers-test-fixtures.ts
  • src/renderer/src/components/terminal-pane/terminal-link-handlers-test-harness.ts
  • src/renderer/src/components/terminal-pane/terminal-link-handlers.ts
  • src/renderer/src/components/terminal-pane/terminal-link-remote-runtime-ssh-open.test.ts
  • src/renderer/src/lib/editor-file-link-open.ts
  • src/renderer/src/lib/file-preview.test.ts
  • src/renderer/src/lib/file-preview.ts
  • src/renderer/src/lib/open-html-file-preview.test.ts
  • src/renderer/src/lib/open-html-file-preview.ts
  • src/renderer/src/lib/workspace-file-changes-open.ts
  • src/renderer/src/lib/workspace-file-open.test.ts
  • src/renderer/src/lib/workspace-file-open.ts
  • src/renderer/src/lib/workspace-file-preview-page.ts
  • src/shared/html-file-url.ts
  • tests/e2e/html-file-url-opening.spec.ts
  • tests/e2e/html-source-control-preview.spec.ts
💤 Files with no reviewable changes: 3
  • src/renderer/src/lib/open-html-file-preview.ts
  • src/renderer/src/lib/open-html-file-preview.test.ts
  • src/renderer/src/components/right-sidebar/source-control/panel/use-panel-model.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

- Preserve source, diff, and host-safety behavior across all entry points
- Reuse previews within the requested editor group and support branch HTML files
@AmethystLiang

Copy link
Copy Markdown
Contributor Author

@coderabbitai Fixing. Will be in the next commit

@coderabbitai

coderabbitai Bot commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

@AmethystLiang Thanks for the update. The finding remains unresolved until the fix is available for review.

You are interacting with an AI system.

@AmethystLiang
AmethystLiang merged commit 524fa00 into main Oct 21, 2026
52 of 53 checks passed
AmethystLiang added a commit that referenced this pull request Oct 22, 2026
* Revert "Preview HTML files by default" (#31575)

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.

* Preserve file ownership and symlink guards during HTML preview rollback

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.

* fix: split tab entry browser requests to satisfy lint limit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant