Repository navigation
feat(map): describe /map from the atlas root, not the site defaults - #158
Conversation
`AtlasSeoResponse` carried only `region` and `event`, so nothing here knew the root answer existed and the short-circuit that skips the read looked correct to anyone opening the file. Re-mirrored from `src/endpoints/responseTypes.ts` on SahajCloud main at 37e93b3: `type: 'root'` has `id: null` — the only member that does — and content carrying only `paragraphs`. `AtlasContent` dispatched with a ternary, so an answer that was not `region` rendered as an event. A root answer has no `content.title`, so it would have produced an empty `<h1>` once the read lands. A `switch` makes the next upstream variant a type error instead. The root names no region and no event, so `RootContent` takes its heading from the answer's own `title` and walks no ancestry. This commit changes no behaviour: nothing yet asks for the root. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_014PPrDQtiU8vAiA7uPZEBY2
`/map` inherited the global site title and description and emitted no canonical, so the front door of the atlas read to a crawler as a duplicate of the homepage, while every region and class page beneath it was fully described. `parseAtlasRoute` returned `null` for the root, `getAtlasSeo` short-circuited on that `null`, and `+data.ts` handed `seo: null` to the page. Upstream has answered the root since SahajCloud's `type: 'root'` variant landed; nothing here consumed it. The port now distinguishes two answers that it used to collapse into one. A route reducing to no segments is the root — `/` and every bare view route, since a view of the root is still the root. `null` is kept for a string to refuse: over the length or segment ceiling, or carrying a query, fragment or whitespace. Collapsing those into the root would answer a malformed URL with a real page. That also moves the segment cap ahead of the reserved-word filter, matching upstream. Measured after, a route of twenty `/search` segments reduced to zero segments and would now be answered as the landing page. `getAtlasSeo` asks for the normalized route on a root hit rather than the spelling it was given. The edge in front of SahajCloud keys on the whole URL, so a crawler grinding through `/map/search` and `/map/calendar` costs one cache entry instead of one each — keeping the benefit the deleted short-circuit's comment claimed. Every head value is served by the endpoint for `?locale=`, so no English string reaches a non-English page's head and nothing is authored twice. Four doc comments asserted that this site owns the root's metadata because no SahajCloud document describes it. That is now false, and they move with the code. Gate: lint (0 errors), tsc --noEmit, 828 tests. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_014PPrDQtiU8vAiA7uPZEBY2
The comment claimed a fourth upstream variant would be a type error here. It was not. `noImplicitReturns` is off and React accepts the `undefined` a missing branch returns, so a new member would have compiled silently and served a head describing content the body never rendered — the failure this file keeps citing. Verified both ways by injecting a fourth member into `AtlasSeoResponse`: `tsc` exited 0 before the `never` assignment and reports TS2322 after it. Also folds the paragraph loop both variants render into one `Paragraphs`. The plain-text-never-dangerouslySetInnerHTML invariant and the defensive read for a hand-mirrored field now live once, which is what upstream intends by giving the root the same block shape as an event. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_014PPrDQtiU8vAiA7uPZEBY2
…g root Two observability gaps in the root read. A Sentry event named `options.route` while the request and its label used the normalized route, so one event could read `/search/filters` beside `getAtlasSeo(/) failed: 403` and match no URL anyone could find. Both are carried now, named for which is which, and `console.warn` uses the asked-for URL's normalized form too. A 404 on the root was swallowed as an ordinary stale link. Upstream builds that answer from a global, so it has no document to lose: a 404 there means the atlas root is misconfigured upstream, and silently returning `null` restores the undescribed `/map` this branch exists to fix with nothing logged to say why. Renames the local to `upstreamRoute`, since `route` and `options.route` in one scope is how the first gap happened. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_014PPrDQtiU8vAiA7uPZEBY2
The first pass restated one fact — the root is described, `null` now means refused — in eight places across five files, and `docs/rules/code-comments.md` says to apply the razor to comments kept, not only to those cut. Cuts: the `root carries no key` block narrated the type beside it; half of `parseAtlasRoute`'s doc repeated the module header; `+data.ts` restated its own field doc twelve lines down; `atlas-types.ts` spent nine lines on a one-field interface. `+Page.tsx` said the meaning changed "now", which reads wrong to anyone who never saw the diff. Also drops the surviving "which cache TTL applies" rationale from the module header. Nothing in this repo picks a TTL since the KV layer went (#98), and `getAtlasSeo` never branches on `target.kind` for one, so that clause pointed at machinery that no longer exists. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_014PPrDQtiU8vAiA7uPZEBY2
…hat can Two of the new head cases asserted only the fixture. `emits no English into a non-English head` matched the French title against an English regex, and `describes a bare view route as the root` changed an `atlasRoute` that `useAtlasHead` never receives — `+Page.tsx` passes it only to `atlasEmbedSrc`. The surviving first case already pins that the head comes from the document rather than a locally authored string. That criterion is enforced structurally and by the two guards under `tests/guards/`, not by a regex on a fixture. `counts segments before reserved words are dropped` used twenty segments, which stops pinning the cap: raise the cap to anything under twenty while the filter order regresses and the test still passes. Thirteen is one over, matching the row upstream. Also: the `no server content` case passed `atlasRoute: '/'`, now the one route guaranteed to have a document; the client suite re-asserted `parseAtlasRoute`'s segment cap, which would make that constant a two-file change; and the root body had two cases for one `?? []` where only `undefined` can throw. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_014PPrDQtiU8vAiA7uPZEBY2
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
wemeditate-web | fdcabdb | Commit Preview URL Branch Preview URL |
Oct 10 2026, 01:59 AM |
|
🤖 no session running recent dispatchesWritten by the sydevs dispatcher. Sessions never edit this comment. |
sydevs-bot
left a comment
There was a problem hiding this comment.
🧐 Adversarial review
Sized to its ticket: 311/−74 for seven criteria. The one piece beyond them, reordering the segment cap, corrects a real drift from upstream's parser and belongs in the port. RootContent and the shared Paragraphs path are forced by the change, not added beside it.
Confirmed live on the branch preview, which the body still lists as pending. /map serves Free Meditation Classes, a self-referencing canonical, four hreflang rows and a WebSite JSON-LD; /map/search serves the same; /map/gb/london is unchanged. But /map still emits the global site description, because the live root answer carries none — so half of #64 does not close on merge.
The locale criteria are unverifiable here: /fr itself 404s on this deployment, so manual step 3 shows the site default for a reason unrelated to the diff.
Findings
- should-fix — the exhaustive
defaultturns an unknown upstream variant into an SSR throw.AtlasContent.tsx:299 - should-fix — AC2 is open: the live root answer has no description, and the only test of it asserts a fixture.
Page.test.tsx:50 - consider — collapsing the root route to
/is unasked-for and half-applied.atlas-client.ts:77
What was checked
Ticket #64 against the diff. The mirror against SahajCloud main 37e93b3 (responseTypes.ts:144, atlasRoute.ts) — faithful, cap order included. Followed the root canonical upstream: rootCanonical → canonicalTargetFor (regionOwners.ts:320) falls back to this site's own origin and atlas base path, so it self-references by construction. Read AtlasContent.tsx, atlas-client.ts, atlas-route.ts, +Page.tsx, +data.ts whole; sahajCloudFetchOptional is silent on 404, so the new root warning is not a duplicate. Reproduced the default branch on react-dom 19.3. Curled four routes on preview and production.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
The `never` assignment made a fourth upstream variant a compile error, but returned the narrowed value, which at runtime is the response object. React throws `Objects are not valid as a React child` on an object child, and `+Page.tsx` wraps `<AtlasContent>` in no boundary, so an unrecognised `type` 500s the route where `main`'s ternary still rendered markup. That path is reachable without `tsc` ever seeing it: `AtlasSeoResponse` is hand-mirrored and `sahajCloudFetchOptional<AtlasSeoResponse>` casts, so a new member arrives from the endpoint first — as `root` just did on this branch. Returning `null` keeps both guards. Injecting a fourth member into the union still fails the build with TS2322 at the assignment, and the head, which `useAtlasHead` derives from fields every variant shares, still describes the page when the body cannot render it. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01QQBgjqXhDBk4179qFJZxD2
The degrade warning named `upstreamRoute`, which is `/` for every root spelling. A `/map/search` read that failed logged `degrading to widget-only for /`, so the one line a reader reaches for first could not say which URL degraded. The Sentry event beside it already carried both. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01QQBgjqXhDBk4179qFJZxD2
`padding-line-between-statements` wants a blank line before the `void`, and this branch should not add the one warning it would cost. The rule is a warning, so the gate passed either way. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01QQBgjqXhDBk4179qFJZxD2
Deploying wemeditate-design with
|
| Latest commit: |
9b91da2
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://4a1863b5.wm-design.pages.dev |
| Branch Preview URL: | https://claude-feat-64-atlas-root-se.wm-design.pages.dev |
Review addressed — 2 adopted, 1 rebuttedAdopted
Rebutted, left open for you
Gate green, build included. Pushed b80f14e. 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
The `Paragraphs` wrapper held one `.map` over two call sites and cost a jump to read either. `ContentOverlay` already renders its blocks inline, so this matches the shape the repo uses elsewhere. Nothing load-bearing moved with it: the never-`dangerouslySetInnerHTML` rule stays in the module comment, and the shared block shape is recorded on `AtlasSeoRootContent` upstream of this file. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_019kpCM2FMS6sczJYzqfMa4M
The fixture's locale is deliberate, and the old one-liner did not say what it buys: the root is the one atlas answer whose copy upstream localizes, while the canonical is locale-free for every kind. A reader hitting the French strings next to an English canonical had to guess which of the two was the bug. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_019kpCM2FMS6sczJYzqfMa4M
Review addressed — 1 adopted, 2 rebuttedAdopted
Rebutted, left open for you
Gate green: lint 0 errors, 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
Summary
/mapnow takes its title, description and canonical from SahajCloud'stype: 'root'answer instead of inheriting the global site defaults./map/search,/map/calendar) resolve to that same root document, since a view of the root is still the root.Change outline
The main change is which decision the root reaches.
parseAtlasRoutetreated "reduces to no segments" as "no document exists", so the read never happened and the head stayed empty.data(pageContext) pages/map/+data.ts getAtlasSeo({ route, locale }) server/atlas-client.ts parseAtlasRoute(route) lib/atlas-route.ts - drop reserved words, then cap segments - zero segments → null # "nothing describes this" + cap the raw segments, then drop reserved words # 20x /search stays unreadable + zero segments → { kind: 'root' } - null → short-circuit, never calls out - → seo: null + GET /api/atlas/seo?route=%2F&locale=<locale> # every root spelling → one URL + 404 → Sentry warning # the root has no document to lose + → seo: { type: 'root', … } useAtlasHead(seo) lib/atlas-head.tsx - null → contributes nothing → site defaults + title, description, canonical, hreflang, og, JSON-LDnullkeeps its other meaning — a string this site refuses to read — so a malformed URL is still not answered with a real page.Types
Re-mirrored from SahajCloud
mainat37e93b3.rootis the only member whoseidisnull.AtlasSeoResponse server/atlas-types.ts + | { type: 'root'; id: null; content: { paragraphs: string[] } } | { type: 'region'; id: number; content: AtlasSeoRegionContent } | { type: 'event'; id: number; content: AtlasSeoEventContent }Components
The old ternary sent anything that was not
regiontoEventContent, which would have readcontent.titleoff an answer that has none.The
defaultbranch carries both guards on purpose. Theneverassignment makes a fourth upstream member a build failure; returningnullrather than the narrowed value keeps the runtime arrival — which is howrootitself first appeared, since the type is hand-mirrored and the read casts — from handing React an object and 500ing a route that has no error boundary.Preview
Confirmed on the branch preview, https://claude-feat-64-atlas-root-seo-wemeditate-web.contact-c66.workers.dev. None of this is verifiable locally (see Manual verification).
/map<title>Free Meditation Classes</title>, self-referencing canonical, twohreflangrows,WebSiteJSON-LD. Description still the site default — see Manual verification 1./map/search,/map/calendar/map./map/gb/londonLondon, United Kingdom, canonical…/map/gb/south-east/london.Test results
tsc --noEmit, 824 testslib/atlas-route.test.ts,server/atlas-client.test.ts,pages/map/Page.test.tsx,pages/map/_components/— all passingpnpm build(run becauseserver/changed)neverassignment, build fails.Net test count against
mainfalls by 4: five new cases landed — four root cases and the unknown-variant boundary — and nine were removed as unable to fail or as duplicating another file's ownership. See thetest(map):commit.Manual verification
The atlas endpoint 403s for the
We Meditate Web (LOCAL)client, which holds nosahaj-atlas-clientrole, so the root read cannot be exercised locally at all — it has to be confirmed on the deployed preview.curl -s <preview>/map | grep -E '<title>|name="description"|rel="canonical"'— the title and the canonical land. The description does not, and this is not a root-specific gap: production/map/gb/londononmainserves the same global default, so the live endpoint omitsdescriptionfor every kind. AC2's description half does not close on merge. See Known follow-ups.curl -s <preview>/map/searchand/map/calendar— the same metadata as/map. ✓curl -s <preview>/fr/map— unverified:/fr/map404s on the preview, and so does production's, so the locale criteria cannot be exercised on either deployment. Pre-existing, and not this diff's.curl -s <preview>/map/gb/london— unchanged. ✓ Note the preview serves twohreflangrows here, not the eleven this ticket recorded onmain; the count follows upstream data, not this diff./maprenders a heading and the landing copy for a no-JS reader, before the widget replaces it.Notes for reviewer
map, not the ticket'sseo.seois not a scope ingit log, and AGENTS.md forbids inventing one.mapis already in use./fr/mapemits the locale-free canonical…/map, so a non-English atlas URL canonicalizes to the English one. That is upstream's stated design (AtlasSeoBase.canonicalis documented locale-free, with the locale carried in thehreflangcluster as?locale=instead), and it is pre-existing for every region and class page — this change extends it to the landing page. Criterion 4 asks that both be "correct in every atlas locale", which they are in the sense that each locale is described in its own language. If you want/fr/mapto self-canonicalize, that is an upstream change to the endpoint, not something to rebuild here.switchmade a fourth upstream variant a type error. It did not:noImplicitReturnsis off and React accepts theundefineda missing branch returns. Injecting a fourth member intoAtlasSeoResponsegavetscexit 0 before theneverassignment and TS2322 after it. The assignment alone was still not enough — see Components, andfix(map): render nothing for an unknown atlas variant./searchsegments therefore reduced to the root here while staying a refusal upstream. Fixed in the same commit as the port, since a drifted port is what that file's⚠exists to prevent.rootSeo/rootAnswerfixtures assumetype: 'root'carriesid: nulland acontentof onlyparagraphs. Verified againstsrc/endpoints/responseTypes.tson SahajCloudmainat37e93b3, not against the ticket's description of it.Detail
Review findings and their outcomes.
lib/atlas-route.test.tsto four, since five rows are one equivalence class. Rejected: that file's whole purpose is to hold a table identical to upstream'stests/unit/atlas-seo-route.spec.ts, so a divergence shows up as a failing test. Trimming it to be tidier is exactly the drift it guards against.ContentOverlayrenders its blocks inline too, and nothing load-bearing was in the wrapper: the never-dangerouslySetInnerHTMLrule is in the module comment, and the shared block shape is documented onAtlasSeoRootContent.route: '/', so/is the honest cache key for that one case. Normalising every kind changes caching for region and class routes, which is the follow-up below rather than this PR. The one cost named with it — aconsole.warnthat printed the normalized route — is fixed.RegionContent? Rebutted, thread left open.buildRootSeoreturnscontent: { paragraphs }andbreadcrumbs: []— none of thename,level,eventsoreventCountRegionContentreads — and builds them from thesy-atlas-translationsglobal rather than a region row. A crawlable countries list needs the endpoint to return children first.Known follow-ups, not widened into this PR.
/api/atlas/seoanswer carries nodescriptionfor any kind: production/map/gb/londononmainand this preview's/mapboth fall back to the global site description, andlib/atlas-head.tsxemits the field only when the answer supplies it. So/mapgains its title and canonical on merge but not its own description. The fix is to populatedescriptionupstream — for the root and for every other kind — and no code change in this repo is waiting on it./map/gb/london/calendar,/online,/registerand the legacy/regions/...prefixes all resolve to the same upstream document but are still forwarded verbatim, so each spelling is its own edge entry. The deeper fix is forparseAtlasRouteto return the normalized route for every kind, which would change caching for region and class routes — out of scope here./mapnow emits a canonical but appears in no sitemap:GET /api/atlas/sitemaphas no root handling, so this is an upstream change.A consequence worth knowing. The retry ladder is now on
/map's critical path. An incident confined to/api/atlas/seocan add ~3s to the front door's TTFB before it degrades to widget-only, where previously that endpoint could not slow/mapat all. The same exposure every region page already carries; it now includes the busiest route. A 403 is classified CLIENT and not retried, so local dev pays one round trip rather than the ladder.Why the new read is close to free in steady state.
+data.tsalready wraps it inPromise.allwithloadSiteContext, which is itself two sequential round trips, so on an edge hit the atlas read finishes inside the existing critical path.server/atlas-types.tsis hand-mirrored, sopnpm types:cmswas not run. That command regeneratesserver/payload-types.ts, which covers collections only; a custom endpoint's response shape is not in it. No contract sync is triggered by this PR.Closes #64
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code