Skip to content

feat(components): a MeditationLibrary for the meditations index block - #293

Open
sydevs-bot wants to merge 28 commits into
mainfrom
claude/feat-291-mood-finder
Open

sydevs-bot wants to merge 28 commits into
mainfrom
claude/feat-291-mood-finder

Conversation

@sydevs-bot

@sydevs-bot sydevs-bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Renders the existing meditations content-index block as a MeditationLibrary organism, the counterpart of MusicLibrary: "How are you feeling?" over the mood tiles, "How much time do you have?" over the duration tiles, then every meditation those choices name, narrowed one choice at a time.
  • Reworked in place to fix(server): the meditations index renders in every language #291 as rewritten on 2026-11-22 after the design review of Visitors find a meditation that fits how they feel #272. The code route, MoodFinder, server/moods.ts and the moods block type are gone; /meditations is a CMS page served by [slug].
  • Fixes the defect that made the block render empty outside English: meditations are now read by id at locale=all, because filterMeditationsByLocale makes any single non-English locale answer totalDocs: 0.
  • Folds in the two read defects the ticket lists in this path: fetchContentIndexDocs was the one SahajCloud read with no withRetry (fix(server): the content-index read is the one CMS read with no retry #128), and two meditation paths were built inline instead of through documentHref.
  • Extracts FilterPills from ContentIndex, which said to do so once a second consumer appeared.

Change outline

Flow — what one render of a meditations block now does

 data()                                             pages/[slug]/+data.ts
   resolveContentIndexBlocks(page.content)          server/content-index.ts
     songs            → resolveContentIndexTracks
     pages | lectures → resolveContentIndexItems
+    meditations      → resolveMeditationLibrary
+      fetchContentIndexDocs(fields)                # the block's OWN apiEndpoint
+        depth=0, locale=<page>                     # slots stay bare ids by design
+        docs.slice(0, limit)                       # totalDocs > docs → warn once
+      meditationLibraryFromChoices(docs)           server/meditation-library.ts
+        meditationChoice(doc)                      # type → kind; goal → drop, warn
+          slots read off each slot FIELD           # `timings` is the claim, not the answer
+          claimed-but-empty slot → warn once
+        GET /api/meditations?locale=all&where[id][in]=…&select[_status]
+          one read, deduped ids; fails → warn, empty library
+        unpublished | missing | no length → drop the slot AND the card, warn

locale=all is the only spelling that answers. filterMeditationsByLocale filters every find on that collection and every row is locale: en, so ?locale=fr&where[id][in]=… returns totalDocs: 0 — which is why the block renders empty in nine locales today. locale=en does answer, but it would drop a localized slot meditation, and a French choice may name a French one. The choices keep the page's own locale, where title is localized. server/sahajcloud/AGENTS.md now carries this beside the only other locale=all use.

Behaviour — a slot is read off its field, not off timings

A choice's timings is what it claims; the slot field is what it has. So slots is built from the fields, and a slot claimed with nothing in it is reported rather than rendered as a tile linking nowhere.

This differs from the previous design, and the reason is new: durations are not known to carry timings at all. Pairing on timings would have dropped every duration tile. The two hazards the earlier branch review caught are still closed — a meditation named by two choices is listed once carrying both (choiceIds), and the commonest data gap is still reportable, because claimedSlots is still read.

⚠ This is the one thing in the diff I could not confirm against the live API — this session has no SahajCloud key (see Notes for reviewer).

Components

 components/organisms/
   ContentIndex/              deriveFacets + filterByFacets, multi-select
-  MoodFinder/
+  MeditationLibrary/
+    MeditationLibrary.tsx    two question rows, the chip row, the grid
+    useTimeOfDaySlot.ts      the browser's zone, after mount
 components/molecules/
+  FilterPills/               extracted from ContentIndex; + per-pill icon
   ContentCard                + headingLevel ('h2' | 'h3', default 'h3')
   ContentGrid                + headingLevel, applied to every card

The time of day comes from the browser, not the Worker. Intl.DateTimeFormat().resolvedOptions().timeZone after mount, so cf.timezone and the server-side slot are gone. Before mount — and for a visitor without JavaScript, and for a crawler — every (choice, slot) tile link renders, which is what the server sends; the browser then keeps only the current slot's. An unusable zone keeps them all rather than guessing one.

Single- vs multi-select stays the caller's, not a mode inside FilterPills. The row reports each pill's own state through aria-pressed either way; what differs is whether onToggle adds to the selection or replaces it. That is what lets ContentIndex stay multi-select with one row between them.

Contract — nothing new is published

 /meditations/:id        meditation page
 /sitemap.xml            unchanged

No code route, no RESERVED_SEGMENTS entry, no sitemap row, no all-locales hreflang helper. /meditations with no CMS page answers whatever any missing slug answers.

The head's ItemList follows the new shape. A meditations block contributed its cards to the page's JSON-LD ItemList before this PR; the new shape would have dropped that claim silently. libraryEntries in lib/seo/content-seo.ts restores it through the same meditationLabel helper the organism uses, so the name a crawler reads and the name a visitor reads cannot drift.

Contract impact

Neither copied contract is hand-edited. types/payload/payload-types.ts and lib/i18n/translations.en.json are what pnpm types:cms and pnpm sync:translations write.

The six meditation.general keys sydevs/SahajCloud#1223 declares but has not merged reach the app from two overlays, each deletable in one step and each carrying a shortcut: naming that producer:

Overlay Carries
declare module in lib/i18n/web-translations.ts the types, so the keys reach WebTranslations and TranslationKey
lib/i18n/translations.pending.ts, overlaid in lib/i18n/i18n.ts the English, so they reach useT()'s fallback, the guard test and Ladle

Both now carry length_question and length_meditation_label, which the rewritten producer adds. The producer declares no block type, so nothing overlays one. meditation.a11y.finder_region needs no overlay: #328 already ships it in all eighteen locale files.

Delete both once the producer merges and the two scripts carry the keys. A key already in the snapshot wins over the overlay, so it goes stale rather than shadowing a word an editor has since typed upstream.

Test results

  • Lean gate: ✓ lint, tsc --noEmit, and the full suite — 173 files, 1793 tests.
  • Targeted: ✓ server/content-index.test.ts, lib/content/blocks.test.ts, lib/time-of-day.test.ts (77 together), components/organisms/MeditationLibrary (16), components/organisms/ContentIndex (15), components/organisms/RichText (70), tests/a11y/page-types.test.tsx (16), tests/guards/.
  • Build: ✓ pnpm build. grep -rl "MediaPlayer\|useMediaStore" dist/server finds nothing, and dist/server/entries/ no longer carries a meditations-index route.
  • Security review (the push touches server/): ✓ no findings. The id interpolation into where[id][in]= was traced to depth: 0 relationship ids and sahajCloudFetch's site-relative-path refusal; the HEX_COLOR gate was bypass-tested; no new <a>, dangerouslySetInnerHTML or window.location.
  • grep -rn "cf.timezone\|MEDITATIONS_INDEX_PATH\|MoodFinder\|featuredMoodCards" . → nothing.

Manual verification

  1. On the preview, with page 10 still at slug meditate-now and its meditations block's limit at 17 or more: curl -s <preview>/meditate-now | grep -c 'href="/meditations/' is at least the number of distinct meditations in the block.
  2. curl -s <preview>/de/meditate-now, once that locale is published, lists the same count — the check this goal exists to pass, and the one the locale=all read fixes.
  3. curl -s <preview>/meditations answers whatever a missing slug answers, until the owner renames page 10.
  4. The time of day cannot be verified from one terminal. The zone is the browser's, so the check is two people in different zones with the page open at the same moment, or a VPN. The unit test pins four IANA zones instead.
  5. Ladle → Meditation Library: morning, evening, without-JavaScript and unavailable are four sections on one story, each with the slot pinned.
  6. The keyboard and screen-reader walk-through for the tiles and the chip row (docs/accessibility-walkthrough.md) — the axe gate covers everything except a drawn hit area and a focus outline.

Notes for reviewer

The sibling, and the merge order. sydevs/SahajCloud#1223 is the producer. It merges first — tsc and tests/guards/translation-keys.test.ts here depend on the six keys it declares, which the two overlays stand in for until it has.

⚠ One assumption I could not confirm against live data, and it is the one worth your eye. This repo's AGENTS.md says to settle a question like this against the real API rather than from source. This session has no SAHAJCLOUD_API_KEY, so I could not: whether a duration user choice carries timings. The code does not depend on the answer — slots are read off the slot fields, and timings only drives the claimed-but-empty warning — which is precisely why it is built this way. But if durations do carry timings, the gap warning covers them too, and if they do not, it covers moods only. Nothing renders differently either way. Worth one GET /api/user-choices?where[type][equals]=duration&select[timings]=true from someone holding a key.

Two things the rework deliberately did not keep.

The block now follows its own computed apiEndpoint. The previous design spelled the featured-mood query itself, because /meditations had no block and following the endpoint would have left two spellings. With the code route gone there is only one surface, so the endpoint is followed and FEATURED_MOODS_ENDPOINT is deleted — the opposite call from last time, for the reason that changed.

fetchContentIndexDocs returns { docs, totalDocs } again. A previous round removed that shape when it removed a moods exception. It is back because limit capping the choices must be reportable — "showing fewer than the data holds" needs the pre-cap total — and now it serves every type uniformly rather than one exception.

Two corrections to claims this PR used to make.

  • The comment on the retry said withRetry reports every retried attempt, so a failed 5xx read cost three Sentry events. refactor: reorganise folders by topic, import through @/, and keep server/ server-only #327 made a retried attempt a breadcrumb; the cost is the wrapper's one captureException plus this caller's degrade. That also settles the open question thread on that line, which asked whether to bound it — there is nothing left to bound.
  • docs/rules/testing.md prescribed vi.resetModules() for the warnOnce memo and pointed at server/moods.test.ts, now deleted. forgetReportedWarnings() is the established pattern on main (four test files use it) and leaves every spy in place. It also gained the Intl.DateTimeFormat fake-timers trap, which cost real time here: the default toFake set replaces Intl, so a spy on its prototype is silently bypassed, every zone reads as UTC, and the suite goes green while testing nothing.

What min-h-24 on a tile row does and does not hold. It keeps the row from collapsing when a slot offers fewer tiles than the last, so the list below does not jump between slots. It cannot absorb the hydration swap itself: the server renders all three slots, and no reserved height could hold three rows' worth. That one shift happens once, at mount, like any progressive enhancement.

aria-pressed, not aria-current, on a single-select chip. aria-current="page" is what Button's isActive emits and it is wrong here — these are filters, not pages. aria-pressed reports each chip's own state correctly in both modes, which is why the molecule has no mode at all.

Closes #291

🤖 Generated with Claude Code

https://claude.ai/code/session_01Mg9rjVjPd5UW9q1WXiPxqm

…branch

⚠ Both files say they are generated and never hand-edited. This commit edits them anyway, and
the whole of its reason is timing: `pnpm types:cms` and `pnpm sync:translations` read SahajCloud
`main`, never a branch, and the producer (sydevs/SahajCloud#1223) has not merged. Without these
entries nothing in the rest of this branch type-checks.

Only the entries the producer adds are written. A wholesale copy of its generated file would
also delete `blocks.general.wisdom_sidetext`, whose own producer (sydevs/SahajCloud#1218) is
still open.

Both scripts run again once the producer merges, and their output replaces this. The snapshot's
re-sort also restores three lines #284 left under-indented.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjXcVCREPdbftdwnZtp
A visitor says how they feel and lands, in one click, on the meditation the app's categories
name for that mood and that time of day. `/meditations` lists the same fourteen, one click from
the finder.

**The time of day is the visitor's own**, read from `cf.timezone` inside `data()`. An absent or
unusable zone resolves to evening rather than to the Worker's UTC, with one Sentry warning per
isolate per gap. Night folds into evening: the categories define the slot and leave it empty on
all 24 moods.

**The meditations are read at `locale=en`, whatever the page's locale.**
`GET /api/meditations?locale=fr` answers `totalDocs: 0`, so a populated read at the page's locale
hands back a bare id in every slot and the region renders empty on a 200 page in all nine
non-English locales. The moods themselves keep the page's locale, where `title` is localized and
an untranslated mood falls back to English.

**The label is composed, not read.** `Meditations.title` is a virtual English fallback with eight
distinct values across these fourteen rows — two of them identical — so the site renders one
parameterised key over the mood and the length instead.

**The block's limit caps the moods after the slot filter.** The fourteen are interleaved by
`order` upstream, so slicing before the filter starves a time of day.

The finder is its own organism rather than a fork inside `ContentIndex`, whose whole surface is
deriving facets and filtering by them — meaningless at one card per mood. It reuses `Button`,
`Link` and `ContentGrid`'s siblings, not the facets.

`ContentCard` and `ContentGrid` gain a `headingLevel`, mirroring `Column`'s: a grid that is a
page's whole content sits under its `<h1>`, and the default `h3` would skip a level.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjXcVCREPdbftdwnZtp
The block dispatch, the slot filter the resolver applies, and the unavailable message the moods
branch renders where every other type renders nothing.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjXcVCREPdbftdwnZtp
A mood pairs with the slots its `timings` name, never with whichever slot fields happen to be
filled. The old pairing listed one meditation twice for a mood holding the same id in two slots,
and made the commonest data gap — a slot named but not filled — unreportable, because it built
no pair to report.

The second read degrades where it is made. `featuredMoodCards` had its own catch and the block
path did not, so a failed meditations read threw out of `data()` and took the whole page with it.

An unknown block type degrades too. `QUERY_BY_TYPE[type]` was destructured above the `try`, so a
type SahajCloud offers before the site ships support for it would 500 the page rather than render
one empty region.

The retry comment said one failed read is one Sentry event. `withRetry` reports each retried
attempt itself, for every caller, so it is three.

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

`server/AGENTS.md` named `fetchContentIndexDocs` as the one read missing `withRetry`, and counted
six reads. It has one now, and the mood finder brings the count to eight.

It also records what the wrapper costs: it reports each retried attempt itself, so a caller that
reports its own degrade spends three Sentry events on one failed read. Capturing inside the
wrapper is worse, so the rule stands and the number is written down.

The root guide records the one `hreflang` derivation that is not a document's publish state, and
`pages/AGENTS.md` that each `[slug]` exclusion derives from its route's own constant.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjXcVCREPdbftdwnZtp
Three independent review lenses landed on the same finding: the block path and `/meditations`
were the same read spelled twice. `QUERY_BY_TYPE.moods`'s select was byte-identical to
`MOOD_SELECT`, and only one of the two copies tracked the producer.

The block branch now delegates to `featuredMoodCards`. That deletes the duplicate select, the
`moods` entry in the shared query table, the `type === 'moods'` exception inside
`fetchContentIndexDocs`, the `{ docs, totalDocs }` return shape it forced on every other type,
and the `MoodDoc` cast. The block stops following its computed `apiEndpoint` — deliberately:
`/meditations` never could, so following it bought one surface a contract the other had to
restate. The editor's `limit` still reaches the finder as what to show, which is all it can mean
once the read is capped at the API's own ceiling.

`server/moods.ts` now reuses what it had copied: `meditationDurationMinutes`, `asText`,
`tryGetContext`, and one bounded Sentry warning shared with `getWebConfig`, which had the same
mechanism inline. Every warning the module sends is bounded now, the two read failures included —
both are on the same uncached hot path as the data gaps.

`moodsForSlot` and `moodSlotPairs` were each half correct and coupled by a comment saying so;
`moodSlots` answers the one question both asked. `routeLocales` was `[...offered]` and is gone.
Every `/meditations` href reads `MEDITATIONS_INDEX_PATH`, the branch's own constant, and the two
surfaces compose the tile's name through one helper rather than the same four lines twice.

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

@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.

1 question for the reviewer, one per thread.

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


Generated by Claude Code

Comment thread server/content-index.ts Resolved
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 19, 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 a141839 Commit Preview URL

Branch Preview URL
Nov 25 2026, 08:35 PM

@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 19, 2026
@sydevs-bot

sydevs-bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 no session running
CI fix 2

recent dispatches
  • 20:27Z resolve-conflicts · attempt 1 · session · done
  • 20:27Z resolve-conflicts · attempt 1 · session
  • 00:00Z address-review · attempt 1 · session · done
  • 00:00Z address-review · attempt 1 · session
  • 18:47Z resolve-conflicts · attempt 1 · session · done

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

@sydevs-bot sydevs-bot moved this from Pending to Working in SYDevelopers Technical Roadmap Nov 19, 2026

@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 is the size of its ticket: four parts, each built, nothing smuggled. Both deviations the body argues for are right — owning the featured-mood query in server/moods.ts leaves one spelling where following apiEndpoint would leave two, and lifting warn-once.ts out of getWebConfig turns a shape the ticket said to copy into one both callers share. A third is not argued: the ticket asked for the availableLocales cluster as a named export in lib/hreflang.ts, and both consumers spell it inline. I agree with the skip, but record it.

Findings

  • should-fix — server/moods.ts:66: the meditation read selects no _status, so "absent or unpublished is dropped" is unbuilt and unrecorded.
  • should-fix — LayoutBlock.tsx:17: a JSDoc stranded by the type that moved out now documents the wrong declaration.
  • consider — pages/meditations/(index)/+Page.tsx:5: the page deep-imports two helpers past both barrels from an organism it never renders.
  • consider — server/moods.test.ts:75: warning assertions depend on being the first use of a signature nothing resets.

What was checked

#291's criteria one by one. Read whole on the branch: moods.ts, time-of-day.ts, warn-once.ts, content-index.ts, document-routes.ts, sitemap-routes.ts, head.tsx, MoodFinder.tsx, the (index) route files.

Ladder: HOUR_FORMATS matches PLURAL_RULES at lib/i18n.ts:42; warn-once.ts absorbs an existing memo; tryGetContext and LOCALE_PREFIX are reused. None.

Producer side: sydevs/SahajCloud#1225's endpoint and keys match FEATURED_MOODS_ENDPOINT and the copied types.

Production, read-only key: the mood query at locale=fr → totalDocs: 14, one timing each (4/4/6), every row carrying color and url, titles in English fallback. select[_status] over meditations → 121, all published.

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


Generated by Claude Code

Comment thread server/moods.ts Resolved
Comment thread pages/meditations/(index)/+Page.tsx Resolved
Comment thread server/moods.test.ts Resolved
@sydevs-bot sydevs-bot added bot:working Lock: a cloud session is running on this item. Removed when it ends. and removed bot:working Lock: a cloud session is running on this item. Removed when it ends. labels Nov 19, 2026
`createWarnOnce` keeps its reported signatures in module state, so every
warning assertion in this file passed only because it was the first use of
its signature. A later test asserting `meditation:2:morning` saw no warning
at all.

`vi.resetModules()` per test rebuilds the mock registry too, so both the
module under test and the Sentry spy are re-imported from the fresh graph.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjWdiqnqmrmvkjKymkf
The meditation read selected no `_status`, and nothing below checked one, so
an unpublished meditation rendered as a live tile. A draft does come back
from a `find` on this client contract. #291 names `select[_status]` in its
query spec and its criterion reads "absent or unpublished is dropped".

A draft now takes the same warn-and-drop path as a missing meditation, and
the warning carries the status that caused it.

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

cloudflare-workers-and-pages Bot commented Nov 19, 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-design a141839 Commit Preview URL

Branch Preview URL
Nov 25 2026, 08:35 PM

`ItemHeadingLevel` moved to `ContentCard.tsx`, which carries its own
replacement. What stayed behind read as `LayoutBlockProps`'s doc while
describing a declaration no longer in the file.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjWdiqnqmrmvkjKymkf
`/meditations` reached past both barrels into `MoodFinder.tsx` for two
helpers, for a page that never renders the organism. Both surfaces now take
them from `MoodFinder/moodCard.ts`, through the folder barrel every other
consumer under `pages/` and `layouts/` imports.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjWdiqnqmrmvkjKymkf
`createWarnOnce` has two callers and no test file of its own, so the trap
`server/moods.test.ts` hit is waiting for the next one. Records the symptom
— a missing warning rather than a failing order — and that resetting the
registry also replaces the mock the spy was taken from.

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

Copy link
Copy Markdown
Contributor Author

Four critic threads adopted, pushed as a245255. The question thread on the retry stays open.

That last one was live: the draft test asserted a signature an earlier test had spent, so it saw no warning. docs/rules/testing.md now carries it for the other createWarnOnce caller.

Gate: lint, tsc, 133 files / 1277 tests, build. Branch security review: nothing at HIGH or MEDIUM. Preview carries four deep links now the Cloudflare alias exists.

🤖 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 Nov 19, 2026
@sydevs-bot
sydevs-bot marked this pull request as ready for review November 19, 2026 19:04
@sydevs-bot
sydevs-bot requested a review from Ardnived November 19, 2026 19:04
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

Ready to review with sydevs/SahajCloud#1223. It merges after sydevs/SahajCloud#1223 does: auto-merge is armed once that closes, after its contract re-sync lands here.

🤖 sydevs dispatcher

@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 23, 2026
@sydevs-bot sydevs-bot moved this from Awaiting to Working in SYDevelopers Technical Roadmap Nov 23, 2026
web-flow and others added 2 commits November 23, 2026 00:01
ContentIndex's inline pill row said to extract a molecule once a second
consumer appeared. MeditationLibrary is that consumer, and it brings the
per-pill icon with it.

Single- or multi-select stays the caller's: the row reports each pill's own
state through aria-pressed either way, and what differs is whether onToggle
adds to the selection or replaces it.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjVjPd5UW9q1WXiPxqm
web-flow and others added 3 commits November 23, 2026 00:18
Reworks the branch to #291 as rewritten after the design review of #272.

Out: the `pages/meditations/(index)/` code route and its test,
MEDITATIONS_INDEX_PATH and its matcher, the RESERVED_SEGMENTS entry, the
sitemap row and the all-locales hreflang helper, MoodFinder, server/moods.ts
with visitorTimeOfDay and its cf.timezone read, the `moods` block type, and
the meditations-index a11y fixture. /meditations is a CMS page served by
[slug].

In: MeditationLibrary, the counterpart of MusicLibrary. The `meditations`
block now resolves to { choices, meditations } through two reads — the chosen
user-choices on the block's own endpoint at the page's locale and depth 0,
then the meditations by id at locale=all. locale=fr answers totalDocs: 0 and
locale=en would drop a localized slot meditation, so `all` is the only
spelling that serves both.

Every (choice, slot) tile link and every card is in the server's HTML; the
browser narrows the tile rows to the visitor's own slot after mount, so the
page works without JavaScript and a crawler sees every link.

A slot is read off its own field rather than off `timings`: `timings` is the
choice's claim, and a slot claimed with nothing in it is reported instead of
rendered as a tile linking nowhere. Durations are not known to carry
`timings` at all, so pairing on it would have dropped every duration tile.

The head's ItemList follows the new shape through the same label helper the
organism uses, rather than silently losing the claim a meditations block made.

Kept: withRetry on fetchContentIndexDocs, the QUERY_BY_TYPE lookup inside the
try, both documentHref fixes, headingLevel, timeOfDaySlot (fed a browser zone
now) and warnOnce.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjVjPd5UW9q1WXiPxqm
…s a second use

Two claims this branch makes false.

`server/sahajcloud/AGENTS.md` named `fetchContentIndexDocs` as the one read
still missing `withRetry` (#128). It has one.

The `locale=all` section said there was exactly one locale-agnostic fact worth
reading that way. Reaching a `meditations` row by id is a second, and a
different kind: the collection's own locale filter answers zero docs at any
single non-English locale, so `all` is what answers at all rather than what
answers in every language.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjVjPd5UW9q1WXiPxqm
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 sydevs-bot changed the title feat(components): a mood finder and the /meditations list route feat(components): a MeditationLibrary for the meditations index block Nov 23, 2026
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

Reworked to the rewritten #291 in d87371b, a3c43db, b14aa4a, 3c321bd. Gate green: 173 files, 1793 tests, plus pnpm build and a clean security review. Title and body refreshed: the old body described the deleted design.

Removed, all verified gone by grep: the code route and test, MEDITATIONS_INDEX_PATH and its matcher, the RESERVED_SEGMENTS entry, the sitemap row, the all-locales hreflang helper, MoodFinder, server/moods.ts with cf.timezone, the moods block type, the index a11y fixture.

Built: MeditationLibrary; the two reads, meditations at locale=all; FilterPills extracted and shared with ContentIndex; the overlays trimmed to the producer's six keys.

Your retry thread is resolved — #327 made a retried attempt a breadcrumb, so the three-events premise is gone and A stands.

⚠ One thing I could not confirm: no SAHAJCLOUD_API_KEY in this session, so whether a duration choice carries timings is unverified. Nothing renders differently either way. That and the kept ItemList are the two calls flagged in the body.

🤖 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 Nov 23, 2026
@sydevs-dispatcher sydevs-dispatcher Bot moved this from Working to Awaiting in SYDevelopers Technical Roadmap Nov 23, 2026
@Ardnived

Copy link
Copy Markdown
Contributor

Scope change (owner, 2026-11-23). This PR is cut back to #291 as rewritten today: the meditations content-index type's language fix (choices at the page locale and depth=0, meditations by id at locale=all, drafts dropped) and the read fold-ins (withRetry, QUERY_BY_TYPE inside the try, the documentHref fixes). MeditationLibrary, the FilterPills extraction, headingLevel, the pending-English overlay and the time-of-day code all come out, and the grid goes back to main's ContentIndex. #291 has the full remove/keep table.

The mood picker moves to #334, on a new user-choices block type (sydevs/SahajCloud#1257). It ports readMeditations, lib/time-of-day.ts and useTimeOfDaySlot from this branch at 3c321bd. sydevs/SahajCloud#1225 is closed, so no wording key lands anywhere.

sydevs-bot pushed a commit that referenced this pull request Nov 25, 2026
`ContentIndexBlockFields` restated every stored field of the generated
`ContentIndexBlock`, so each field `pnpm types:cms` adds needs a hand
edit here before any reader sees it — the second commit on this PR was
exactly that edit. Deriving it with `Omit` makes the two new
`user-choices` filter fields and the union member arrive for free.

The `shortcut:` marker named #293 as the blocker. It is not one: the
generated interface is exported today, so the derivation compiles now.

`blocks.test.ts`'s type equality assertion goes with it. It proved the
mirror matched; the mirror is gone.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjWwKkRTjDFL8ppKTVM
@sydevs-dispatcher sydevs-dispatcher Bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 25, 2026
@sydevs-dispatcher sydevs-dispatcher Bot moved this from Awaiting to Working in SYDevelopers Technical Roadmap Nov 25, 2026
Two conflicts, both where #342's contract re-sync landed on this branch's
own edits to the same declarations.

lib/content/blocks.ts — `ContentIndexBlockFields` takes main's derived
form, `Omit<ContentIndexBlock, 'id' | 'blockName' | 'blockType'>`. The
hand-written mirror this branch still carried was a `shortcut:` waiting
on the generated block type, and main has since cashed it in. The three
meditation types and `resolvedLibrary` stay as this branch has them.

server/content-index.ts — `QUERY_BY_TYPE` keeps main's exhaustive keying,
`Exclude<…, 'user-choices'>`, so a type the next re-sync adds fails the
build rather than resolving to nothing. It also keeps this branch's
runtime degrade: a block's fields are cast out of a lexical tree, so
`type` is whatever SahajCloud sent, and a deploy one behind the schema
must render an empty region rather than 500 the page. The widened
annotation on the lookup is what lets both hold at once.

main's `user-choices` early return now answers `{ docs: [] }`, the shape
this branch gave `fetchContentIndexDocs`. `return []` merged clean and
would not have compiled.

Lean gate: lint, tsc --noEmit, 176 files / 1836 tests, all green.

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

Copy link
Copy Markdown
Contributor Author

Merged main in. Two conflicts, both where #342's contract re-sync met this branch's edits to the same declarations.

lib/content/blocks.ts — took main. ContentIndexBlockFields was a hand-written mirror here, carrying a shortcut: that waited on the generated block type. main has since cashed it in, so the derived Omit<ContentIndexBlock, …> form wins. The meditation types and resolvedLibrary are unchanged.

server/content-index.ts — took both. QUERY_BY_TYPE keeps main's exhaustive Exclude<…, 'user-choices'> keying, so the next re-sync's new type fails the build. It also keeps this branch's runtime degrade, because a block's fields are cast out of a lexical tree: type is whatever SahajCloud sent, and a deploy one schema behind must render an empty region, not 500 the page. The widened annotation on the lookup is what holds both.

main's user-choices return became { docs: [] }: return [] merged clean and would not have compiled.

🤖 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 Nov 25, 2026
@sydevs-dispatcher sydevs-dispatcher Bot moved this from Working to Awaiting in SYDevelopers Technical Roadmap Nov 25, 2026
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.

fix(server): the meditations index renders in every language

4 participants