Skip to content

feat(api): /api/atlas/seo answers the atlas root and bare view routes - #769

Merged
sydevs-bot merged 14 commits into
mainfrom
claude/feat-739-atlas-seo-root
Sep 12, 2026
Merged

sydevs-bot merged 14 commits into
mainfrom
claude/feat-739-atlas-seo-root

Conversation

@sydevs-bot

@sydevs-bot sydevs-bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • ?route=/ and every bare view route now return one document instead of a 404. The rule is that a route left empty once RESERVED_SEGMENTS is dropped is the root — /search and /register, but also /events and /events/areas.
  • The landing page's title and description are operator-written, on a new seo group on sy-atlas-translations — per your call on feat(api): /api/atlas/seo answers the atlas root and bare view routes #739. A locale nobody has written a title for is named by its own common.free_meditation_classes, not by English.
  • A 404 now means "not a route we will read" or "no such region or class". Naming nothing and being malformed stay different answers.

Changes

  • src/endpoints/atlas/seo/atlasRoute.ts — third variant { kind: 'root' }; the segment cap moved above the reserved-word filter.
  • src/endpoints/atlas/seo/rootStrings.ts — new: the landing page's copy, and the fallback chain. Reads common and seo in one query.
  • src/lib/atlas/regionOwners.ts — canonicalOwnerForClient exported; the Atlas: unowned regions are in nobody's sitemap (the We Meditate fallback) #652 fallback lookup now goes through it.
  • src/lib/atlas/canonicalUrl.ts — canonicalMountUrl, which canonicalUrlBase now builds on.
  • src/lib/translations/clientEnglishFallback.ts — withoutEnglishFallback(req), a supported opt-out, built on localeIsolatedReq.

Preview

https://sahajcloud-sahajcloud-pr-769.up.railway.app — deployed green.

Contract impact

AtlasSeoResponse gains a third union member (type: 'root', id: null), so id is now nullable. Existing consumers narrow on type and are unaffected; nobody has to adopt the new variant.

  • sydevs/SahajAtlasWordpress — consumes it by default, with an opt-out. Its includes/seo.php suppresses the host's SEO plugin only after a successful fetch, and seo.php:57-63 returns early for / today, so the root view keeps the host's own metadata until that plugin adopts the new variant.
  • docs(embedding): document the head metadata a host writes per atlas route SahajAtlasWeb#173 — raised the gap; docs/embedding.md records the host-facing rule once this lands.

No pnpm types:cms step for the endpoint. The seo group does change src/payload-types.ts, so both consumers pick it up on the ordinary generate-types → merge → types:cms sequence.

Migration

  • New migration: src/migrations/20260912_031449_atlas_translations_seo_group.ts
  • Impact: one jsonb column on sy_atlas_translations_locales and its versions twin. Additive, no backfill, no data touched.
  • Reversible: yes — down drops both columns.

Test results

  • Lean gate: ✓ lint, tsc over src/ and tests/, 1717 unit tests
  • Targeted specs: atlas-seo + translations-globals — 71 passed after the second review round
  • Build: N/A — Railway builds the preview
  • origin/main merged in (4ce9b5f), which brought refactor(fields): declare a JSON column with one jsonField helper #756's jsonField refactor. The gate was re-run after the merge, and that commit states payload-types.ts regenerates byte-identically, so no regeneration was needed.

Review round

Second round — the open thread is closed. You asked for the localized common.free_meditation_classes as the default, and that is what ships.

  • 2ebc9b5 — the root title now exhausts the locale before it leaves it: seo.root_title, then that locale's own common.free_meditation_classes. English and ROOT_TITLE_FALLBACK are reached only by a locale carrying neither string, so the constant is a brand-new-database case rather than the live one. description is unchanged — it still never falls back.
  • da87549 — docs/architecture.md and the OpenAPI title description both said the title falls back to English, so both stated the opposite of what ships.

Both groups come from one read, so an untranslated locale costs no extra query, and the English read still fires only when the locale names the atlas nowhere.

First round — three adopted, one kept (now also adopted, above).

  • 895bc40 — withoutEnglishFallback composes on localeIsolatedReq instead of re-deriving the copy. Same shallow copy, no behaviour change.
  • 848d26f — the root select drops an as never that silenced nothing; it declares : SelectType like its four siblings.
  • 545ba85 — the OpenAPI description and docs/architecture.md stated five bare view routes where eleven reserved segments resolve to the root. Both now state the rule.

Manual verification

  1. In the admin, open Sahaj Atlas → Translations → Seo and fill root_title / root_description in English, then publish that locale. The tab is new, so it is empty everywhere.
  2. GET /api/atlas/seo?route=/&locale=en → 200 with that copy, and a canonical pointing at your own verified embed page.
  3. Same call with a locale you have not translated → that locale's own common.free_meditation_classes as the title, and description: null. English appears only in a locale carrying neither string.

Notes for reviewer

Three decisions I would like checked:

  • title falls back inside the locale, description does not fall back at all. <title> is mandatory markup and typed as a string, so it must resolve to something — but it resolves to the locale's own words first, per your call. A <meta description> is optional, so the feat(api): serve SEO metadata for an atlas route (C3) #646 rule holds and the host writes its own line. Settled; the thread is resolved.
  • The root's canonical is the caller's own verified embed page, and a caller that owns none falls through to the We Meditate surface, never to the Atlas: unowned regions are in nobody's sitemap (the We Meditate fallback) #652 fallback client. That client speaks for regions nobody claims; somebody else's landing page is not one of those.
  • The 404 message changed for an unparseable route, to "That is not a valid atlas route." The old text claimed the route "does not name a region or an event", which is now only true of the other half of the 404 set.

securityReview.triggerPattern did not match this diff, so no /security-review ran. Worth knowing anyway: the new clients read is the caller's own row, behind requireActiveClient, and the host it yields is re-validated by canonicalTargetForHost before it reaches a URL. The response is per-caller, and buildCacheHeaders already sets Vary: Authorization.

/pr-review-toolkit:review-pr is not installed in this environment; /code-review high ran in its place, alongside the four /simplify lenses.

Detail

Reviews applied. The /simplify pass found that the endpoint had re-derived "may this client publish a canonical" — with a weaker rule than the shared one (typeof domain === 'string' instead of isValidCanonicalDomain, and no _status: published check). That is now canonicalOwnerForClient, shared with the #652 fallback lookup. It also found canonicalMountUrl copy-pasting canonicalUrlBase's guard prologue, already drifted by one case; canonicalUrlBase now builds on it, which tightens it by one case — whitespace in a mount is null rather than a URL nobody chose. No contract fixture case carries one.

The English-merge bypass started as a user-less request copy, which said "nobody is asking" when it meant "do not merge English". It is now withoutEnglishFallback(req), a context flag beside the hook it disables, so the read keeps its real user and the exception is documented where it is enforced.

/code-review high then found three: an open AtlasSeoRootContent that made the content oneOf ambiguous for event responses, content.paragraphs carrying the truncated description where buildEventSeo carries the full text, and the docs claiming a 404 for an over-length route that is really a 400.

Rejected: generalizing a readTranslationsGroup(req, …) helper across rootStrings and resolveEmailStrings — it would rewrite the email path this PR does not otherwise touch. Sharing clientEnglishFallback's English memo key — it couples two modules, and the second read is cheap on a bounded select. Bounding atlasLocales.ts's sy-atlas-config read — a real one-line saving, but on a path this PR did not introduce.

Every new assertion was watched fail at the site that would cause it, per the ticket's last criterion: returning null for an empty segment list (9 unit + 13 integration cases), filtering before measuring the segment cap, branching the mount URL on routing mode, emitting a Place node with breadcrumbs, restoring the English merge, resolving the caller as undefined, dropping additionalProperties, and building paragraphs from the truncated value. The second round added three unit assertions and one integration assertion, each watched fail against the old English-first chain before the fix went back in.

One integration fixture is load-bearing and was not obvious. The German root fixture pins seo: {} explicitly. publishSpecificLocale publishes the draft as that locale reads it, and a draft read falls back to English — so omitting seo wrote the English landing copy into the German column, and the fixture stopped representing an untranslated locale while looking like it did.

One acceptance criterion is met differently than written. The ticket expected an over-length route to 404; it is a 400, on querySchema.route.max(512), before the parser runs. That was already true on main — the ticket's premise was slightly off, not the behaviour. The integration spec now pins which refusals live on which side of that line.

Closes #739

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

…copy

The atlas root — `/`, and every bare view route — names no document, so it
has no name of its own to borrow. Every other route `GET /api/atlas/seo`
answers describes a row: a region's name, an event's title and description.
The landing page needs copy an operator writes.

`sy-atlas-translations` over `sy-atlas-config`, per Ardnived on #739. It is
already localized, already seeded in ten locales, and already the place a
translator visits — and page metadata written once per locale is exactly
what that global is for.

Two keys, both bounded to what a result page shows: `root_title` at 60 and
`root_description` at 160. Both advisory rather than `strict`, matching
every other limit in this schema — an over-long title is untidy, not broken.

The migration is additive: one `jsonb` column on the locales table and its
versions twin, reversible, with no backfill. The endpoint reading these
lands in the next commit.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01K4kjAuZiiLpicAZkxMefjx
…/seo

`GET /api/atlas/seo?route=/` 404'd, and so did `/search`, `/calendar`,
`/filters`, `/online` and `/share`. Those are the routes most hosts mount,
so the one page a host links from its own nav was the only page with no
metadata of its own: it inherited the site's global title and description
and emitted no canonical, which reads to a crawler as a duplicate of the
site's homepage (sydevs/SahajAtlasWeb#173).

`parseAtlasRoute` gains a third variant, `{ kind: 'root' }`, for a route
that reduces to no segments — a view of the root is still the root. The
response is a third union member: `type: 'root'`, `id: null`, `route: '/'`,
empty `breadcrumbs`, and a `WebSite` JSON-LD node rather than `Place` or
`Event`.

**"Names nothing" and "is not a route" stay different answers.** A string
carrying a query, fragment or whitespace, or past the segment cap, is still
a 404 — and the cap is now measured *before* reserved words are dropped, so
twenty `/search` rungs cannot reduce to a landing page. Past the length
ceiling is a 400, on the query schema, before the parser sees it; the spec
pins which refusals live on which side of that line. The 404 message no
longer claims the route "does not name a region or an event", which was
about to become misleading for a string we simply refuse to read.

**`description` never falls back to English; `title` does.** A locale with
no description gets `null`, exactly as a region does, and the host writes
its own line in its own language (#646's rule). `<title>` is mandatory
markup and typed as a string, so it falls back to English and then to a
constant — a page a crawler cannot name is worse than one named in the
wrong language, and the constant is also what makes the endpoint answer the
root on the day it deploys, before an operator has typed anything. That is
the role `EMAIL_STRING_DEFAULTS` already plays for this same global.

Holding that asymmetry means reading the global **around**
`clientEnglishFallback`: the hook fills blank keys from English for every
`clients` read, which is right for widget chrome and would silently defeat
the rule above. `rootStrings.ts` reads with `fallbackLocale: false` and a
user-less copy of the request, and decides for itself what an absence
means. Reintroducing the merge turns the French case red with the English
sentence in it.

**The canonical is the caller's own verified embed page**, with no route
appended — read from its `clients` row, from
`canonical.verification.verified` and never from the declaration, since
only the verification job writes what it loaded itself (#633's trust
boundary). Read rather than taken off `req.user`: what auth attaches is not
this endpoint's contract to depend on, and a missing `canonical` group
would downgrade every host's root canonical to the We Meditate fallback
with nothing failing. `canonicalMountUrl` has no routing branch, because
`path` and `query` differ only in how a route *below* the root is
expressed, and there is none. A caller owning no canonical falls through to
the We Meditate surface, exactly as an unclaimed region does.

Every new assertion was watched fail at the site that would cause it:
returning `null` for an empty segment list (9 unit + 13 integration cases),
filtering before the cap, branching the mount URL on routing mode, emitting
a `Place` node with breadcrumbs, and restoring the English merge.

Closes #739

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01K4kjAuZiiLpicAZkxMefjx
…opt-out explicit

Findings from the /simplify pass, all applied.

**Reuse / altitude — the endpoint was re-deriving "may this client publish a
canonical".** `rootCanonical` carried its own `clients` row shape, its own
`select`, its own flattener and its own eligibility test, all of which
`regionOwners.ts` already owns — and the copy was already a *different* rule:
it checked `typeof verified.domain === 'string'` where `canonicalOwnerFrom`
checks `isValidCanonicalDomain`, and it dropped the `_status: published` half
of `CANONICAL_ELIGIBLE` entirely. That file's own comment warns that a third
condition added to one caller silently leaves the other on the old rule; this
was that third caller, outside the file that made the promise.

`loadCanonicalFallbackOwner` is now `canonicalOwnerForClient(req, id)`, exported
and shared, and `rootCanonical` is two lines. The endpoint carries no client
row shape, no select, no eligibility test and no try/catch.

That also corrected a claim: the root does **not** fall through to the #652
fallback client the way a region does. That client speaks for regions nobody
claims, and somebody else's landing page is not one of those — a host with no
canonical of its own gets the We Meditate surface, never another client's page.

**Altitude — the English-merge bypass said the wrong thing.** Passing a
user-less request defeated `clientEnglishFallback` by making it believe nobody
was asking. The intent is "do not merge English into this read"; identity is
only the hook's proxy for it, so any future hook keyed on `req.user` would have
changed this read's behaviour silently. `withoutEnglishFallback(req)` now sits
beside the hook it disables, the hook documents its own exception where it is
enforced, and the read keeps its real user for access control. The ⚠ in
`src/globals/AGENTS.md` describes a seam the code now has rather than a rule
only prose carried.

**Reuse — one publishability guard.** `canonicalMountUrl` had copy-pasted
`canonicalUrlBase`'s origin and mount prologue, and the two had already
drifted: the new one refused whitespace in a mount, the old one accepted it.
`canonicalUrlBase` now builds on `canonicalMountUrl`, so there is one
definition. That deliberately tightens `canonicalUrlBase` by one case —
whitespace in a mount is now `null` rather than a URL nobody chose, which is
what the origin half of the same function has always done. No contract fixture
case carries one.

**Efficiency.** The translations read now carries `select: { seo: true }` —
it was materializing all seven localized groups (52 leaf keys) to read two
strings. A failed read is kept distinct from a blank locale, so an unreadable
global no longer costs a second read that will fail identically.

**Simplification.** Dropped a `memoizeOnRequest` wrapper that could never hit
(one caller, one call per request, and the English repeat is already branched
away). Extracted the fallback chain as the pure `resolveRootStrings`, which
makes the asymmetry unit-testable and reaches the last-resort constant that no
integration case could. Spread the resolved strings instead of copying two
fields by name, folded a redundant destructure, and cut two comments that
restated prose already on screen.

`canonicalMountUrl` now takes `Omit<CanonicalTarget, 'routing'>`, so "routing
does not enter into it" is in the signature rather than only the docblock.

Both behaviours re-verified after the refactor: dropping the opt-out puts the
English sentence back in the French `<head>`, and resolving the caller as
`undefined` publishes the We Meditate URL for a host that owns its own.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01K4kjAuZiiLpicAZkxMefjx
Three findings from the review pass.

**The `content` oneOf was ambiguous.** `AtlasSeoRootContent` shipped without
`additionalProperties: false`, which both sibling content schemas carry. An
event's `content` also has a `paragraphs` array, so an event response matched
two branches of the union — a strict validator would reject a correct response,
and codegen would produce an ambiguous type. The spec now asserts all three
shapes are closed, since the trap is that an open one fails somewhere else.

**`content.paragraphs` was being truncated.** `buildEventSeo` puts the full
text there and bounds only the `<meta>` value; the root did both from the
truncated string. `root_description`'s 160-character limit is advisory, not
`strict`, so a longer operator-written description would have rendered as
visibly cut-off body copy on the host's page.

**The 404 documentation was wrong about one case.** An over-length route is a
400 — `querySchema.route.max(512)` refuses it before the parser runs, which the
integration spec already asserted. The handler docblock and both OpenAPI
descriptions said 404. Corrected rather than changed: a length ceiling belongs
to request validation, not to "there is no such page".

Both new assertions watched fail first: dropping `additionalProperties`, and
building `paragraphs` from the truncated value.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01K4kjAuZiiLpicAZkxMefjx
@railway-app

railway-app Bot commented Sep 12, 2026 •

Copy link
Copy Markdown

🚅 Deployed to the SahajCloud-pr-769 environment in sahajcloud

Service Status Web Updated
SahajCloud ✅ Success (View Logs) Web Sep 12, 2026 at 5:08 pm UTC
1 service not affected by this PR
  • mailpit

@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-769 September 12, 2026 03:44 Destroyed
@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Sep 12, 2026
@sydevs-bot

sydevs-bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 no session running

recent dispatches
  • 16:54Z resolve-conflicts · attempt 1 · session · done
  • 16:54Z resolve-conflicts · attempt 1 · session
  • 16:46Z resolve-conflicts · attempt 1 · session · done
  • 16:46Z resolve-conflicts · attempt 1 · session
  • 16:28Z resolve-conflicts · attempt 1 · session · done

Written by the sydevs dispatcher. Sessions never edit this comment.

@sydevs-bot sydevs-bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧐 Adversarial review

Matches #739 and the call on it, and both refactors earn their place — two callers each, replacing a drifted copy. The decision I would not ship as written is the English <title> constant, served in every locale from a group that is empty everywhere today.

Findings

  • should-fix — rootStrings.ts:47 an English title replaces a host's own localized one.
  • consider — clientEnglishFallback.ts:143 re-implements localeIsolatedReq.
  • consider — rootStrings.ts:50 as never on a select four siblings declare plainly.
  • consider — customEndpoints.ts:535 names five bare view routes; eleven resolve to root.

Checked: #739 and its comments, every touched file whole, the new specs. WordPress seo.php:60 returns early for /, so nothing flips on deploy, but it overrides the host title whenever ours is set. Clean: content's oneOf, both branches closed; Vary: Authorization (policy.ts:114); the segment cap exceeds real use; maxLength is advisory (translationsField.ts:172), so untruncated paragraphs is right.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

Comment thread src/endpoints/atlas/seo/rootStrings.ts Resolved
Comment thread src/endpoints/atlas/seo/rootStrings.ts Resolved
Comment thread src/plugins/openapi/customEndpoints.ts Resolved
@sydevs-bot sydevs-bot added bot:working Lock: a cloud session is running on this item. Removed when it ends. and removed bot:working Lock: a cloud session is running on this item. Removed when it ends. labels Sep 12, 2026
`withoutEnglishFallback` spread the request itself, re-deriving what
`localeIsolatedReq` already owns at eleven call sites — including the one
three lines below it in this file. Both callers pass an explicit `locale`,
which is exactly the `createLocalReq` hazard that helper documents, so the
reasoning for copying at all now lives in one place.

No behaviour change: the helper is that same shallow copy.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014BYwdHjK7hdWv1NeyRjgd5
`SEO_GROUP_SELECT` carried `as never`, which its four siblings in
`seo/index.ts` do not: `REGION_SELECT`, `EVENT_SELECT`, `IMAGE_SELECT` and
`EVENT_CARD_SELECT` all declare `: SelectType` plainly. `{ seo: true }` is a
valid `SelectIncludeType`, so the cast silenced nothing — `pnpm typecheck`
and `pnpm typecheck:tests` both pass without it.

A cast that buys nothing is worse than none: the next reader has to work out
which mismatch it was hiding.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014BYwdHjK7hdWv1NeyRjgd5
The OpenAPI description and `docs/architecture.md` both named five bare view
routes as what answers the root. `RESERVED_SEGMENTS` holds eleven, so
`/register`, `/preview`, `/events`, `/areas`, `/regions`, `/venues` and any
combination of them answer as the root too — `atlas-seo-route.spec.ts`
already pins `/events/areas` doing it.

A list a reader can check against the code, and lose to, is worse than the
rule: a route left empty once reserved segments are dropped is the root.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014BYwdHjK7hdWv1NeyRjgd5
@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-769 September 12, 2026 04:11 Destroyed
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

Adopted three, rebutted one. Pushed 4ce9b5f.

Merged origin/main in too (#756's jsonField refactor). Lean gate green after it, plus atlas-seo and translations-globals.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@sydevs-bot sydevs-bot removed the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Sep 12, 2026
@sydevs-bot
sydevs-bot marked this pull request as ready for review September 12, 2026 04:21
@sydevs-bot
sydevs-bot requested a review from Ardnived September 12, 2026 04:21
@sydevs-bot sydevs-bot added awaiting bot:working Lock: a cloud session is running on this item. Removed when it ends. and removed awaiting labels Sep 12, 2026
The root's `<title>` fell back from `seo.root_title` straight to English.
`seo` ships empty in all ten locales, so every locale got the English
constant on day one, and a host adopting the root lost its own localized
title to it. Reviewer's call on #769: default to the localized
`common.free_meditation_classes` instead.

The chain now exhausts the locale before it leaves it — the operator's
`seo.root_title`, then that locale's own `common.free_meditation_classes`,
which is seeded in ten locales where `seo` is empty. English, and then
`ROOT_TITLE_FALLBACK`, are reached only by a locale carrying neither
string, so the constant is now a brand-new-database case rather than the
live one. `description` is untouched: it still never falls back.

Both groups come from one read, so an untranslated locale costs no extra
query. The English read still fires only when the locale names the atlas
nowhere.

The integration fixture pins `seo: {}` for German deliberately.
`publishSpecificLocale` publishes the draft as that locale reads it, and a
draft read falls back to English — so omitting `seo` wrote the English
landing copy into the German column and the fixture stopped representing
an untranslated locale at all. That cost one debugging round.

Both new assertions were watched fail against the old chain, unit and
integration, before the fix went back in.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_018P23ua27dChRxb1g9frwBb
`docs/architecture.md` and the OpenAPI `title` description both said the
root title falls back to English. It now falls back within the locale
first, so both stated the opposite of what ships.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_018P23ua27dChRxb1g9frwBb
@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-769 September 12, 2026 16:12 Destroyed
@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Sep 12, 2026
…-seo-root

#750 rewrote the atlas translations schema by widget view while this branch
added a `seo` group to the same global. Four files conflicted; two more
needed adapting because main renamed a key this branch reads.

- `src/migrations/index.ts` — both migrations kept, in timestamp order, so
  `20260909_..._atlas_translations_by_view` runs before
  `20260912_..._atlas_translations_seo_group`. The `seo` column name collides
  with nothing #750 adds or drops, so the DDL is unchanged.
- `20260912_..._atlas_translations_seo_group.json` — rebased onto #750's
  snapshot plus the two `seo` columns. It is the highest-timestamp snapshot,
  so left describing the pre-#750 schema it would have made the next
  `migrate:create` re-emit all of #750's DDL and crash-loop the boot
  migration (#566, `src/migrations/AGENTS.md`). Regenerating it under a new
  timestamp is unsafe — this branch has already deployed to its preview — and
  `migrate:create` cannot answer its own rename-vs-create prompt unattended.
  Verified: `migrate:create` now finds no schema change and no longer prompts,
  where against the stale snapshot it prompted on `common_chrome`.
- `common.free_meditation_classes` became `common.chrome.widget_label` in
  #750 — same string in all ten locales. The root title's in-locale fallback
  now reads the new path, and the select descends into `common` rather than
  taking all seven of its columns.
- `src/globals/AGENTS.md`, `tests/int/translations-globals.int.spec.ts`,
  `tests/unit/atlas-translations-schema.spec.ts` — `Seo` joins `Emails` as the
  second group no widget view reads, so #750's "one tab per widget view" rule
  and its three key counts now name both exceptions.
- `src/payload-types.ts` — regenerated; carries both `SyAtlasTranslationsSeoStrings`
  and `SyAtlasTranslationsCommonChromeStrings`.

Gate: lint, `tsc` over src and tests, 1804 unit tests. Targeted specs
`atlas-seo` + `translations-globals` — 72 passed.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MoEHvcg8TondFU4WSguGcK
@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-769 September 12, 2026 16:44 Destroyed
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

Merged origin/main (#750) and resolved four conflicts. Two things the diff alone will not tell you.

The key this PR falls back to was renamed. #750 moved common.free_meditation_classes to common.chrome.widget_label — same string in all ten locales. rootStrings.ts reads the new path. The PR body above still names the old key, in three places.

A generated snapshot was rebased by hand. 20260912_..._atlas_translations_seo_group.json is the highest-timestamp snapshot, so left describing the pre-#750 schema it would make the next migrate:create re-emit all of #750's DDL (#566). Its .ts DDL is untouched. Regenerating under a new timestamp is unsafe once a branch has deployed, and migrate:create cannot answer its own rename-vs-create prompt unattended. Evidence: migrate:create now reports no schema change and no longer prompts on common_chrome.

Gate green; atlas-seo + translations-globals — 72 passed. The merge commit carries the per-file reasoning.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@sydevs-bot sydevs-bot added bot:working Lock: a cloud session is running on this item. Removed when it ends. and removed bot:working Lock: a cloud session is running on this item. Removed when it ends. labels Sep 12, 2026
Resolves the conflict #747 created in `src/globals/AGENTS.md`. Both sides
edit the same sentence for different reasons, and both edits are wanted:

- This branch adds the `Seo` / `Emails` paragraph — the two Atlas tabs no
  widget view reads.
- `main` restates "three things distinguish two of the three globals" as
  "three things are true of all three", because #709 brought per-locale
  publish status and `availableLocales` to `wm-app-translations` too.

Kept both: the new paragraph, then main's corrected sentence.

Everything else auto-merged. Verified rather than assumed:

- `src/migrations/index.ts` orders the two branches' migrations by
  timestamp — 20260909_161243 (main) before 20260909_161353 and
  20260912_031449 (this branch). Each migration's DDL is disjoint, so the
  chain applies cleanly in that order.
- `src/payload-types.ts` merged as a strict superset of main's: `git diff
  origin/main -- src/payload-types.ts` removes nothing.

Gate after the merge: lint, `tsc` over `src/` and `tests/`, 1804 unit
tests. Integration specs covering every merged file — `atlas-seo`,
`atlas-sitemap`, `translations-globals`, `available-locales`,
`wm-app-config`, `wemeditateAppStatus` — 139 passed.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_012QbFiVem6WXW59R6mE5Qn3
@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-769 September 12, 2026 16:51 Destroyed
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

Merged origin/main (#747) and pushed 86b8d99. One conflict, in src/globals/AGENTS.md — both sides edit the same sentence, and both edits are kept. Gate green after the merge: lint, both tsc passes, 1804 unit tests, 139 integration tests across every merged file.

One thing to know before the next migration is generated. Two branches added migrations in parallel, so the newest-by-timestamp snapshot — this PR's 20260912_031449_atlas_translations_seo_group.json — predates #747 and lacks its schema: wm_app_config_available_locales, its enum, and _status moved onto wm_app_translations_locales.

The chain applies fine. index.ts orders 20260909_161243 first, and the DDL is disjoint.

But migrate:create diffs against that stale snapshot, so the next one re-emits #747's DDL and crash-loops the boot migration — src/migrations/AGENTS.md, "the out-of-order snapshot trap" (#566). Regenerating here is not the fix: this branch has already deployed to its preview.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@sydevs-bot sydevs-bot added awaiting bot:working Lock: a cloud session is running on this item. Removed when it ends. and removed bot:working Lock: a cloud session is running on this item. Removed when it ends. awaiting labels Sep 12, 2026
Resolves #755's WeMeditate Web schema rewrite against this branch's atlas
`seo` group. Three conflicts, all kept from both sides:

- `src/migrations/index.ts` — both branches added imports. #755's two
  entries are ordered before this branch's, matching the array the merge
  already produced and the migrations' timestamps.
- `src/globals/AGENTS.md` — #755 documented the Web tabs' reading order and
  the `a11y` conventions; this branch documented `Seo`/`Emails` as the two
  server-read exceptions to the one-tab-per-widget-view rule. Both paragraphs
  stand, Atlas first.
- `tests/int/translations-globals.int.spec.ts` — took #755's docblock, which
  restates the leaf/nested split for all three globals, and added `Seo` back
  to the sy-atlas leaf-tab list.

Refreshes `20260912_031449_atlas_translations_seo_group.json`. That snapshot
is the newest by timestamp, so `migrate:create` diffs the next migration
against it — and it predated #755, so it still carried the old `wm_web`
columns. Regenerated post-merge; the `.ts` DDL comes out byte-identical, so
the file and its timestamp are unchanged and the preview's applied migration
row still matches (src/migrations/AGENTS.md, the out-of-order snapshot trap).

`pnpm generate:types` reproduces the merged `src/payload-types.ts` exactly.

Gate: lint, `tsc` over src and tests, 1812 unit tests. Targeted specs:
translations-globals, translations-field, wm-web-translations-seed (52) and
atlas-seo (53).

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRMePM8fqqySLhNpbUgxX6
@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-769 September 12, 2026 17:06 Destroyed
@sydevs-bot sydevs-bot added awaiting and removed bot:working Lock: a cloud session is running on this item. Removed when it ends. labels Sep 12, 2026
@sydevs-bot
sydevs-bot merged commit 70f12c6 into main Sep 12, 2026
14 checks passed
@sydevs-bot
sydevs-bot deleted the claude/feat-739-atlas-seo-root branch September 12, 2026 17:18
@sydevs-bot sydevs-bot moved this from Revising to Done in SYDevelopers Technical Roadmap Sep 12, 2026
sydevs-bot added a commit that referenced this pull request Sep 12, 2026
…ize-status

One conflict, src/migrations/index.ts, additive on both sides. Main added
20260912_031449_atlas_translations_seo_group (#769); this branch adds
20260911_235823_pages_app_cards_localize_status. Both register, in
timestamp order, so both apply.

src/plugins/openapi/customEndpoints.ts merged without conflict: main
rewrote the /api/atlas/seo docs, this branch annotated
eventGeoJsonParameters. The regions do not overlap and both survive.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Ybi5nRF2U6i7rsRafMCRfa
Ardnived pushed a commit to sydevs/SahajAtlasWeb that referenced this pull request Sep 14, 2026
…oute (#207)

* docs(embedding): document the head metadata a host writes per atlas route

`docs/embedding.md` is the host-facing contract, and it never said what a host
should put in its `<head>`. Every region and class page under an embed was
described correctly by the sites that bothered; the entry point was not. #62 on
WeMeditateWeb mounts `/map` with `atlas=/` and presents to a crawler as a
duplicate of the site's homepage, because the page inherits the global title and
description and emits no canonical.

The rule is finally writable: sydevs/SahajCloud#769 made `GET /api/atlas/seo`
answer **every** route the widget can mount with, the atlas root included. So
the new section states the rule — a page's metadata describes the atlas route
the widget mounted with — and names the endpoint that supplies it.

What it covers, each verified against the shipped code and a live call:

- Three worked examples, pasted from real responses: a region route, the root,
  and a bare view route. The region example also shows that `route` comes back
  normalized (`/gb/london` answers `/gb/south-east/london`), which a host
  comparing its canonical needs to know.
- Which routes answer as the root, as a RULE rather than a list of five: eleven
  reserved segments are dropped wherever they appear, so `/events/areas`
  reduces to the root too.
- Fetch server-side at render time, and cache for up to 300s per route and
  locale. `Vary: Authorization` splits that cache per SITE, not per visitor,
  because the credential is the host's own published client key — the header
  otherwise reads as "do not cache". A server-to-server call also sends no
  Origin, which the allowed-domains gate deliberately permits.
- `canonical` for the root is the caller's own verified mount page, and so is
  per-API-key; a caller publishing none gets the We Meditate surface.
- `description` is `null` in a locale with no operator copy, stated as a rule
  rather than as today's snapshot — sydevs/SahajCloud#778 fills that copy and
  would make a snapshot sentence false the day it merges. The host writes its
  own line and a self-referencing canonical.
- The 400 and the two 404s, which say different things on purpose.
- That the CSP table does not change, and why: the host's server makes the
  request, and `cloud.sydevelopers.com` is already in `connect-src`.

`CHANGELOG.md` carries the host-visible entry, per the rule that it and
`docs/embedding.md` move together. Nothing under `src/` changes.

Closes #173.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* docs(embedding): tighten two claims against the endpoint's source

`jsonLd`'s escaping names what is actually escaped — `<`, `>`, `&` and the two
Unicode line separators (`jsonLdEscape` in SahajCloud's `seo/jsonLd.ts`) — so a
host reading "already escaped" knows what re-stringifying would lose.

`canonical` can be `null` for a region or an event, where no site publishes one
(`seo/index.ts` reads `region.webUrl ?? null`). The section said it resolves,
full stop. It now says what a `null` means and what to write instead.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* fix(docs): name the locale codes the seo endpoint accepts

`locale` is refined with `isValidLocale` against nineteen exact codes
(SahajCloud `src/lib/locales/index.ts:14-33`), and `parseQuery` answers
400 on a miss. "Send the language your page declares in `<html lang>`"
therefore breaks any host declaring `en-GB`, `en-US` or `pt`, and the
refusal table blamed `route` for the 400 it got.

Names the set, gives the mapping rule, and adds `locale` to the 400 row.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01FKvtzMtoVcN1VjWqbdHZaA

* fix(docs): elide the canonical origin from the worked examples

The examples printed `wemeditate-web.contact-c66.workers.dev` eight
times, while the compact-card section names `wemeditate.com/map` as the
same fallback surface — two answers to one question. sydevs/SahajCloud#783
asks whether that host is a misconfiguration at all, so baking it into
the host-facing contract risks documenting a transient state.

`…/map…` matches how `alternates` and `breadcrumbs` already abridge, so
the responses stay pasted rather than hand-written, and a new paragraph
says what the ellipsis stands for.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01FKvtzMtoVcN1VjWqbdHZaA

* fix(docs): mark the example root title as the fallback constant

`Free Meditation Classes` is `ROOT_TITLE_FALLBACK` (SahajCloud
`src/endpoints/atlas/seo/rootStrings.ts:48`), the bottom of the chain,
reached only because no operator root copy exists in any locale yet —
`locale=de` returns the same English string. Printed bare, the example
read as the root's real title and would date the day the copy lands.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01FKvtzMtoVcN1VjWqbdHZaA

---------

Co-authored-by: Claude <[email protected]>

This branch was successfully deployed

No deployments
sahajcloud / SahajCloud-pr-769 — fa97fbd7 Deployed Sep 12, 2026 by railway-app[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

feat(api): /api/atlas/seo answers the atlas root and bare view routes

3 participants