Repository navigation
fix(workspaces): return 404 for missing workspace files - #857
Draft
posthog[bot] wants to merge 1 commit into
Draft
posthog[bot] wants to merge 1 commit into
posthog[bot] wants to merge 1 commit into
Conversation
requireActiveWorkspaceItemRow now throws a typed WorkspaceItemNotFoundError. The file preview and file content routes map it to a 404, so a request for a deleted item does not capture an exception or return a 500. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Generated-By: PostHog Desktop Task-Id: 0aa3d0b8-dd54-49d4-9c4c-239fb752b47b
|
Important Review skippedBot user detected. To trigger a single review, invoke the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
|
React Doctor found no new issues. 🎉 Reviewed by React Doctor for commit |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
PREVIEW_LOAD_FAILEDinstead of a not-found state. Each request also captures an exception in error tracking.requireActiveWorkspaceItemRowthrows a plainErrorwhen the row does not exist. The preview and content routes catch onlyWorkspaceForbiddenError, so the not-found case goes toapiFailure.Origin
c869ac8Changes
WorkspaceItemNotFoundErrorreplaces the plainErrorinrequireActiveWorkspaceItemRow. The message stays the same, so other callers see no change.apiFailure, so it captures no exception.GET …/files/$itemId/preview(missing item)PREVIEW_LOAD_FAILED+ exceptionPREVIEW_NOT_FOUNDGET …/files/$itemId/content(missing item)FILE_LOAD_FAILED+ exceptionFILE_NOT_FOUNDThe 404 codes are the same codes that these routes already return when the stored object is missing.
Testing
workspace-file-routes.test.ts: both routes return 404 and record no operational failure. Without the route change, both tests fail with a 500.vp check(format, lint, types): pass.vp test --run --project=node src/features/workspaces: 81 files, 365 tests pass.workerstest project andvp build. The change does not touch Durable Object code or the build.Agent context
requireActiveWorkspaceItemRow(server functions, AI tools) still treat the error as a generic failure. I did not change them, to keep this PR focused on the reported routes.Closes #856
Refs #733
Created with PostHog Desktop from this inbox report.
🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need.