Repository navigation
fix(server): read timeouts, live server Sentry, slim site config, home page 404 - #218
Conversation
A hung read had no limit, and withRetry retries a 5xx, so Cloudflare's ~100 s 524 could hold a render for minutes. fetchWithErrorDetails now passes AbortSignal.timeout(15_000) unless the caller sends its own signal; the timeout classifies as UNKNOWN and is never retried. getAtlasSitemapUrls was the one raw fetch left, so it now reads through sahajCloudFetch like every other custom endpoint. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Server modules called Sentry.capture*, but Sentry.init only ran in the
browser, so nothing server-side was ever sent and SENTRY_DSN was unread.
The Worker export (photon's serve() result, { fetch, server }) is now
wrapped in @sentry/cloudflare's withSentry, which initialises a client
per request from SENTRY_DSN. Server modules import @sentry/cloudflare;
error-utils.ts keeps @sentry/react because ErrorFallback imports it in
the browser, and its calls still reach the Worker client through the
shared @sentry/core (both pinned to 10.76.2). beforeSend strips the
live-preview token from the request URL, as the browser config does.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
An unpublished home page comes back from wm-web-config as a bare id. getWebConfig logged it as unresolved but still returned it cast to a Page, so / rendered blank with a 200. It now returns homePage: null unless the relationship populated, and the existing guard in pages/[slug]/+data.ts 404s. Co-Authored-By: Claude Opus 5.5 <[email protected]>
wm-web-config populated every nav page, and the home page, with the full page select (body, author, video) at depth 2, and the config is serialised into every page's HTML. The live read was ~211 KB; it is now ~1.8 KB. Nav pages carry title, slug and meta (meta.image still populates for the header cards). / now reads its page the way /<slug> does: getPageBySlug with the same locale, preview args and depth 3, on the slug the config names. The canonical and hreflang cluster are unchanged, and a live preview of the home page now shows the draft. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Nothing called getPagesByTags or getSongsByTags (with PAGE_LIST_SELECT, SONG_SELECT and SONG_POPULATE), hasSahajCloudContext, or the PayloadClient type; PageListItem, MeditationListItem, PageMeta, PageReference and TranslationsTab had no readers. createPayloadClient re-validated the API key and base URL that getSahajCloudContext() had just validated with the same schemas, and no caller passed the apiKey/baseURL overrides that made the second check reachable. validatePayloadConfig, PayloadConfigError and payloadConfigSchema go with the overrides. Co-Authored-By: Claude Opus 5.5 <[email protected]>
SahajCloud answers /api/meditations/9999999999 with a 500, so the route spent three retried reads and then rendered a 500. idSchema now refuses anything over 2147483647, and the route 404s without reading. Co-Authored-By: Claude Opus 5.5 <[email protected]>
curl -o without -f wrote a GitHub 404 or rate-limit page into server/payload-types.ts and exited 0. -fsSL fails instead, as SahajAtlasWeb's script does. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
wemeditate-design | 8a5b6ab | Commit Preview URL Branch Preview URL |
Oct 31 2026, 07:32 PM |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
wemeditate-web | 8a5b6ab | Commit Preview URL Branch Preview URL |
Oct 31 2026, 07:32 PM |
sydevs-bot
left a comment
There was a problem hiding this comment.
🧐 Adversarial review
Smaller than the problem it fixes: net −114 lines, five of seven commits deleting a layer. The ladder walk finds nothing bespoke — withSentry and AbortSignal.timeout are the platform's own, sahajCloudFetch and stripLivePreviewToken already existed, and the one new dependency is Sentry's own Cloudflare package.
Two things give pause. The Sentry commit makes a warning real that is known to fire on every request today, with no fix filed for the data behind it. And the narrowing the homePage type earned was not applied to the five sibling fields the same populate slimmed.
Findings
- blocker —
server/entry.ts:16: the server Sentry client makesgetWebConfig's unpublished-page warning send per request, unfixed upstream. - should-fix —
server/sahajcloud-types.ts:84: five page arrays still type as fullPageafter the populate dropped to four fields. - should-fix —
server/validation.ts:44: the int4 cap fixes the rare id; an unknown in-range id still 500s. - should-fix —
package.json:36:^10.76.2is not the pin the body anderror-utils.tsrely on. - consider —
server/sahajcloud-fetch.ts:68: the 15 s bound also cuts the submission POST.
What was checked
Read whole: the four server/ client modules, entry.ts, both Sentry configs, +data.ts, sitemap-routes.ts, the nav consumers. Every reader of the five slimmed arrays needs only title, slug, meta.title, meta.image, so the runtime is right and only the type over-claims. SahajCloudResponseError carries status, so the converted getAtlasSitemapUrls keeps its deleted comment's 5xx retry. SahajCloud#1056 changes no page publication.
Preview: / is 200 and renders "Meditate for Better Mental Health", so the rewritten home read works. /sitemap.xml is empty by design, so the atlas read was unexercised.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
`error-utils.ts` imports `@sentry/react` on the server because the browser imports that module too, and server `Sentry.capture*` reaches the Worker's client only while both packages re-export one `@sentry/core`. A caret on either specifier lets a fresh install resolve two minors apart, which gives each package its own `@sentry/core` and silently stops server reporting. Only the lockfile held that today. `@vidstack/react` in the same block is already exact for the same kind of reason. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjYuHXcAMn935zQ2Q1e
The 15 s read bound landed on the two writes as well. A `POST /api/submissions` cut mid-flight answers the visitor 502 while the upstream `user-submissions` row may already be written, so they resubmit and the duplicate is ours. A read has no such asymmetry: the page simply degrades. So a read keeps 15 s and a write gets 30 s. The write stays bounded, because an unbounded SahajCloud call is the thing this wrapper exists to prevent. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjYuHXcAMn935zQ2Q1e
The int4 cap fixed the rare slice. The common one still 500d: the SDK reports an id the collection does not hold as a 404 throw, and `getDocumentById` let it escape, so `/meditations/999999` — a stale inbound link, a deleted document — rendered the error page. Its own JSDoc already promised `null if not found`, and every caller reads that and renders a 404 itself. Same root cause and same file as the int4 cap, so it belongs beside it rather than in the follow-up ticket the body deferred it to. The retry ladder was never the cost here: a 404 classifies as CLIENT, so `withRetry` already refused it. `readStatus` is exported rather than re-derived, so this reads a status the one way the repo reads one. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjYuHXcAMn935zQ2Q1e
`WEB_CONFIG_POPULATE` gives a config page relationship four fields — `title`, `slug`, `meta.title`, `meta.image` — but `WebConfig` still typed all five arrays as full `Page`. So `page.content` or `meta.description` typechecked at every nav consumer and would arrive `undefined`: the bug the `homePage` narrowing closed, left open five fields over. `NavPage` is that shape, and `NavPageSelect` derives from it, so the read and the type cannot drift — adding a key to `NAV_PAGE_SELECT` without widening `NavPage` is a compile error, and so is dropping one. `pageToLink`, `pageToArticle` and `pickFeaturedArticles` take `NavPage` now, which is all any of them ever read. No runtime change: every consumer already read only those four fields. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjYuHXcAMn935zQ2Q1e
`withSentry` made `getWebConfig`'s unpublished-reference `captureMessage` a real event, and the config read runs once per render with nothing caching it. So the one warning that fires on healthy traffic — `featuredArticles` holds unpublished page id 24 today — would send an event per page view until an editor publishes it. No PR enforces that content edit, so the PR cannot wait on it. Bound the volume rather than the level: one event per distinct gap per Workers isolate, with `console.warn` still on every request. A gap that changes is a new signature and reports at once, and an isolate is recycled often enough that a live gap cannot go unreported. The signature set is capped, since one isolate serves every locale. Lowering the level was the alternative and is worse: a warning nobody can afford to leave on gets turned off, and then the data gap is invisible — which is the thing `server/AGENTS.md` wrote the rule to prevent. That rule now carries the volume requirement instead. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjYuHXcAMn935zQ2Q1e
Three couplings the branch introduced that only prose holds: - A narrowed read returns the narrowed type, paired with a select type derived from it. `NavPage` and `EmbeddedForm` are the two, and the bug this prevents is a consumer typechecking a field no read returns. - `getDocumentById` reads a status itself, which the custom-endpoint reader rule forbids. The rule governs `sahajCloudFetch`'s callers, where a reader pair exists; the SDK has none, so say so rather than leave the next reader to read it as a violation. - A warning on a per-render read is bounded by volume, never by level. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjYuHXcAMn935zQ2Q1e
The security sweep on this branch found the scrub this branch added covers one of three paths. `withSentry` made server events real, and `requestDataIntegration` copies every inbound header onto `event.request.headers`, removing only `cookie` and the IP headers. Its deny-list — `forwarded`, `-ip`, `remote-`, `via`, `-user` — is applied to the URL and the query string, never to the headers, and matches neither of this Worker's two inbound credentials: the live-preview token (`x-sahajcloud-preview-secret`) and the Turnstile token. Both would have gone to Sentry in plaintext, outliving the 45-90 minute token lifetime that bounds the risk. The scrub also now runs from `beforeSendTransaction`. A transaction is not an error event, so `beforeSend` never sees one, and `tracesSampleRate` is read from `SENTRY_TRACES_SAMPLE_RATE` in the Worker env — the same Cloudflare dashboard that holds `SENTRY_DSN`. Tracing could therefore be switched on with no code change and leak the token on every preview page view. Latent today: both POST routes answer their own errors and call no `Sentry.capture*`. It stops being latent the moment one does, and `docs/rules/rest-api.md` requires every read be wrapped in `withRetry`, which captures on each failed attempt. The test asserted the claim in its own name against the URL path only. It now covers the headers and the transaction hook, and fails without the fix. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjYuHXcAMn935zQ2Q1e
`httpServerIntegration` is a default integration and defaults `maxRequestBodySize` to `medium`, so it buffers up to 10 KB of every non-GET body onto the isolation scope before the handler runs. It is gated neither on `sendDefaultPii` nor on `dataCollection.httpBodies`; the only outs are `none` and `ignoreRequestBody`. `requestDataIntegration` then reads it back with `data: true` unconditionally — its own source says `httpBodies` gates write time, not read time. The one public write on this origin is `POST /api/submissions`, whose body is the visitor's name, email address and free-text message. Sending that to Sentry puts data a visitor gave one controller under another's retention, for anyone with project access. Dropped in the scrub rather than by disabling the integration, so it holds whichever integration attaches a body. Nothing needs the body to debug these paths: `sahajcloud-fetch.ts` already logs the upstream error body, which is what says which field SahajCloud objected to. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjYuHXcAMn935zQ2Q1e
Found while reviewing this branch. The `perf(server)` commit made the `index` route fall through to the shared page read instead of returning early, so the home-slug self-redirect below it now runs for `/` as well. A home document an editor slugs `index` therefore redirects `/` to `/`, which routes back to `index` — the site's front page answering nothing but a loop. `slugSchema` accepts `index`, and nothing upstream reserves it. The redirect exists to stop one document answering at two URLs; when the request is already `/` there is no second URL, so `index` is excluded. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjYuHXcAMn935zQ2Q1e
The two scrub commits hold a coupling nothing else enforces: what Sentry attaches is removed in `entry.ts`, not at the capture site, and from both send hooks rather than one. A future inbound credential header is covered only if its name matches `CREDENTIAL_HEADER_SNIPPETS`, which is the thing a reader has to be told to check. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjYuHXcAMn935zQ2Q1e
Deploying wemeditate-design with
|
| Latest commit: |
8a5b6ab
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://a4898be1.wm-design.pages.dev |
| Branch Preview URL: | https://claude-audit-fixes.wm-design.pages.dev |
|
All five threads adopted and resolved, one commit each: Sentry volume Three more, from the security sweep and branch review:
921 tests and the build pass. 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
* fix(review-pr): name how to read a file as the branch has it Step 4 told the critic to "Read/Grep the touched files whole" and did not say how. Three sessions on three distinct days reached for a checkout, had it refused as irreversible local destruction, and each independently recovered with `git show <ref>:<path>`: - 2026-10-27 sydevs/SahajAtlasWeb#340 review-pr, which named the gap: "review-pr step 4 says read the touched files whole and does not say how, and a routine clone sits on a detached HEAD" - 2026-10-28 sydevs/WeMeditateWeb#13 revise - 2026-10-31 sydevs/WeMeditateWeb#218 review-pr, which added the reason the refusal costs nothing: "A critic must not touch the branch anyway, so no work was lost" The refusal is harmless and the recovery is one call, so this buys back a refused call and a rediscovery on each of the week's 50 review-pr dispatches, not a lost run. It lands in step 4 because step 3 already names its own git invocation and its own trap ("Never `FETCH_HEAD`"), so the shape is established and the clause needs no new paragraph. Nothing in workflow/skills or docs/why.md mentioned `git show` or `git checkout` before this. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjWJDL68qx8zBJgZjLF * chore(loop): bump the plugin cache key to 5.3.0 An installed plugin's cache directory is named after `version` and never revisits the commit it recorded, so the skill change above reaches no installed consumer until this string moves. The routines read `main` fresh and do not need it. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjWJDL68qx8zBJgZjLF --------- Co-authored-by: Claude <[email protected]>
Fixes from a workspace-wide audit. One commit per behaviour. The owner approved each behaviour change.
What changes
fix(server)bound every SahajCloud read at 15 swithRetryretried Cloudflare's ~100 s 524 three times. A hung Railway origin held a visitor for about 5 minutes and tripled the load on it.fetchWithErrorDetailsnow passesAbortSignal.timeout, and a timeout is not retried. The last rawfetch(getAtlasSitemapUrls) goes throughsahajCloudFetch.fix(server)send server-side Sentry eventsSentry.capture*with no client, becauseSentry.initran only in the browser. The Worker export is now wrapped in@sentry/cloudflare'swithSentry(pinned to 10.76.2 so it shares@sentry/corewith@sentry/react).fix(server)404 an unpublished home pagehomePagepassed the truthiness guard, so/rendered blank with a 200.perf(server)populate only nav fields in the site config/now reads its page the same way/<slug>does, so the showcase cards, author photo and video thumbnail appear and preview shows drafts.refactor(server)delete dead reads, types and config checksgetPagesByTags,getSongsByTags,hasSahajCloudContext, five unused types, andvalidatePayloadConfig(unreachable:getSahajCloudContext()validates first). About 276 lines.fix(server)404 an id past Postgres int4/meditations/9999999999returned a 500 after three retries.fix(types)failpnpm types:cmson an HTTP errorcurl -owithout-fwrote GitHub's 404 page intopayload-types.tsand exited 0.fix(deps)pin the two Sentry packages exactly@sentry/cloudflareand@sentry/reactminors apart, giving each its own@sentry/core— and serverSentry.capture*then reports nothing. Only the lockfile held that.fix(server)give a write its own timeout bound/api/submissionsPOST abandoned mid-flight answers 502 while the upstream row may already be written, so the visitor resubmits. A read keeps 15 s; a write gets 30 s, still bounded.fix(server)404 an unknown document id/meditations/999999— a stale inbound link, a deleted document — returned 500, becausegetDocumentByIdlet the SDK's 404 throw escape against its ownnull if not foundcontract.fix(server)narrow the config's page arrays to the populated shapeWEB_CONFIG_POPULATEgives a nav page four fields, butWebConfigtyped all five arrays as fullPage, sopage.contenttypechecked everywhere and would beundefined.NavPageis that shape andNavPageSelectderives from it, so the read and the type cannot drift.fix(server)bound the config data-gap warning per isolatewithSentrymadegetWebConfig's unpublished-reference warning a real event on a per-render read, so a standing data gap would bill one Sentry event per page view. One event per distinct gap per Workers isolate now, withconsole.warnunchanged.fix(server)filter credential headers out of Sentry eventsrequestDataIntegrationcopies every inbound header onto an event, removing onlycookieand the IP headers; its deny-list reaches the URL and query string only. The live-preview token and the Turnstile token would have gone to Sentry in plaintext. The scrub also runs frombeforeSendTransaction, whichbeforeSendnever covers.fix(server)drop the request body from Sentry eventshttpServerIntegrationbuffers up to 10 KB of every non-GET body onto the scope, gated on neithersendDefaultPiinorhttpBodies, andrequestDataIntegrationreads it back unconditionally. OnPOST /api/submissionsthat is the visitor's name, email and message.fix(server)never redirect the home page to itselfperf(server)commit made theindexroute fall through to the shared page read, so the home-slug self-redirect now runs for/too. A home page an editor slugsindexwould loop the site's front page.Preview
/meditations/999999— an unknown in-range id. 500 before this push, 404 after/meditations/9999999999— past int4, 404 without a readBoth hosts are branch aliases, so they follow the branch rather than a commit. The links were checked against the pre-push build, where
/meditations/999999still returned 500; that one and the home page change with this push, so re-check them once the deploy lands.Before merging
featuredArticlesholds unpublished page id 24 today, and the warning for it is real now. It sends one event per distinct gap per Workers isolate instead of one per render, so it no longer threatens the quota — but the data gap is still there. Publishing page 24 in SahajCloud is the actual fix.capture*calls reach Sentry. Errors that Hono or Vike catch are still not captured.server/error-utils.tsstays on@sentry/reactbecause browser code imports it. Both specifiers are exact now, so an install cannot split them; keep them equal when either is upgraded.Not changed
/en→/indexfrom the audit does not reproduce onmain; the existing spec already covers it.Tests
.claude/skills/pr-prep/check.shpasses: lint, tsc, and 91 files / 921 tests.pnpm buildpasses.NavPage/NavPageSelectcoupling.vike devserved/with 200 under the Sentry wrapper.Sibling PRs (same audit)
Notes for reviewer
server/AGENTS.md's "log a Sentry warning" rule. Neither is in this repo's hands at merge time, so the commit takes a third: keep the level, bound the volume per isolate. If you would rather this waited on the content edit, say so on that thread and the commit comes out.readStatusis now exported fromserver/error-utils.ts. It is the one place a status is read off an error, andgetDocumentByIdneeded it; nothing else reads a status.^server/triggers it) found two Medium data-exposure gaps in the Sentry surface this branch introduced, both fixed above. Both were latent — the two POST routes answer their own errors and call noSentry.capture*— and both stop being latent as soon as one does, whichdocs/rules/rest-api.mdeffectively asks for by requiringwithRetryon every read. I verified each against the SDK source rather than its docs; the mechanism is in the commit messages.indexredirect loop — is the lastfix(server)commit above.🤖 Generated with Claude Code
https://claude.ai/code/session_01Mg9rjYuHXcAMn935zQ2Q1e