Skip to content

refactor: reorganise folders by topic, import through @/, and keep server/ server-only - #327

Merged
Ardnived merged 27 commits into
mainfrom
claude/reorg-layout
Nov 22, 2026
Merged

Ardnived merged 27 commits into
mainfrom
claude/reorg-layout

Conversation

@Ardnived

@Ardnived Ardnived commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

A one-pass reorganisation of WeMeditateWeb's folders. Nearly every file's imports change; almost no runtime code does. This PR includes #326 (a folder per /api route), so #326 can be closed in favour of it, or merged first.

Commits are separated so each can be reviewed alone:

  1. refactor: move files to their topic folders and import through @/: mechanical, written by a script, which is kept on the branch at scripts/reorg/ so an open PR can replay it (see Open PRs below).
    • @/ is the repo root: tsconfig paths, plus the alias in vite, both vitest configs and Ladle. This matches SahajCloud and SahajAtlasWeb, where @/ is src/; this repo has no src/.
      • Why the root and not a new src/. One prefix then means a different folder in each repo, and that is the cost accepted here. A src/ move changes every place a top-level folder is named as a pattern rather than imported, and those are what no import rewrite reaches: layouts/tailwind.css's three @source lines, eslint.config.js's globs, .prettierignore, vitest.config.ts, the WATCH regex in ci.yml, the paths: of six docs/rules/*.md files — and the wemeditate-design Worker's two Builds triggers, which live in the Cloudflare dashboard and cannot move in the same commit (see docs/cloudflare-previews-ci.md). The one pattern this PR did leave stale, securityReview.triggerPattern, is exactly that class of miss. A later move to src/ stays possible and would rewrite the imports again; it is a second reorg, not a cheaper version of this one.
    • An import that leaves its folder uses @/. One that stays inside a folder keeps ./.
    • The SahajCloud types move out of server/:
      • types/payload/payload-types.ts, the same path SahajAtlasWeb uses;
      • types/sahajcloud.ts;
      • types/atlas.ts.
    • The client and its transport move to server/sahajcloud/: payload-client, fetch, context and atlas.
    • oembed, sitemap.xml and manifest.webmanifest get route folders under server/routes/.
    • lib/ is grouped by topic: a11y, atlas, content, errors, forms, i18n, media, seo, sentry, urls. live-preview is unchanged.
      • sentry.browser.config.ts moves from the root to lib/sentry/browser-config.ts.
      • AudioPlayer's shared playback types move to lib/media/audio.ts, because lib/ and hooks/ imported them from a molecule.
    • Each template gets its own folder. DESIGN_SYSTEM.md, STORYBOOK.md and MCP_USAGE.md move to docs/.
  2. refactor(server): browser code reads nothing from server/, and every route has a folder
    • Code the browser needs moves from server/ to lib/:
      • the locale constants → 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.
    • One runtime change: with no browser importer left, error-utils.ts reports through @sentry/cloudflare instead of @sentry/react. Both re-export the same @sentry/core, and the tests that spied on @sentry/react now spy on @sentry/cloudflare.
    • The Ladle build now bundles nothing from server/. So the Smoke (ladle) WATCH regex drops its server/ paths, and ladle-watch-paths.test.ts now asserts the bundle reaches no server/ module.
    • sitemap-routes.ts held three routes. They split into robots.txt/, sitemap.xml/ and manifest.webmanifest/, which share ROOT_FILE_CACHE_CONTROL.
    • server/routes/index.ts registers every route, so entry.ts makes one call. The route-tree guard (tests/guards/route-files.test.ts) now covers all of server/routes/.
  3. refactor(server): one file per kind of SahajCloud read
    • client.ts, at 1,030 lines, splits into pages, documents, lectures, meditations, related, web-config and web-translations.
    • The select and populate shapes go in selects.ts. The shared options and the preview retry go in query.ts.
    • Callers import from @/server/sahajcloud (index.ts). The client's test moves to index.test.ts, unchanged.
  4. Lint:
    • no-restricted-imports refuses ../ imports in the app folders.
    • It also refuses any @/server/* import from code a browser can load. That covers components, hooks, layouts, lib, types, .ladle, and every pages/ file except +data.ts, +onBeforeRender.ts and the _ loaders those call.
  5. Docs:
    • server/AGENTS.md now covers the routes, the server boundary, the submission proxy and Sentry.
    • The SahajCloud read rules move to the new server/sahajcloud/AGENTS.md, which has a CLAUDE.md symlink.
    • rest-api.md and zod-validation.md get new paths:, and every prose path the moves changed is updated.

Cross-repo

  • claude-workflow loop-config.json: WeMeditateWeb's contractSync path changes from server/payload-types.ts to types/payload/payload-types.ts, in a companion PR. Merge it right after this one.
    • contract-check passes in either order. It only regenerates the paths listed in the config, and a deleted copy regenerates as nothing.
    • Until the companion merges, a SahajCloud schema sync would write the new file but commit the old path.
  • Cloudflare Ladle triggers still list server/cms-types* and server/error-utils*. Both are now unneeded (see docs/cloudflare-previews-ci.md). They're set in the dashboard, and removing them is optional.

Open PRs

Every open PR touching a moved file needs a merge of main after this lands. The file moves and import rewrites are replayed by running scripts/reorg/ on each branch — see its README.md. What's left to resolve by hand is real content conflicts:

  • in files whose content was split: sahajcloud-client.ts, sitemap-routes.ts, sahajcloud-types.ts, error-utils.ts, sitemap.ts;
  • in moved files that the PR itself changed.

Not changed

  • layouts/headerDropdown.ts stays in layouts/, its only consumer.
  • SocialLink stays a Footer prop type that lib/seo/site-identity.ts imports as a type. Moving either buys nothing.

Test plan

  • .claude/skills/pr-prep/check.sh --full: lint (0 warnings), tsc, 169 files / 1704 tests, pnpm build
  • pnpm ladle:build
  • The new lint rules refuse a probe file importing ../ and @/server/… from lib/

🤖 Generated with Claude Code

Ardnived and others added 16 commits November 20, 2026 15:51
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]>
…wn 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]>
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
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
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
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
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
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]>
…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]>
…/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]>
…rts nothing from server/

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… 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]>
@sydevs-bot

sydevs-bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

🤖 no session running

recent dispatches
  • 01:03Z address-review · attempt 1 · session · done
  • 01:03Z address-review · attempt 1 · session
  • 00:46Z review-pr · attempt 1 · session · done
  • 00:46Z review-pr · attempt 1 · session

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

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 21, 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 22f4d05 Commit Preview URL

Branch Preview URL
Nov 21 2026, 02:09 AM

@cloudflare-workers-and-pages

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-design af05e25 Commit Preview URL

Branch Preview URL
Nov 21 2026, 12:46 AM

@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 21, 2026
@sydevs-bot sydevs-bot moved this from Pending to Working in SYDevelopers Technical Roadmap Nov 21, 2026
… replay it

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

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

@sydevs-bot sydevs-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧐 Adversarial review

438 files, almost all of them moves, and the diff matches its statement. Nothing is smuggled in, and the server/ boundary earns the churn because lint now enforces what was convention. One real defect: the sync script still writes the old English mirror, silently disabling a CI guard. The cross-repo claim holds — claude-workflow#297 exists and moves contractSync to the new path.

Findings

  • blocker — scripts/sync-translations.mjs:142 writes lib/translations.en.json, not lib/i18n/. Thread on line 144.
  • should-fix — .claude/workflow.json:31 names server/cms-types.ts, removed in #131. Thread on that line.
  • should-fix — .claude/workflow.json:14: securityReview.triggerPattern ends at ^sentry\.[a-z]+\.config\.ts, which matched the root sentry.browser.config.ts this PR moved to lib/sentry/browser-config.ts. A Sentry browser-config change now fires no security review. Add ^lib/sentry/. No hunk covers line 14, hence no thread.
  • consider — tsconfig.json:17: @/ is the repo root here, src/ in the siblings.

What was checked

  • 92 paths exist on main and not on the branch. Each was grepped as a literal across the branch: no stale path reference anywhere, prose and skills included. Both defects above are pattern-shaped, which that grep cannot see.
  • Patterns rather than paths, one by one: .prettierignore, eslint.config.js ignores, ci.yml WATCH, vitest.config.ts, tailwind.css @source, docs/rules/*.md paths:. Only securityReview.triggerPattern is stale.
  • The @/server/* rule was tested, not assumed: ignore().add(['@/server','@/server/*']).ignores('@/server/sahajcloud/pages') is true in the matcher ESLint uses, so it reaches nested files.
  • Anomaly: the streamliner subagent did not return before the lease deadline, so its piece counts are absent.

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


Generated by Claude Code

Comment thread scripts/sync-translations.mjs Resolved
Comment thread .claude/workflow.json Resolved
Comment thread tsconfig.json Resolved

@sydevs-bot sydevs-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧐 Adversarial review — streamliner pass

Correction: the streamliner did finish, inside the lease. Its findings are the six threads here. Disregard the anomaly line in the body above.

Pieces walked: 99 across 31 files. 84 were confirmed as moves (git grep -w <name> origin/main), so the whole of server/sahajcloud/** and server/routes/**, and the five lib/ extractions, are not new pieces. Kept: 92.

Findings — all should-fix, each on its line

  • eslint.config.js:20 — two consts inserted between a JSDoc and the const it documents, breaking a cross-file sync pointer.
  • server/sahajcloud/web-config.ts:57 and server/routes/api/_proxy-failure.ts:33 — two hand-rolled copies of warnOnce (server/error-utils.ts:180), which siblings in the same folder already call. Predates the PR.
  • server/sahajcloud/index.ts:2 — "import from here, not from a file inside" is false in the diff that writes it: two call sites import atlas.ts directly.
  • server/sahajcloud/documents.ts:131 — three comments point "above" at code the split moved away.
  • server/sahajcloud/related.ts:7 — three files import one module twice.

What held. server/cache-headers.ts de-duplicates one literal from two files. The eight register* wrappers follow a pattern already on main, pinned by route-files.test.ts. selects.ts is a verbatim move of per-collection field lists. The @sentry/react → @sentry/cloudflare switch is correct once detectErrorType moved: ErrorFallback.tsx and pages/_error/+Page.tsx are the only browser readers and both import from lib/ now.

Not verified, so not filed: folding the two near-identical related-* handlers into _related.ts, moving server/content-index.ts into server/sahajcloud/, and cutting server/AGENTS.md:6-13 where it restates routes/index.ts. I ran out of lease to check these.

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


Generated by Claude Code

Comment thread eslint.config.js Resolved
Comment thread server/sahajcloud/web-config.ts Resolved
Comment thread server/routes/api/_proxy-failure.ts Resolved
Comment thread server/sahajcloud/index.ts Resolved
Comment thread server/sahajcloud/documents.ts Resolved
Comment thread server/sahajcloud/related.ts Resolved
@sydevs-bot sydevs-bot removed the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 21, 2026
@Ardnived
Ardnived added this pull request to the merge queue Nov 22, 2026
Merged via the queue into main with commit 5d6cbd9 Nov 22, 2026
32 of 33 checks passed
@Ardnived
Ardnived deleted the claude/reorg-layout branch November 22, 2026 17:47
@sydevs-bot sydevs-bot moved this from Awaiting to Done in SYDevelopers Technical Roadmap Nov 22, 2026
sydevs-bot pushed a commit that referenced this pull request Nov 22, 2026
#327 reorganised lib/ by topic and moved every cross-folder import to the
`@/` alias, which collided with this branch's three import blocks and left
its four new files on paths that no longer resolve.

Every hunk keeps both sides: main's `@/` spelling, this branch's new
imports. `lib/content-blocks` is now `@/lib/content/blocks`, and
`blocks.test.ts` keeps the `TextBoxBlock` type the branch added beside
main's `ContentIndexBlock`.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjV83ryJLF6Jfwp8dz8
sydevs-bot added a commit that referenced this pull request Nov 22, 2026
…n-repo

#327 squash-merged as 5d6cbd9, so git's merge base predates it and the same
content reaches the merge from both sides. main's tree is identical to this
branch's tree at 22f4d05, the commit before the a11y work, so every hunk
resolves to this branch.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjXcg7NjuuAuuSvDjaq
sydevs-bot pushed a commit that referenced this pull request Nov 22, 2026
Four conflicts, all import blocks against #327's folder reorganisation.
Each keeps this branch's symbols, spelled the `@/` way main now uses:

- Accordion.tsx: `Heading` arrives with the `headingLevel` prop, beside
  main's `Icon`.
- LanguageDropdown.tsx: `DropdownItem` replaces the hand-rolled rows, so
  the direct `Link` import main added goes with them.
- LanguageDropdown.test.tsx: the `importOriginal` mock stays, because
  `DropdownItem` has to stay real to render the links under test.
- page-types.test.tsx: `RunOptions` stays dropped, since `axeOptions` now
  lives in tests/_helpers/axe.ts.

The six files #327 never saw — the five new specs and this branch's edit to
the a11y gate — move to `@/` too. `no-restricted-imports` bars `../*` in
every aliased folder, so a relative path across folders is now a lint error.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjXDjyKLtEiZJVmnxBT
sydevs-bot pushed a commit that referenced this pull request Nov 22, 2026
#327's reorg deleted `server/sahajcloud-client.ts` and split it, so this
branch's two edits to it move to where they now live: the page populate's
`credit` entry to `server/sahajcloud/selects.ts`, and the public-read
`reportDroppedImages` call to `server/sahajcloud/pages.ts`.

`server/dropped-images.ts` stays at the `server/` root beside
`error-utils.ts` — it reports on a read rather than making one — and its
imports take the new `lib/content/` paths.

`server/dropped-images.test.ts` now mocks `@sentry/cloudflare`: main moved
`error-utils.ts` off `@sentry/react` once the browser-shared error
classifier left for `lib/errors/error-type.ts`, so the old mock silenced
`warnOnce` and three tests saw no report.

The three RichText conflicts were import regions only. Each takes main's
`@/` paths and keeps this branch's additions: `populatedImage`,
`IMAGE_CREDIT_CLASS`, and `@/tests/_helpers/markup`. `nearestAspectRatio`
goes, because the upload converter no longer snaps a ratio.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjZ7B98X5hBMvxoq1m4
sydevs-bot pushed a commit that referenced this pull request Nov 22, 2026
#327's repo-wide reorg (5d6cbd9) landed on main ahead of this branch, so
every conflict was an import path.

- Each conflicted import block takes main's `@/` spelling, and this branch's
  own imports follow their modules: lib/paragraphs -> lib/content/paragraphs,
  lib/document-routes -> lib/urls/document-routes, lib/cloudflare-images ->
  lib/media/cloudflare-images, lib/i18n -> lib/i18n/i18n,
  server/sahajcloud-types -> types/sahajcloud.
- server/sahajcloud-client.ts is gone on main, split into server/sahajcloud/.
  This branch's one key, `tags` in EMBEDDED_PAGE_SELECT, moves to
  server/sahajcloud/selects.ts with its comment.
- lexical-helpers.ts keeps this branch's removal of the `slugify` re-export,
  and RichText.tsx imports it from @/lib/urls/slugify. RichText.tsx was the
  re-export's only reader on both sides.
- Blockquote.stories.tsx's `../Link` becomes @/components/atoms/Link, because
  the reorg makes `../*` a lint error.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjUsZj1TrG6xTM3FrzD
sydevs-bot pushed a commit that referenced this pull request Nov 22, 2026
#327 made an import that leaves its own folder a lint error, and this story's
`../Link` was written while the branch still used relative paths.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjUsZj1TrG6xTM3FrzD
sydevs-bot pushed a commit that referenced this pull request Nov 22, 2026
main (#327) reorganised the tree by topic, so both conflicts and the
breakage underneath them are that refactor meeting this branch's new
files.

`package.json`: took main's `types:cms`, which now writes
`types/payload/payload-types.ts`, and kept this branch's four
`redirects:*` scripts beside it. Both sides wanted both.

`server/entry.ts`: took main's single `registerRoutes(app)` and kept
`registerLegacyRedirects(app)` ahead of it. The middleware is not a
route at a path — it acts after `next()` on whatever the site refused —
so it stays out of `server/routes/` and keeps its own registration.

The refactor also moved what this branch's added files import, which no
hunk reports because main never touched those files. `Locale` now comes
from `types/sahajcloud`, `DEFAULT_LOCALE` from `lib/i18n/locales`, and
the URL helpers from `lib/urls/urls`, each through `@/`. That also puts
`lib/legacy-redirects/core.ts` on the right side of the server-only
boundary main now lints: it read both names out of `server/` before.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjVF8mac9oL3ufMsMW4
sydevs-bot pushed a commit that referenced this pull request Nov 22, 2026
#327 reorganised the tree by topic and moved every cross-folder import onto
the `@/` alias, which touched all seven files this branch edits.

- `Box.stories.tsx`, `Spacer.stories.tsx` (modify/delete): main only
  re-pointed their imports, so the deletion stands.
- `Image.tsx`, `Lightbox.tsx`, `Lightbox.stories.tsx`: main's `@/` paths,
  with this branch's `lightbox-context` as the source of `LightboxSlide`
  and `LightboxContext`. `LightboxProvider.tsx` merged clean but kept a
  `../../atoms` path, which the new lint rule rejects; it reads `@/` now.
- `Logo.tsx`: main's `inline` variant, this branch's `HTMLAttributes` props.
- `types/sahajcloud.ts`: took main's side. The locale and translation blocks
  this branch edited moved to `lib/i18n/locales.ts` and
  `lib/i18n/web-translations.ts`, so the unused `LOCALES` export is removed
  at its new home instead.
- `docs/STORYBOOK.md`: this branch's Badge and Spinner rows, at main's path
  for the file's move under `docs/`.

`tests/guards/atomic-imports.test.ts` read relative specifiers only. Every
cross-level import is spelled `@/` now, and lint forbids `../` outside a
folder, so the guard had nothing left to see. It resolves both spellings
through a `resolveModule` shared with `ladle-watch-paths.test.ts`, which
already had its own copy.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjVqxmDisHDFCXAMVyL
sydevs-bot pushed a commit that referenced this pull request Nov 22, 2026
#327 reorganised the tree while this branch was open. Every conflict was the
same shape — main's `@/` paths against one import this branch adds — except
three.

`server/warn-once.ts` is deleted, and both callers now take `warnOnce` from
`server/error-utils.ts`. This branch built `createWarnOnce` there because
`error-utils.ts` was reachable from the browser; #327 moved the browser's
error helpers to `lib/errors/` and built the same memo in `error-utils.ts`,
so the reason for a second module is gone and `server/sahajcloud/AGENTS.md`
already names `warnOnce` as the bound.

`server/api-routes.ts` and `server/sahajcloud-client.ts` are deleted, as main
deletes them: this branch only repointed their comments at the memo, which
their successors in `server/routes/api/` and `server/sahajcloud/` already do.

The pending-translations overlay follows its consumers — the types into
`lib/i18n/web-translations.ts`, the English into `lib/i18n/translations.pending.ts`.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjXv5NZFJUmYG7dNyNq
sydevs-bot pushed a commit that referenced this pull request Nov 22, 2026
#327 reorganised lib/ and server/ by topic and moved imports onto `@/`, so
most hunks were paths. Three resolutions were decisions:

- lib/live-session.ts lands at lib/content/live-session.ts, beside the
  blocks.ts and payload-relationships.ts it reads. server/live-session.ts
  stays at server/ root, like content-index.ts.
- PAGE_POPULATE's `events` and `regions` entries, with SESSION_EVENT_SELECT
  and REGION_ROUTE_SELECT, move to server/sahajcloud/selects.ts, which is
  where #327 split them out of sahajcloud-client.ts.
- main's `warnOnce` fold wins in getWebConfig and in the proxies: it landed
  upstream while this branch was in flight, so this branch's own fold and its
  server/api-routes.ts edit are dropped rather than re-applied. The bare-id
  rule's added sentence follows its section to server/sahajcloud/AGENTS.md.

Two specs here measured the pre-#327 shape and are corrected, not relaxed:
server/live-session.test.ts mocked @sentry/react, which error-utils.ts no
longer reports through, and lib/seo/head.test.tsx read its sibling component
paths from one folder up.

Lean gate green: lint, tsc --noEmit, 1771 tests, and pnpm build.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjVXgAp7bwuSvur2jYk
sydevs-bot pushed a commit that referenced this pull request Nov 22, 2026
#327 reorganised the tree by topic and made a cross-folder relative
import a lint error. These three files are this branch's own, so that
PR never saw them: merging it left them reaching for `server/
sahajcloud-types`, `lib/content-seo`, `lib/seo-head-html` and
`lib/i18n`, none of which exist any more.

Each now names the post-reorg module through `@/`, the way the branch's
own locale spec already did.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjYrT8Bs1ug1zbrbqLY
sydevs-bot pushed a commit that referenced this pull request Nov 22, 2026
#327 made a retried attempt a breadcrumb and the final failure a
`captureException`. A mock carrying only `captureMessage` therefore throws
inside `withRetry`'s own catch, which aborts the loop after one attempt and
reads as a read that never retried — `server/content-index.test.ts` failed
exactly that way on the merge.

Also formats the branch's files for the warning-free gate #313 introduced.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjXv5NZFJUmYG7dNyNq
sydevs-bot pushed a commit that referenced this pull request Nov 23, 2026
The comment on this read's retry claimed the wrapper reports every retried
attempt, so one failed 5xx read cost three Sentry events. #327 made a retried
attempt a breadcrumb: the cost is the wrapper's one captureException plus this
caller's degrade, whatever the attempt count.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjVjPd5UW9q1WXiPxqm
sydevs-bot pushed a commit that referenced this pull request Nov 24, 2026
#327 moved every file this branch touches and closed `lib/** <-> server/**`
both ways. Four of the five conflicts are mechanical renames. The fifth is
the mechanism: `createT` can no longer call `warnOnce`, because ESLint
refuses `lib/**` an `@/server/*` import and `error-utils` now reports
through `@sentry/cloudflare`, which no browser bundle can take.

Resolved as option 1A, the reviewer's answer on #300: the injected reporter
comes back. `lib/i18n/i18n.ts` holds `MissingTranslation`,
`reportMissing` and `setMissingTranslationReporter` again, and
`server/site-context.ts` installs one that calls `warnOnce`. The boundary
holds, the dedupe stays `warnOnce`'s, and the Sentry message, tags and
extra are unchanged.

The volume-bound test moves back beside the install, in
`server/site-context.test.ts`. `lib/i18n/i18n.test.ts` asserts what the
accessor hands the reporter, which is all it now decides.

The other four: paths and aliases, `WebTranslations` split into
`SahajCloudWebTranslations` for a mocked raw read, the `RequiredGroups`
doc moved with the type to `lib/i18n/web-translations.ts`, and the
`getWebTranslations` doc moved to `server/sahajcloud/web-translations.ts`.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjVCjeMfw9AMwXe1FJb
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.

3 participants