Repository navigation
Add the artifact list, viewer, and publish dialog - #1402
innoavator wants to merge 4 commits into
Conversation
Signed-in users can publish a previewed page and open the shared link from the sidebar. Co-authored-by: Cursor <cursoragent@cursor.com>
🦋 Changeset detectedLatest commit: 412d3f5 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
PR overviewThe PR adds an artifact list, an artifact viewer, and a dialog for publishing artifact files to everyone in a tenant. Two issues remain open, with none addressed so far. The publish dialog hides file paths by default, making it harder for users to notice when page references include other sandbox files before sharing them tenant-wide. With analytics enabled, viewer events also send user-authored filenames and artifact slugs to PostHog, potentially exposing customer or project details. Open issues (2)
Fixed/addressed: 0 · PR risk: 4/10 Reviews |
| closeLibraryAgent, | ||
| schedulesOpen, | ||
| setSchedulesOpen, | ||
| artifactsOpen, |
There was a problem hiding this comment.
Artifacts overlay blocks returning to chat
High Severity
openHistorySession and the layout Back to chat handlers close other overlays but never clear artifactsOpen or artifactView. Layouts render the artifacts list and viewer instead of the thread while those flags stay set, so Open session and Back to chat leave the user stuck on the artifact surface. The same gap is in selectLibraryAgent and the thread-list row handler.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit c9341f1. Configure here.
| <div className="px-4 py-3"> | ||
| <Markdown content={text ?? ''} /> | ||
| </div> | ||
| ); |
There was a problem hiding this comment.
Markdown viewer ignores content URL
Medium Severity
Published Markdown is rendered from fetched text only, and contentUrl is unused for that kind. Relative images and other bundle files then resolve against the app route instead of the content-token base URL, so they do not load in the artifact viewer.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit c9341f1. Configure here.
| return () => { | ||
| cancelled = true; | ||
| }; | ||
| }, [artifacts, query]); |
There was a problem hiding this comment.
Artifact list keeps stale error
Low Severity
A successful listArtifacts response never clears error. After a failed first load, a later successful search still shows the previous error above the results.
Reviewed by Cursor Bugbot for commit c9341f1. Configure here.
| const [title, setTitle] = useState(suggestedTitle); | ||
| const [slug, setSlug] = useState(''); | ||
| const [note, setNote] = useState(''); | ||
| const [showFiles, setShowFiles] = useState(false); |
There was a problem hiding this comment.
Low: Files published tenant-wide are hidden by default
This dialog is where the user agrees to make files readable by everyone in the tenant, but by default it only shows "N files · X KB". The paths stay hidden behind "Show files" (closed here and reset to closed on line 49). The server builds the bundle from references in the page, and resolveToAbsolute in collectBundle.ts accepts relative ../ references to any absolute sandbox path. So an LLM-written page, possibly shaped by prompt injection, can pull in uploaded data or credential files from elsewhere in the sandbox without the user noticing. Show the file list by default. Also add a visible warning when the bundle reaches outside the page's folder. preview.entryPath containing a / is a direct signal, because it means preview.root sits above the entry file's directory.
| files={selected.files.map(file => ({ path: file.path, detail: formatBytes(file.sizeBytes) }))} | ||
| {...(selectedPath != null ? { selectedPath } : {})} | ||
| onSelect={path => { | ||
| track(AnalyticsEvents.Artifact.FILE_SELECTED, { path }); |
There was a problem hiding this comment.
Low: User-authored artifact metadata sent to analytics
The frontend forwards these properties unchanged to PostHog (packages/frontend/src/App.tsx:202–205), so filenames containing customer or project details are exported whenever a file is selected with analytics enabled. Omit path here and the user-authored slug from VIEWER_OPENED on line 34; use an opaque artifact ID if correlation is needed.
| track(AnalyticsEvents.Artifact.FILE_SELECTED, { path }); | |
| track(AnalyticsEvents.Artifact.FILE_SELECTED); |
| setError(null); | ||
| } catch (caught) { | ||
| if (!cancelled) setError(caught instanceof Error ? caught.message : 'Could not open artifact'); | ||
| } |
There was a problem hiding this comment.
Viewer keeps stale artifact on failure
Medium Severity
Changing slug or version does not clear artifact, selected, or token before the next fetch. A missing artifact or failed version load leaves the previous page on screen behind the error. The version <select> is bound to selected.version, so it also snaps back to the old version until the new one finishes loading.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 2a154d9. Configure here.
| }; | ||
|
|
||
| const showBackToChat = showDesktopOnlyNotice || libraryOpen || schedulesOpen || environmentsOpen; | ||
| const showBackToChat = showDesktopOnlyNotice || libraryOpen || schedulesOpen || artifactsOpen || environmentsOpen; |
There was a problem hiding this comment.
Back to chat skips artifacts close
Medium Severity
Back to chat is shown for the artifacts list and viewer, but the handlers never call setArtifactsOpen(false) or closeArtifactViewer. They only close library, schedules, sessions, and environments. Closing currently works only because setSchedulesOpen dismisses artifacts even when it is already closed, unlike the other overlay setters.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit 2a154d9. Configure here.
A second publish compared a bundle-relative path with the sandbox path, so it always created a new artifact. The UI now joins the stored source root, keeps an edited title, and reads created_by_subject plus a files-free latest version. Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
There are 7 total unresolved issues (including 5 from previous reviews).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 412d3f5. Configure here.
| } | ||
| setEnvironmentsOpenState(environmentsEnabled && open); | ||
| }, | ||
| [environmentsEnabled, setSessionsOpen], |
There was a problem hiding this comment.
Artifact overlays close through schedules
Medium Severity
setSchedulesOpen always calls dismissArtifacts, including when closing. Back to chat, New Chat, and openHistorySession never call setArtifactsOpen(false) or closeArtifactViewer, so leaving an artifact depends on that side effect and will strand the user if the setter is aligned with the other overlays.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit 412d3f5. Configure here.
| > | ||
| Delete | ||
| </button> | ||
| ) : null} |
There was a problem hiding this comment.
Delete shown without failure handling
Medium Severity
Delete is always shown and both deleteArtifact and downloadVersion ignore rejection. A 403 from a non-owner, or any download failure, becomes an unhandled promise rejection with no error in the viewer.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 412d3f5. Configure here.


Summary
/artifacts/<slug>.?version=, copies the link, opens the source session, and downloads one file or a zip.feat/artifacts.Test plan
?version=and copy that pinned linkpnpm --filter @truefoundry/trueforge-ui exec vitest run test/routing/paths.test.ts test/routing/derivePlace.test.ts test/server/serverChrome.test.tsMade with Cursor
Note
Medium Risk
New user-facing publishing and sandboxed HTML viewing touch session file bundles and authenticated content URLs; behavior depends on a stacked backend PR.
Reviewed by Cursor Bugbot for commit 412d3f5. Bugbot is set up for automated code reviews on this repo. Configure here.
Part of #1403