fix: return not found for unknown page conversations - #14
Conversation
NathanTarbert
left a comment
There was a problem hiding this comment.
Thanks @charan-rathore, this is nicely scoped. Matching only the "does not belong" message keeps everything else, including real Intelligence failures, on the generic 503, and the test pins that down. Answering with 404 rather than 403 also means the route doesn't confirm that someone else's conversation exists, which is the right call.
One thing worth knowing for later. The same message from requireThread still comes back as 503 on the workspace routes, because it matches the Conversation prefix in that handler. So after this, an unknown conversation is a 404 on page routes and a 503 on workspace routes. That doesn't need to change here. It fits with the direction in #11 and #28, and could be a small follow-up so both agree.
Looks good to me.
jerelvelarde
left a comment
There was a problem hiding this comment.
Useful API behavior fix: missing or inaccessible conversations return the same safe 404 response, while unrelated upstream failures remain generic 503 responses. Fits the existing ownership boundary and preserves current page receipt behavior. Route tests cover missing/foreign conversations and withholding upstream error details. No actionable findings. Individual checks pass; combined tree passes 233 tests, type checking, lint, formatting, and production build.
What this fixes
On the page routes, asking for a conversation id that does not exist (or belongs to someone else) returned a generic
503telling the user to check the Intelligence setup. That points at the wrong thing: the caller used a bad conversation id.Changes
404.503, and the response text does not leak more than before.Tests
Four endpoint regression tests (they fail on the base commit), including one that checks genuine Intelligence errors stay
503.Results below are from the person who prepared the change; I did not rerun them. Full suite: 34 files, 161 tests pass. Lint, typecheck, format check and production build pass (the build prints a chunk size warning that was already there). No UI or dependency changes.
Note
This touches
src/server/page-routes.tsandtests/page-routes.test.ts. Open PR #11 changesworkspace-routes.tsand also adds a test totests/page-routes.test.ts, so whichever lands second may need a small rebase on the test file. The code changes do not overlap.