Repository navigation
Conversation
…utover Add a snapshot of the old Rails site's public URL inventory (SELECT-only export), the old locale path words, and the pages the new site serves, with a deterministic generator that builds a compact redirect map from them and a pure lookupLegacyRedirect over it. The 404-path wiring is a separate change. Part of #160 Co-Authored-By: Claude Fable 5.2 <[email protected]>
|
🤖 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
This PR matches its ticket. #160's 2026-11-18 decision puts the redirects in the site's own code, and the build plan orders the map and its generator first, built attended from the old database — which is this diff. Most of the 5,503 lines are data and the generator; the lookup is 280 lines. Its verification — 1,247 addresses round-tripped in a test, 122 targets checked live — is stronger evidence than this review could produce, so I went after rent, not correctness.
Findings
- should-fix
core.ts:138—pageHrefrestateslocalePath, which CLAUDE.md makes a repo-wide rule, andLAUNCH_LOCALESis untyped. - should-fix
map-format.ts:4— two hand-rolled JSON formatters arrive in one diff. - consider
lookup.ts:28— nothing imports the lookup, so none of it runs yet. - consider
queries.test.ts:13— the ten SELECTs live twice, with a test policing the copy. - consider
package.json:22— four scripts for three once-ever runs.
What was checked
Read whole on the branch: core.ts, lookup.ts, both test files, queries.ts, json.ts, map-format.ts, generate.ts, fetch-new-site.ts, README, plus lib/urls.ts and server/sahajcloud-types.ts as the owners this code sits beside. Ladder, named answers only: localePath, Locale/KNOWN_LOCALES and JSON.stringify, all three flagged; nothing in the repo or a package answers the generator. package.json is the one pre-existing file the diff grows. JSON.stringify(map, null, 2) measures 1,331 lines against the committed 1,043. git grep confirms nothing outside scripts/ and the tests imports lib/legacy-redirects. All 121 meditations in new-site.json carry locale: en, so the always-English meditation target is upstream data, not a defect. No preview link: .claude/workflow.json declares no previewUrl or fixture.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
`pageHref` restated `localePath`'s rule, bare `/fr` case included, which CLAUDE.md makes repo-wide: how a URL is spelled lives in `lib/urls.ts`, never in a consumer. The published-there test is all that stays here. `LAUNCH_LOCALES` values are now `Locale`, so a locale renamed upstream is a compile error rather than a silent miss — `KNOWN_LOCALES` exists for that. The visitor locale it feeds is typed through to `pageHref`. `build.test.ts` reads the map byte-for-byte against the generator, so the unchanged `map.generated.json` is the evidence this is a pure refactor. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjWYeFVeG7kjXwXtUxy
Two hand-rolled formatters arrived in one diff. `JSON.stringify(map, null, 2)` already puts one slug per line, which is the whole property the 70-line walker existed for, so the walker and its module go and `json.ts` keeps the one-line spelling the generator and `build.test.ts` share. The map grows from 1,043 lines to 1,331 and from 39 KB to 40 KB — the `pages` and `words` members expand instead of sitting inline. It stays well under the 300 KB the test bounds it by, and still diffs per address. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjWYeFVeG7kjXwXtUxy
The ten SELECTs lived twice, in `queries.ts` and verbatim in the README, with a test case policing the copy. The README's "The queries" section now points at `queries.ts`, and the reader who needs a statement runs the script that carries it. `only read` and `never select a user column` stay: those two check the statements themselves, not a transcription. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjWYeFVeG7kjXwXtUxy
Nothing imported the lookup, so the rules and the 40 KB map were unreachable until the cutover. A Hono middleware registered before the routes and acting after `next()` answers the 404 this site would otherwise return, which is the first real request the map ever sees. Under the `/en` prefix the lookup runs before the routes instead. `+onBeforeRoute` 301s `/en/x` to `/x` ahead of any 404, so a legacy address spelled that way would cost two hops; the lookup reads `/en` as the old site's own prefix and answers with the same target in one. No enumerated address is one this site already serves 200 at, measured over all 1,247, so this cannot divert a live page. The query string is the visitor's and goes back on untouched. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjWYeFVeG7kjXwXtUxy
A target is spelled from a SahajCloud page slug, and the 404 middleware now puts that answer in a `Location` header. A slug spelled `/evil.com` would reach a visitor as `//evil.com`, which is a host despite the leading slash. `isSitePath` is the gate `lib/urls.ts` already owns for exactly this, so `lookupIn` applies it to every answer and no caller repeats it. No slug in the committed map needs it today; all 45 are plain. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjWYeFVeG7kjXwXtUxy
`data/legacy-redirects/README.md` and `lookup.ts` both said the wiring was a separate ticket. It is in this branch, so both name `server/legacy-redirects.ts`. `AGENTS.md`'s URL-spelling rule listed two destinations a URL the site did not author must be gated for. A `Location` header is the third, and `isSitePath` is its gate. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjWYeFVeG7kjXwXtUxy
|
Four adopted, one rebutted. Pushed 408bf79. Each thread carries the detail.
Base was current, no merge. Security review over Yours to call: 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
`Smoke (web)` failed on `canonicalizes the default (en) locale away via a 301 redirect` with `TypeError: Invalid URL`. The test reads the `Location` header with `new URL`, and the new middleware answered `/en` with a bare path, which that constructor refuses with no base. `pages/+onBeforeRoute.ts` spells every other redirect this site issues over the request's own URL, so the legacy map's targets are spelled that way too rather than making this the one relative `Location` a client resolves itself. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjXZJx8AQgubkZU7iX9
|
The newest commit, 6a091db, is sydevs-bot's own, so it is not approved on your behalf. Read it, then say 🤖 sydevs dispatcher |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
wemeditate-web | 8cbbf04 | Commit Preview URL Branch Preview URL |
Nov 23 2026, 12:21 AM |
foot-soak, ice-on-liver and candle-flame map to their new technique pages, and about-us to about-meditation, as explicit documented matches in the generator, applied in every language the old record exists in. Part of #160 Co-Authored-By: Claude Fable 5.2 <[email protected]>
sydevs-bot
left a comment
There was a problem hiding this comment.
Approved for Ardnived, who wrote it: GitHub refuses an author's own approval. CI is green and the automated review has run. Enable auto-merge when you want it merged: the queue tests it against its base. 🤖 Written by the sydevs autonomous loop — see what this is
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
wemeditate-design | 8cbbf04 | Commit Preview URL Branch Preview URL |
Nov 23 2026, 12:21 AM |
|
The newest commit, 73f1f06, is sydevs-bot's own, so it is not approved on your behalf. Read it, then say 🤖 sydevs dispatcher |
AGENTS.md conflicted on the URL-spelling rule. main (#323) condensed the gate prose to point at each gate's own header; this branch had added the `Location` header as a third destination. Took main's condensed wording and kept the new destination as one line, because `isSitePath` is not an `isSafe*` gate and its header says nothing about a redirect target. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjXN8FfQA4e1MdjMn3K
|
Merged
Lean gate green: lint, 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
sydevs-bot
left a comment
There was a problem hiding this comment.
Approved for Ardnived, who wrote it: GitHub refuses an author's own approval. CI is green and the automated review has run. Enable auto-merge when you want it merged: the queue tests it against its base. 🤖 Written by the sydevs autonomous loop — see what this is
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
|
Merged
The part no hunk reported: the refactor moved what this branch's own files import, and main never touched those files, so git merged them clean and broken. Gate green, plus 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
|
@sydevs-bot Page 10 ("Meditate Now") is moving from slug |
Page 10 moves from `meditate-now` to `meditations` (#272), so every address the map sent to `/meditate-now` now lands on `/meditations`, and `/meditations` itself stops redirecting — the lookup already refuses a target equal to the request, which makes it the seventh live address rather than a loop. Production still serves `meditate-now`, so the move is a `PENDING_SLUG_MOVES` override applied over `new-site.json` rather than an edit to it: the snapshot stays what a re-fetch produces, and a re-fetch cannot revert the rename. The entry throws if the snapshot carries a third spelling. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjZ5B6SSLgtWfZi63ek
|
Retargeted in 8cbbf04: the 263 addresses that pointed at Production still serves I did not drop
🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
A commit of sydevs-bot's own is now the head, and this approval did not cover it.
|
The newest commit, 8cbbf04, is sydevs-bot's own, so it is not approved on your behalf. Read it, then say 🤖 sydevs dispatcher |
What
The legacy redirect map for the wemeditate.com cutover: where an address on the old Rails site lands on this site. It is data, its generator, a pure lookup function, and the middleware that consults it on a 404.
lib/legacy-redirects/lookup.ts:lookupLegacyRedirect(pathname): string | null, overmap.generated.json(40 KB). Rules live incore.ts.server/legacy-redirects.ts: a Hono middleware registered before the routes, acting afternext(), so only a request this site already refused reaches the map.data/legacy-redirects/: the committed snapshots,README.md(re-export steps), andCOVERAGE.md(full report).scripts/legacy-redirects/: export, fetch and generate scripts, run withtsx. No new dependencies.Preview
Each old address below should answer
301to the page named, in one hop.curl -sIshows theLocation; a browser just lands there./blossom-time./footsoaking./classes-near-me?ref=newsletter, query string kept./privacy-notice.How the map was generated
legacy-inventory.json: SELECT-only exports from the old database (heroku pg:psql -a wemeditate) of articles, static pages, meditations, techniques, subtle-system nodes, categories, streams, promo pages andfriendly_id_slugs. A row is exported only if it was ever published (state2, 3 or 4), so a draft's address and title never reach the repo. No user tables are read.legacy-routes.json: theroutes:block of eachconfig/locales/<l>.ymlin the old app (translated path words), plus its locale list andPUBLISHED_LOCALES.new-site.json: the 66 pages and 121 meditations SahajCloud production serves, with each page's published languages.pnpm redirects:generatematches each old record to a new page by English slug, then English slug history, then normalised English title; a non-English record goes through its id to its English row. More than one page matching is reported, never guessed. The generator then looks up every address it enumerated and fails if one does not return its expected target, or if a target is itself redirected.The map is shape rules (translated section words per language, locale normalisation, unsupported-language fallback) plus 828 exact slugs, not the cross product.
build.test.tsfails whenmap.generated.jsonorCOVERAGE.mdis not what the snapshots generate.A rename agreed upstream but not yet served is a
PENDING_SLUG_MOVESentry inbuild.ts, applied overnew-site.jsonrather than written into it, so the snapshot stays whatpnpm redirects:fetch-new-siteproduces and a re-fetch cannot revert the rename. Page 10 carries the one entry:meditate-now→meditations(#272). An entry whose page moved to a third spelling throws rather than pinning the wrong slug.Coverage
1,247 old addresses enumerated from the records; 1,240 redirect and 7 are already live pages.
The full per-kind and per-language tables, every section fallback, and every judgement match are in
data/legacy-redirects/COVERAGE.md.Verification
/meditationsis the one target that does not answer yet. It 404s on the deployed site and/meditate-nowstill 200s, because production has not taken Visitors find a meditation that fits how they feel #272's rename. The map now leads that rename by a deploy, so Visitors find a meditation that fits how they feel #272 ships first or the 263 addresses that now target it land on a 404./uk/about, an error on the old site itself).server/legacy-redirects.test.tsdrives the middleware over the committed map: a refused request 301s to its target, a 200 is untouched, an address neither site had stays a 404, the query string survives, and/en/privacyreaches/privacy-noticein one hop.Not in this PR
/meditate-nowitself. It is a new-site address the rename retires, not an old Rails one, so no record enumerates it; the map answersnullfor it.Part of #160
🤖 Generated with Claude Code