Repository navigation
feat(preview): closable right slot with file preview pane - #7
Conversation
Scopes a preview mode for the right workspace slot: images, text, Markdown and code read through bounded main-process IPC, follow-selection, and disabled cross-pane ops when the peer is not a listing.
…isting pane
item:preview now seeds the recommended target through setSlot('preview', target),
so the follow-selection effect must not re-seed from the left listing on slot
entry; a signature ref gates it to later left selection changes. F5/Copy-> and
F6/Move-> also go dead-disabled with a log when no listing pane is active,
instead of resolving to a null command set and silently doing nothing.
Real JPEGs carry 100 KB+ of ICC/EXIF/XMP APPn segments before the SOF marker, so the 64 KiB probe window from 9a44c9c rejected files the synchronous createFromPath fallback had always decoded, losing preview and listing thumbnails. Raise the window to 1 MiB and cover the layout with a crafted SOF-beyond-64-KiB JPEG in both the decode and probe tests.
|
Warning Amazon Q Developer for GitHub: end of support On January 30, 2027, AWS will discontinue support for the Amazon Q Developer for GitHub App. New app installations will no longer be available starting November 18, 2026. For capabilities similar to the Amazon Q Developer for GitHub App, explore Kiro and the Kiro GitHub App. For more information about the end of support, see Amazon Q Developer end-of-support announcement on the AWS DevOps Blog. |
There was a problem hiding this comment.
Review Summary
This PR introduces a well-structured preview pane with IPC-bounded file reading, Markdown rendering via react-markdown, and a closable right workspace slot. The security model — resolveLocalPath path validation, safeExternalUrl protocol/credential gating, and renderer-side shell:openUrl routing — is sound. The read loop in readText correctly handles short reads and truncation. The sequence counter in PreviewPane correctly prevents stale IPC replies from repopulating closed state.
One logic defect found: The "Open" button in the unsupported-reason UI incorrectly appears for symlink results. The backend deliberately refuses symlinks (using lstat specifically to avoid following links), but the renderer does not exclude 'symlink' from the button condition, so the UI offers to open a path that was intentionally rejected. See the inline comment for the one-line fix.
You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.
| body = ( | ||
| <div className="preview-error"> | ||
| <p>{REASONS[result.reason]}</p> | ||
| {result.reason !== 'folder' && result.reason !== 'not-found' ? ( |
There was a problem hiding this comment.
🛑 Logic Error: The symlink reason is not excluded from showing the "Open" button, but this is inconsistent and potentially wrong — a symlink was refused specifically because following it was not allowed. Presenting an "Open" button for a symlink result will call onOpen(result.path) with the symlink path, which then calls shell.openPath on the symlink itself; on some platforms the OS follows the link, on others it fails silently. The intent of refusing symlinks in the backend was to avoid indirection, so the UI should not offer to open them either. Add 'symlink' to the exclusion condition.
| {result.reason !== 'folder' && result.reason !== 'not-found' ? ( | |
| {result.reason !== 'folder' && result.reason !== 'not-found' && result.reason !== 'symlink' ? ( |
Summary
browse | preview | closed, persisted with the layout; closing collapses the grid to one pane, and Split/Preview reopen it.maximizedis kept consistent so a closed slot never leaves a ghost.fs:previewclassifies, validates and reads in main: images (32 MiB, 4096 px display edge, 40 MP pre-decode header probe on the synchronous fallback), UTF-8 text (1 MiB cap with byte-accurate truncation flag), NUL-byte binary sniff, BOM strip; regular files only, folders/symlinks/devices refused, ENOENT → not-found.PreviewPanerenders images, text, Markdown (react-markdown + remark-gfm, no raw HTML) and source code; HTML shows as source. http(s)-only links open throughshell:openUrl→safeExternalUrl; CSP keeps remote images inactive.Test plan
npm run ci— typecheck clean, 36 test files / 260 passed / 1 skipped (Windows symlink privilege), production build OK×/Split round-trip, F5 greying, right-click Preview in Pane, Markdown/HTML renderingNotes
Deferred minors are recorded in the session ledger (slot-pill lit state, some listing-only toolbar buttons still no-op without a listing pane, no renderer test harness, link-click failure replaces the document). PDF/audio/video/SVG preview intentionally deferred per ADR-0006.