Repository navigation
feat(api): /api/atlas/seo answers the atlas root and bare view routes - #769
Conversation
…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
|
🚅 Deployed to the SahajCloud-pr-769 environment in sahajcloud
1 service not affected by this PR
|
|
🤖 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
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:47an English title replaces a host's own localized one. - consider —
clientEnglishFallback.ts:143re-implementslocaleIsolatedReq. - consider —
rootStrings.ts:50as neveron a select four siblings declare plainly. - consider —
customEndpoints.ts:535names 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
`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
|
Adopted three, rebutted one. Pushed
Merged 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
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
…-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
|
Merged The key this PR falls back to was renamed. #750 moved A generated snapshot was rebased by hand. Gate green; 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
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
|
Merged 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 The chain applies fine. But 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
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
…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
…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]>
Summary
?route=/and every bare view route now return one document instead of a 404. The rule is that a route left empty onceRESERVED_SEGMENTSis dropped is the root —/searchand/register, but also/eventsand/events/areas.seogroup onsy-atlas-translations— per your call on feat(api):/api/atlas/seoanswers the atlas root and bare view routes #739. A locale nobody has written a title for is named by its owncommon.free_meditation_classes, not by English.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. Readscommonandseoin one query.src/lib/atlas/regionOwners.ts—canonicalOwnerForClientexported; 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, whichcanonicalUrlBasenow builds on.src/lib/translations/clientEnglishFallback.ts—withoutEnglishFallback(req), a supported opt-out, built onlocaleIsolatedReq.Preview
https://sahajcloud-sahajcloud-pr-769.up.railway.app — deployed green.
Contract impact
AtlasSeoResponsegains a third union member (type: 'root',id: null), soidis now nullable. Existing consumers narrow ontypeand are unaffected; nobody has to adopt the new variant.includes/seo.phpsuppresses the host's SEO plugin only after a successful fetch, andseo.php:57-63returns early for/today, so the root view keeps the host's own metadata until that plugin adopts the new variant.docs/embedding.mdrecords the host-facing rule once this lands.No
pnpm types:cmsstep for the endpoint. Theseogroup does changesrc/payload-types.ts, so both consumers pick it up on the ordinary generate-types → merge →types:cmssequence.Migration
src/migrations/20260912_031449_atlas_translations_seo_group.tsjsonbcolumn onsy_atlas_translations_localesand its versions twin. Additive, no backfill, no data touched.downdrops both columns.Test results
tscoversrc/andtests/, 1717 unit testsatlas-seo+translations-globals— 71 passed after the second review roundorigin/mainmerged in (4ce9b5f), which brought refactor(fields): declare a JSON column with one jsonField helper #756'sjsonFieldrefactor. The gate was re-run after the merge, and that commit statespayload-types.tsregenerates byte-identically, so no regeneration was needed.Review round
Second round — the open thread is closed. You asked for the localized
common.free_meditation_classesas 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 owncommon.free_meditation_classes. English andROOT_TITLE_FALLBACKare reached only by a locale carrying neither string, so the constant is a brand-new-database case rather than the live one.descriptionis unchanged — it still never falls back.da87549—docs/architecture.mdand the OpenAPItitledescription 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—withoutEnglishFallbackcomposes onlocaleIsolatedReqinstead of re-deriving the copy. Same shallow copy, no behaviour change.848d26f— the root select drops anas neverthat silenced nothing; it declares: SelectTypelike its four siblings.545ba85— the OpenAPI description anddocs/architecture.mdstated five bare view routes where eleven reserved segments resolve to the root. Both now state the rule.Manual verification
root_title/root_descriptionin English, then publish that locale. The tab is new, so it is empty everywhere.GET /api/atlas/seo?route=/&locale=en→ 200 with that copy, and acanonicalpointing at your own verified embed page.common.free_meditation_classesas the title, anddescription: null. English appears only in a locale carrying neither string.Notes for reviewer
Three decisions I would like checked:
titlefalls back inside the locale,descriptiondoes 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.securityReview.triggerPatterndid not match this diff, so no/security-reviewran. Worth knowing anyway: the newclientsread is the caller's own row, behindrequireActiveClient, and the host it yields is re-validated bycanonicalTargetForHostbefore it reaches a URL. The response is per-caller, andbuildCacheHeadersalready setsVary: Authorization./pr-review-toolkit:review-pris not installed in this environment;/code-review highran in its place, alongside the four/simplifylenses.Detail
Reviews applied. The
/simplifypass 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 ofisValidCanonicalDomain, and no_status: publishedcheck). That is nowcanonicalOwnerForClient, shared with the #652 fallback lookup. It also foundcanonicalMountUrlcopy-pastingcanonicalUrlBase's guard prologue, already drifted by one case;canonicalUrlBasenow builds on it, which tightens it by one case — whitespace in a mount isnullrather 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 highthen found three: an openAtlasSeoRootContentthat made thecontentoneOfambiguous for event responses,content.paragraphscarrying the truncated description wherebuildEventSeocarries 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 acrossrootStringsandresolveEmailStrings— it would rewrite the email path this PR does not otherwise touch. SharingclientEnglishFallback's English memo key — it couples two modules, and the second read is cheap on a bounded select. BoundingatlasLocales.ts'ssy-atlas-configread — 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
nullfor an empty segment list (9 unit + 13 integration cases), filtering before measuring the segment cap, branching the mount URL on routing mode, emitting aPlacenode with breadcrumbs, restoring the English merge, resolving the caller asundefined, droppingadditionalProperties, and buildingparagraphsfrom 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.publishSpecificLocalepublishes the draft as that locale reads it, and a draft read falls back to English — so omittingseowrote 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 onmain— 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