Repository navigation
Preview HTML files by default - #31575
Conversation
|
Note Reviews pausedIt 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
Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to
|
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments: 1
tests/e2e/html-file-url-opening.spec.ts: 1
66-74: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valuePrefer 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.__storedirectly:
- The page count at Lines 66-74.
- The
tab.url === url && !tab.docLocationcheck 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/**: "Usewindow.__storefor 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
📒 Files selected for processing: 53
src/renderer/src/components/browser-pane/assemble-chrome/browser-page-toolbar.tsxsrc/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/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.tssrc/renderer/src/components/editor/use-editor-group-file-drop-owner.remote.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/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/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-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-remote-runtime-ssh-open.test.tssrc/renderer/src/lib/editor-file-link-open.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-changes-open.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: 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
|
@coderabbitai Fixing. Will be in the next commit |
|
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. |
ab96d02 to
fbfc4af
Compare
* 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
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.
AI Disclosure
Review
Agent skill upstream boundary
Notes
Considered Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, backwards compatibility, and performance.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)