Skip to content

refactor: use SahajCloud, not CMS, as the backend's name in code - #131

Merged
sydevs-bot merged 6 commits into
mainfrom
claude/refactor-130-sahajcloud-naming
Sep 22, 2026
Merged

sydevs-bot merged 6 commits into
mainfrom
claude/refactor-130-sahajcloud-naming

Conversation

@sydevs-bot

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

Copy link
Copy Markdown
Contributor

Summary

  • The backend is spelled SahajCloud everywhere the code means our deployment: 612 occurrences across 159 files drop to 18, and git ls-files | grep -E '(^|/)cms-' is empty.
  • "CMS" did not name one thing. Three modules keep a name that is neither cms nor sahajCloud, because they name the product or our own site — see Changes.
  • No behaviour change. No header, env var, API path, origin check or token literal moved; the [PayloadCMS] log prefix is byte-identical.

Changes

Each module's own docstring decided its name, not a substitution:

Was Now Because
server/cms-client.ts server/sahajcloud-client.ts reads against our deployment
server/cms-context.ts server/sahajcloud-context.ts resolves that deployment's key and base URL
server/cms-types.ts server/sahajcloud-types.ts app-side types over that deployment's content
lib/cms-relationships.ts lib/payload-relationships.ts PayloadCMS field shapes — the product
lib/cms-blocks.ts lib/content-blocks.ts Lexical block shapes from the upstream editor
lib/cms-routes.ts lib/document-routes.ts paths on our site, both directions

cmsOrigin → sahajCloudOrigin (it returns the origin of PUBLIC__SAHAJCLOUD_URL), but cmsHref → documentHref: it resolves a document reference to a path on our own site, so sahajCloudHref would name the wrong origin.

Preview

https://claude-refactor-130-sahajcloud-naming-wemeditate-web.contact-c66.workers.dev

Test results

Re-run on fc37c33, after the sahajcloud-types rename:

  • Lean gate: ✓ lint (0 errors), tsc --noEmit, test:run — 76 files, 767 tests passed
  • Build: ✓ pnpm build (the --full gate)
  • Rename purity: git diff -M --summary reports all 9 files as renames; every added line that is not a rename is a re-wrap or a Prettier continuation

Manual verification

  1. pnpm dev, load a page carrying a content-index block, and confirm one [PayloadCMS] GET … → 200 per read, unchanged. Local SahajCloud access 403s on a stale key — the deployed preview is the fallback, per docs/local-environment.md.
  2. Open live preview from the SahajCloud admin on a meditation and confirm the frame editor still drives the playhead. The postMessage origin check renamed its parameter; the unit tests cover the fail-closed cases, but nothing here exercises the real postMessage peer.

Notes for reviewer

Both open questions are answered, not deferred:

  • server/cms-types.ts → sahajcloud-types.ts. It first landed as content-types.ts, and that name read as the HTTP header in the one directory that sets it: sitemap-routes.ts imports it on line 26 and writes Content-Type on three of its own. fc37c33 renames it and updates 55 import specifiers.
  • [PayloadCMS] stays. It names the product, and three things grep for it: the debugging workflow in AGENTS.md, the no-console carve-out in eslint.config.js, and the smoke helpers. Changing it is a separate decision, not a spelling sweep.

Two counts in the ticket were taken before #129 merged. The baseline is 612 occurrences in 159 files, not 597 in 158; and [PayloadCMS] appears on 12 code lines, not 11, because #129 added one. 12 before, 12 after, every emitted literal unchanged.

One stale reference this PR cannot fix. .claude/workflow.json:31 still names server/cms-types.ts in a generatedFiles reason string. It is a protected path an unattended run cannot write, and the ticket holds it out of scope with .claude/settings.json. It needs a one-line attended edit.

Detail

Two stale breadcrumbs corrected on the way. Both contained cms, so the sweep had to touch them and leaving them wrong was not an option:

  • lib/lecture-shape.ts pointed at sy-devs-cms/src/lib/lectures/lectureShape.ts. The path resolves, but under SahajCloud — verified against the checkout.
  • server/sahajcloud-client.ts and docs/local-environment.md cited a cms-api-reads rule. No such file exists in docs/rules/; both now name server/AGENTS.md, which is where that guidance lives and where the second reference already linked.

The article rule. "CMS" is a head noun in "the CMS returns" and a modifier in "the CMS error body". The first drops its article with the rename, the second keeps it. Four cases came out wrong in the first pass — three because the phrase wrapped onto the next line — and bf7fa15 restores them. Worth a skim of the prose diff; the rest read correctly on review.

What was deliberately left spelled cms: the 18 remaining hits are the pnpm types:cms script name (settled in the ticket's open questions — renaming it would break contractStep.command and drop a permission grant in two protected files), the literal "the CMS" that AGENTS.md's own naming rule contrasts against, and the two .claude/ files.

Test fixtures. https://cms.test → https://sahajcloud.test and https://cms/override.jpg → https://sahajcloud/. These stand in for our deployment and the verification grep catches them; no production URL changed.

Formatting. Prettier already fails on 151 files in this repo, so it is not an enforced gate. My change newly broke four files; those four were formatted with prettier --write and nothing else, to avoid unrelated churn. Every other line the longer name pushed past 100 columns was hand-re-wrapped, docs/rules/rest-api.md included after fc37c33.

Security review ran (the diff matches securityReview.triggerPattern via server/, scripts/ and .env*) and found nothing: header names, env var names, non-test URL literals, the live-preview postMessage origin gate and its fail-closed behaviour, token verification in server/live-preview.ts, the URL-safety gates in lib/urls.ts, the api-routes.ts auth gate, and the site-relative path guard in sahajcloud-fetch.ts are all unchanged.

AGENTS.md's naming rule loses its "renamed in #130; until that lands…" clause, which this branch settles, and gains the three modules that deliberately keep another spelling.

Closes #130

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

🤖 Generated with Claude Code

https://claude.ai/code/session_0193PxTh7Wp6d1B1ar32kZeu

"CMS" named three different things across these files, so a uniform
`cms` -> `sahajCloud` rename would have pointed three modules at the
wrong system. Each module's own docstring settles its new name:

- `server/cms-client.ts` and `server/cms-context.ts` read against our
  deployment, so they take `sahajcloud-`, matching the env vars
  (`PUBLIC__SAHAJCLOUD_URL`, `SAHAJCLOUD_API_KEY`) and the
  `sahajcloud-fetch.ts` that #129 landed.
- `server/cms-types.ts` holds app-side types layered over the generated
  Payload types, not a mirror of the backend, so `content-types.ts`.
- `lib/cms-relationships.ts` documents PayloadCMS relationship and
  upload field shapes — the product, not our deployment — so
  `payload-relationships.ts`.
- `lib/cms-blocks.ts` holds Lexical block shapes authored upstream, so
  `content-blocks.ts`.
- `lib/cms-routes.ts` spells document routes on *our* site, both
  directions. `sahajcloud-routes` would name the wrong origin, so
  `document-routes.ts`.

Import specifiers and documentation links follow. `CLAUDE.md`,
`server/CLAUDE.md` and `.claude/rules/*.md` are tracked symlinks, so
each target is edited once and the link is left alone.

Refs #130

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0193PxTh7Wp6d1B1ar32kZeu
Eleven exported or widely used identifiers named our deployment `Cms`.
Each takes the spelling its referent deserves, decided from the code
rather than by substitution:

- `getCmsContext`, `hasCmsContext`, `CmsContext`, `CmsEnv` and
  `cmsContextSchema` resolve this Worker's `SAHAJCLOUD_API_KEY` and
  `PUBLIC__SAHAJCLOUD_URL`, so they take `SahajCloud`.
- `cmsOrigin` parses that same URL down to an origin and is the
  `postMessage` peer live preview checks, so `sahajCloudOrigin` is
  literally what it returns.
- `cmsHref` is the one that must not be treated alike. It resolves a
  collection and a document reference to a path on *our* site, so
  `sahajCloudHref` would name the wrong origin. It becomes
  `documentHref`, matching the module it lives in.
- `cmsBaseUrl`, `discoverFromCms`, `CmsSamples` and `stubCmsResponse`
  all name the deployment, so they take `SahajCloud` too.

`cmsContext`, a local in `payload-client.ts`, follows its getter.

Refs #130

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0193PxTh7Wp6d1B1ar32kZeu
The remaining occurrences were prose and fixtures rather than
identifiers: comments, JSDoc, test names, the nested guides and
`docs/**`. Three that were not a straight substitution:

- `https://cms.test` and `https://cms/override.jpg` are fixtures
  standing in for our deployment, so they become `sahajcloud.test` and
  `https://sahajcloud/`. The `[PayloadCMS]` log prefix inside one of
  those assertions is untouched.
- `lib/lecture-shape.ts` pointed at `sy-devs-cms/src/lib/lectures/
  lectureShape.ts`. The path still resolves, but under `SahajCloud`, so
  the pointer now names the repo that exists.
- `server/sahajcloud-client.ts` and `docs/local-environment.md` cited a
  `cms-api-reads` rule. No such rule file exists; both now name
  `server/AGENTS.md`, which is where that guidance actually lives and
  where the second reference already linked.

`AGENTS.md`'s naming rule keeps the literal "the CMS" it contrasts
against, and drops the "until #130 lands" clause this branch settles. It
now names the three modules that deliberately keep another spelling.

Where "CMS" was the head noun the article goes with it: "the CMS
returns" reads "SahajCloud returns", while "the CMS error body" keeps
its article. Lines re-wrapped only where the longer name pushed them
past the 100-column width the file already used.

Refs #130

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0193PxTh7Wp6d1B1ar32kZeu
`# SahajCloud CMS URL` became `# SahajCloud SahajCloud URL` in both env
files: the heading already carried the product name the sweep was
replacing. It reads `# SahajCloud URL`.

Three lines the longer name pushed past 100 columns, missed in the first
pass because the check compared against the branch tip rather than
`origin/main`: the `ci.yml` smoke-key comment, `LayoutBlock`'s import of
the renamed `content-blocks`, and the `discoverFromSahajCloud` warning
in the smoke helper.

Refs #130

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0193PxTh7Wp6d1B1ar32kZeu
Dropping "the" before "SahajCloud" is right where the name is the noun
("the CMS returns" -> "SahajCloud returns") and wrong where it modifies
one. Four cases slipped through, three of them because the phrase wrapped
onto the next line and the rule could only see the first:

- `server/AGENTS.md` opened "The SahajCloud (PayloadCMS) API validates" —
  the article belonged to "API", and that line already said SahajCloud
  before this branch.
- "move the request off the SahajCloud origin", "Mirrors the SahajCloud
  reference" and "the curated `featured` list (the SahajCloud
  `featuredArticles`)" all wrapped after the name.

`AGENTS.md`'s caching line became "SahajCloud reads are cached by the
Cloudflare edge in front of SahajCloud". It reads "Content reads" now, so
the sentence names the system once.

Refs #130

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0193PxTh7Wp6d1B1ar32kZeu
@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Sep 22, 2026
@sydevs-bot

sydevs-bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 no session running

recent dispatches
  • 01:23Z address-review · attempt 1 · session · done
  • 01:23Z address-review · attempt 1 · session
  • 01:14Z adversarial-review · attempt 1 · session · done
  • 01:14Z adversarial-review · attempt 1 · session

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

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
wemeditate-web fc37c33 Commit Preview URL

Branch Preview URL
Sep 22 2026, 01:29 AM

@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

The diff matches #130 and nothing more: 156 files, every code change a rename. The acceptance greps pass. The two ways a sweep this wide breaks quietly are both clear — docs/rules/*.md paths: frontmatter was re-pointed, so no path-scoped rule stopped loading, and no sibling repo names a renamed path.

One name is wrong, and it is the one left open. server/content-types.ts reads as the HTTP header in the directory that sets it.

Findings

  • should-fix — server/content-types.ts:2: the name collides with Content-Type. Answer the open question sahajcloud-types.ts.
  • consider — AGENTS.md:223: says three modules keep a third name. Four do.
  • No line — .claude/workflow.json:31 still names server/cms-types.ts. File a ticket for the attended edit.

What was checked

git diff -M origin/main...bf7fa15, normalised to split renames from real edits. Read whole: sahajcloud-context.ts, content-types.ts, AGENTS.md, every docs/rules/ frontmatter. Ran the ticket's three greps. The gate was not re-run.

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


Generated by Claude Code

Comment thread server/sahajcloud-types.ts Resolved
Comment thread AGENTS.md 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 22, 2026
`server/content-types.ts` read as the HTTP header in the one directory
that sets it: `sitemap-routes.ts` imports it on line 26 and then writes
`Content-Type` on three of its own. `api-routes.ts` does both too. The
name also made "content" mean three unrelated things across the tree —
this module, `server/content-index.ts` and `lib/content-blocks.ts`.

The PR's objection, that `sahajcloud-types.ts` implies a mirror of the
backend, does not hold: `sahajcloud-client.ts` and `sahajcloud-context.ts`
mirror nothing either, and the generated mirror is already
`payload-types.ts`.

`AGENTS.md`'s "three modules keep a name that is neither" is true again
with this rename, so that sentence needs no edit.

Refs #130

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01R641WAod9tBWLJ7QDmGjAK
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

Deploying wemeditate-design with  Cloudflare Pages  Cloudflare Pages

Latest commit: fc37c33
Status: ✅  Deploy successful!
Preview URL: https://4664c411.wm-design.pages.dev
Branch Preview URL: https://claude-refactor-130-sahajclo.wm-design.pages.dev

View logs

@sydevs-bot

Copy link
Copy Markdown
Contributor Author

Both threads adopted in fc37c33. Lean gate and pnpm build are green on it.

The review's third finding has no thread: .claude/workflow.json:31 still names server/cms-types.ts. It is a protected path, so no unattended run can write it. I filed no ticket for it — the PR body carries it, and it is one attended line.

🤖 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 22, 2026
@sydevs-bot
sydevs-bot marked this pull request as ready for review September 22, 2026 01:32
@sydevs-bot
sydevs-bot requested a review from Ardnived September 22, 2026 01:32
@sydevs-bot
sydevs-bot added this pull request to the merge queue Sep 22, 2026
Merged via the queue into main with commit 68952bc Sep 22, 2026
30 of 32 checks passed
@sydevs-bot
sydevs-bot deleted the claude/refactor-130-sahajcloud-naming branch September 22, 2026 03:59
@sydevs-bot sydevs-bot moved this from Revising to Done in SYDevelopers Technical Roadmap Sep 22, 2026
sydevs-bot pushed a commit that referenced this pull request Sep 22, 2026
#131 renamed the SahajCloud modules. The only textual conflict was the
import block in `server/site-context.ts`: this branch added `perRequest`
where main renamed `./cms-types` to `./sahajcloud-types`. Both sides kept.

`server/site-context.test.ts` is new on this branch, so git merged it
without a conflict while its imports still named `./cms-client` and
`./cms-types`. Repointed, along with the three "CMS" mentions in its
prose, which #131 would have rewritten had the file existed on main.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014BPd2Y1UEHBrEGkEPEw5oa
Ardnived added a commit that referenced this pull request Nov 21, 2026
…ews lib/sentry/

The generated-file note pointed at server/cms-types.ts, renamed away in
#131; app-specific SahajCloud types live in types/sahajcloud.ts. The
security-review trigger matched the root sentry.browser.config.ts, which
this PR moved to lib/sentry/, so it now names lib/sentry/.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-merge-queue Bot pushed a commit that referenced this pull request Nov 22, 2026
…lated (#328)

* refactor(server): one file per /api route, under server/routes/api

server/api-routes.ts held all four same-origin JSON routes. Each now lives
in the file its path names, so the folder is the route list:

  routes/api/related-meditations.ts      GET  /api/related-meditations/:lectureId
  routes/api/related-lectures.ts         GET  /api/related-lectures/:meditationId
  routes/api/submissions.ts              POST /api/submissions
  routes/api/live-preview/populate.ts    POST /api/live-preview/populate

What more than one route reads moves to _shared.ts (parseLocale,
relatedAnswer) and _proxy-failure.ts (upstreamRefusal,
reportProxyFailure). index.ts keeps registerApiRoutes, so entry.ts changes
by one import.

No behaviour changes: every handler body is moved verbatim, and every
existing test case is kept, split beside the file it covers. The new
index.test.ts fails a route registered outside the file its path names, a
route file that registers nothing, and a file index.ts does not register.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* refactor(server): a folder per /api route, holding its test and its own files

Each route is now a folder at its path, holding route.ts, route.test.ts and
anything only it reads:

  related-meditations/route.ts       GET  /api/related-meditations/:lectureId
  related-lectures/route.ts          GET  /api/related-lectures/:meditationId
  submissions/route.ts, schema.ts    POST /api/submissions
  live-preview/populate/route.ts     POST /api/live-preview/populate

submissionSchema and SUBMISSION_BODY_LIMIT move from server/validation.ts
to submissions/schema.ts, since only that route reads them; the
zod-validation rule now also loads for a route's schema.ts. Top-level `_`
files stay for what several routes share.

index.test.ts now maps a path to `<path>/route.ts`, and also fails a file
that sits in no route's folder and is not a shared `_` file.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(server): move the route-tree guard to tests/guards

index.test.ts was a guard — a prose rule held by a test — sitting inside
the folder it audits, while the other twenty live in tests/guards/ with
shared plumbing in _source-scan.ts and two of them cited by AGENTS.md at
that path. Keeping this one next to its subject made a second convention
for the same kind of check.

It globs ../../server/routes/api/**/*.ts from there and strips that prefix
off each key, so a reported path still reads as the folder does. Checked
that it still fails on a stray file and on a misplaced route path.

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

* docs(server): cut the route convention to its rule

The section retold what the code and the guard already hold: the
path-to-file example, the register signature, and a last sentence listing
the three cases the guard fails on. A check that enforces a rule gets one
pointer, never its cases.

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

* fix(server): give parseLocale a home beside isLocale

parseLocale is isLocale plus a default, and both the narrowing and the
'en' it falls back to already live in sahajcloud-types.ts, where the
default is named DEFAULT_LOCALE. It is reusable there by name.

What stays behind is relatedAnswer, for the two related-* routes, so the
file takes their name: _shared said only that something shared it.

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

* fix(server): one owner for the short JSON Cache-Control

oembed-routes.ts and the related-* answer each held a byte-identical
'public, max-age=300, stale-while-revalidate=1800'. The split built the
shared owner for that value and left its twin next door, so both now read
JSON_CACHE_CONTROL from server/cache-headers.ts. The sitemap's longer one
stays where it is.

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

* fix(ci): drop the trailing blank line prettier refuses

submissions/schema.ts ended on a second newline. Lint went red once #313
set --max-warnings 0, which turns prettier/prettier into a failure.

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

* refactor: move files to their topic folders and import through `@/`

The mechanical half of the reorganisation, written by one script so any
branch can replay it:

- `@/` is the repo root (tsconfig `paths`, and the alias in vite, both
  vitest configs and Ladle), matching SahajCloud and SahajAtlasWeb.
  Imports leave a folder through `@/`; inside one they stay `./`.
- SahajCloud types leave server/: types/payload/payload-types.ts (the
  path SahajAtlasWeb uses), types/sahajcloud.ts, types/atlas.ts.
- The SahajCloud client and its transport move to server/sahajcloud/.
- oembed, sitemap.xml and manifest.webmanifest get route folders under
  server/routes/, like the /api routes.
- lib/ is grouped by topic: a11y, atlas, content, errors, forms, i18n,
  media, seo, sentry, urls (live-preview as before). The browser Sentry
  config moves from the repo root to lib/sentry/browser-config.ts, and
  AudioPlayer's shared playback types to lib/media/audio.ts.
- Each template gets its own folder; DESIGN_SYSTEM.md, STORYBOOK.md and
  MCP_USAGE.md move to docs/.

No code changes beyond import specifiers and the paths that name moved
files.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* refactor(server): browser code reads nothing from server/, and every route has a folder

Everything the browser needed from server/ moves to lib/:

- the locale constants and rules → lib/i18n/locales.ts
- WEB_TRANSLATIONS_SELECT and WebTranslations → lib/i18n/web-translations.ts
- ErrorType, readStatus and detectErrorType → lib/errors/error-type.ts
- isCanonicalOrigin → lib/seo/canonical-origin.ts

With no browser importer left, error-utils.ts reports through
@sentry/cloudflare like the rest of server/, instead of @sentry/react.
The Ladle build therefore bundles no server/ module, so the Smoke
(ladle) WATCH list drops its server/ paths, and the guard now asserts
the bundle reaches none.

robots.txt, sitemap.xml and manifest.webmanifest each get their own
route folder (sitemap-routes.ts held all three), sharing
ROOT_FILE_CACHE_CONTROL from server/cache-headers.ts. server/routes/
index.ts registers every route, so entry.ts makes one call, and the
route-tree guard now covers the whole of server/routes/.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fixup: drop imports the route split left unused

* refactor(server): one file per kind of SahajCloud read, behind server/sahajcloud/index.ts

client.ts held every read in 1,030 lines. It splits into pages, documents,
lectures, meditations, related, web-config and web-translations, with the
select/populate shapes in selects.ts and the shared options and preview
retry in query.ts. index.ts is the one entry point, so callers import
from '@/server/sahajcloud'; its test moves with it, unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* build(lint): imports leave a folder through @/, and browser code imports nothing from server/

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(server): a guide for server/ and one for server/sahajcloud/, and every path the moves changed

server/AGENTS.md now covers the route folders, the server-only boundary,
the submission proxy and Sentry; the SahajCloud read rules move to
server/sahajcloud/AGENTS.md, so they load where the reads are.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(ci): name both stale server/ entries in the Ladle triggers

* chore(scripts): keep the move script on the branch, so an open PR can replay it

scripts/reorg/ is temporary: it goes once no open PR predates this one.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(scripts): sync-translations writes the moved English mirror

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

* fix(lint): the component-tree JSDoc sits on the const it documents

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

* fix(server): getWebConfig bounds its warning through warnOnce

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

* fix(server): the proxy 400 bound is warnOnce, not a second copy

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

* fix(server): the atlas reads are exported from the sahajcloud barrel

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

* fix(server): three split comments name their module, not "above"

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

* fix(server): three files import one module once

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

* style(server): rewrap the warning-volume rule at 100 columns

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

* fix(server): workflow.json names the types file that exists, and reviews lib/sentry/

The generated-file note pointed at server/cms-types.ts, renamed away in
#131; app-specific SahajCloud types live in types/sahajcloud.ts. The
security-review trigger matched the root sentry.browser.config.ts, which
this PR moved to lib/sentry/, so it now names lib/sentry/.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* refactor(i18n): screen-reader strings live in the repo, machine-translated

Every string only a screen reader speaks moves out of SahajCloud's
wm-web-translations into lib/i18n/a11y/<locale>.json: the 60 keys of the
ten `a11y` groups, plus the three in-flight keys SahajCloud#1241, #1225 and
#1232 were adding (media.a11y.progress, meditation.a11y.finder_region and
blocks.a11y.next_session). English is the source; every other locale is
machine-translated, and a11y.test.ts refuses a gap, a wrong plural set or
a lost placeholder.

loadTranslations mounts the request locale's strings at <tab>.a11y over
whatever SahajCloud returns, so t('media.a11y.play') call sites are
unchanged and SahajCloud's old copies stop mattering before it drops them.
The English fallback keeps the visitor's screen-reader language. Only
English is imported where a browser can reach it; the other locales load
in the server-only catalog.

The snapshot and sync:translations drop every `a11y` group.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* refactor(i18n): read screen-reader strings only from the repo, with nothing to strip

SahajCloud#1246 removes every `a11y` group before this lands, so nothing
upstream needs handling: WebTranslations no longer Omits SahajCloud's
`a11y`, sync:translations no longer prunes one, and withA11y simply mounts.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(i18n): withA11y takes one type parameter, not two

`Base` was only spread, and both call sites named it, so the generic
was a cast with extra steps. `base: object` takes any of them, which
also drops the `as unknown as` at the English snapshot and the return
annotation `loadTranslations` only carried to widen that `.then`.

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

* fix(i18n): both bare-read routes mount the screen-reader strings

`/manifest.webmanifest` and `/oembed` read SahajCloud directly, and the
`TranslationSource` union existed only so they could pass that read to
`getT`. It let an `a11y` key type-check at both and render as its key
path. They mount the locale's strings instead, so the accessor's type
says every string is present again.

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

* fix(i18n): a11yStringsFor resolves without a cache

Memoing ten small group spreads sat beside `withA11y` spreading
thirteen whole tabs on every request, uncached. `loadTranslations`
already memos the whole result per request.

The two mount assertions compare by value, since the strings are no
longer one shared object per locale.

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

* docs(i18n): the rule names its check, not the check's cases

The screen-reader bullet retold `a11y.test.ts`'s assertions, and this
file loads in every session. The `eslint-disable` paragraph governs
visible copy as much as spoken copy, so it sits above both bullets
rather than reading as the second one's tail.

`rest-api.md` names `withA11y` rather than `loadTranslations`, now
that two routes mount the strings as well.

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

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: SYDevelopers Bot <[email protected]>
Co-authored-by: sydevs-bot <[email protected]>
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.

refactor: use SahajCloud, not CMS, as the backend's name in code

3 participants