Skip to content

feat(components): a MoodPicker for the user-choices index block - #337

Open
sydevs-bot wants to merge 21 commits into
mainfrom
claude/feat-334-mood-picker
Open

sydevs-bot wants to merge 21 commits into
mainfrom
claude/feat-334-mood-picker

Conversation

@sydevs-bot

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

Copy link
Copy Markdown
Contributor

Summary

  • A user-choices block renders the app's mood screen on the web: one round tile per featured mood with a published meditation for the visitor's time of day, each linking straight to it. The page adds no wording of its own.
  • Joined, because the icon is the first value this repo puts inside a CSS url(): cssUrl in lib/urls/urls.ts gates it, beside the three isSafe* gates.
  • Joined: that gate let a " through in the authority, which new URL does not encode. It now refuses one.

Change outline

Flow — a user-choices block, from the editor's page to the tiles

 resolveContentIndexBlocks(content, { locale })        server/content-index.ts
   per content-index block, by type
     songs         → resolveContentIndexTracks
     pages/…       → resolveContentIndexItems
+    user-choices
+      fetchContentIndexDocs                           # the block's own endpoint
+        + select title/type/isFeatured/url/filename/color + SLOT_FIELDS, depth=0
+        + the page's locale — the titles are localized
+      moodsFromChoices(docs)                          server/user-choices.ts
+        keep type === 'mood' && isFeatured            # else warn once, drop
+        refs: the three slot relationships, by id
+          none at all                                 → warn once, drop
+        iconUrl: cssUrl(doc.url)                      # refused → warn once, keep the tile
+        color:   hex only                             # else null → the site teal
+        getPublishedMeditationIds(ids)                server/sahajcloud/meditations.ts
+          locale: 'all', select MEDITATION_STATUS_SELECT, one read for every slot
+          failure → null                              → drop the picker, reported once
+        per slot: published? → documentHref('meditations', { id })
+                  else       → warn once, drop that slot
+        no slot left                                  → drop the mood
+    resolvedSlot = visitorTimeOfDay()                  # cf.timezone, this read only

Components — the tile, and who decides the slot

 content-index[user-choices]                           components/organisms/RichText/blockConverters.tsx
+  → MoodPicker                                        components/organisms/MoodPicker/
+      useTimeOfDaySlot()                              # null on the render that hydrates
+      slot = browserSlot ?? serverSlot                # null → every mood, at its earliest slot
+      moodsForSlot(moods, slot)                       # pure, exported, tested on its own
+      ul.grid.grid-cols-2.sm:grid-cols-3
+        li  → Link → documentHref                     # the Link atom gates and locale-prefixes
+              span.size-20 > span.size-16.rounded-full.bg-tint
+                span.size-8  mask-image: url("iconUrl"), background: var(--mood-color)
+                group-hover / group-focus-visible: circle fills, icon turns white
+              span.text-fg                            # the choice's own title, no new key

The slot is resolved twice on purpose. The server reads the visitor's zone from Cloudflare, so nearly every visitor gets the right moods in the first paint and nothing moves; the browser re-reads its own zone after mount and swaps only where the two disagree. useTimeOfDaySlot answers null on the render that hydrates, which is what keeps the two from rendering different markup.

Types

 ContentIndexBlockFields                               lib/content/blocks.ts
-  type: 'meditations' | 'pages' | 'songs' | 'lectures' # + the seven other stored
-  limit, pageFilters, userChoiceFilters, songFilters, apiEndpoint   # fields, restated
+  extends Omit<ContentIndexBlock, 'id' | 'blockName' | 'blockType'>  # every stored field
+  resolvedMoods?: ResolvedMood[]                      # attached in +data
+  resolvedSlot?: TimeOfDay
+ ResolvedMood { id, title, color, iconUrl, slots }    # every slot here is published
 lib/time-of-day.ts                                    # new: the app's own boundaries
+  slotForHour  morning 3–11, afternoon 12–16, evening 17–2
+  timeOfDaySlot(zone, now) → TimeOfDay | null         # null is not a guess
 lib/urls/urls.ts
+  cssUrl(url) → string | null                         # scheme gate, re-serialise,
+                                                      # then refuse a surviving `"`

Preview

Both aliases are read off the Cloudflare bot's comments, never derived from the branch name. Two previews build for this diff (it touches components/ and lib/):

  • The mood picker's story — Ladle playground. This is the reviewable surface. Six sections: morning, afternoon and evening; no server slot; a colour that is not hex; and a slot nothing fits. Hover or tab a tile to see the circle fill and the icon turn white.
  • The web Worker — nothing of the picker to open yet, and that is expected. It is a content block, and page 10 still holds its two meditations-list blocks; replacing them is the owner step in Visitors find a meditation that fits how they feel #272's Notes. The web preview shows the picker only once that edit is made.

Test results

  • Lean gate: ✓ lint, Prettier, tsc --noEmit, full Vitest suite — 1853 tests in 176 files
  • Targeted specs: ✓ components/organisms/MoodPicker (20, including a jsdom file for the after-mount swap), server/content-index.test.ts (27), lib/time-of-day.test.ts (19), lib/urls/urls.test.ts (66), components/organisms/RichText, tests/a11y/page-types.test.tsx (17), tests/guards/
  • Build: ✓ pnpm build

Manual verification

  1. The icons draw through a CORS rule, now live. The SVGs are drawn as CSS masks, so assets.sydevelopers.com has to answer a cross-origin request for them; feat(components): a MoodPicker for the user-choices index block #334's Interfaces records that rule going live for production, every preview and localhost on 2026-11-24. Confirm a circle draws filled on the web preview. The Ladle story uses inline data URLs, so it shows the real colour and hover behaviour regardless.
  2. The two things the axe gate cannot decide. jsdom computes no CSS, so target-size and color-contrast are off by name in that gate. Each tile draws at about 168×100px, well over 44×44, and carries focus-ring — but measuring a hit area and seeing an outline needs a drawn page, which is docs/accessibility-walkthrough.md's job.
  3. Time of day, in a browser. With DevTools' time-zone override set to Australia/Sydney at 09:00 local, the morning moods show; set to Europe/London at the same instant, the evening ones. Both are asserted in lib/time-of-day.test.ts and server/content-index.test.ts, but the override is what proves the browser half end to end.

Notes for reviewer

This is the consumer half of a two-PR set for #272, and the producer, sydevs/SahajCloud#1259, merged at 19:15Z on 2026-11-25. types/payload/payload-types.ts is no longer a hand-copy: it is pnpm types:cms's own byte-for-byte output from SahajCloud main, re-run and verified on this head. So it also carries three additions this ticket did not ask for — Page.parent, Page.path and WmWebConfig.indexPages, each with its *Select entry — which the copy had been holding back and which no consumer here reads yet. Reverting them would make the committed copy differ from the command's output, which is what the contract check compares.

It shares server/content-index.ts with #291 (PR #293, cut back to the meditations type's language fix). Whichever merges second rebases onto the other. This PR does not add withRetry to fetchContentIndexDocs — that is #291's line, and it is still the one read missing it (#128).

display: contents came off the list item. It had made the Link the grid item, but it has a history of dropping an li out of the accessibility tree, and neither jsdom nor axe can see that — neither computes CSS. The li is the grid item now.

Reviewed in three passes, and what each changed. /code-review was not run as such; the branch went through the built-in /security-review plus two agents, one on reuse and simplification, one on correctness and silent failures. No pr-review-toolkit here (ListPlugins has none).

  • The security pass found the icon URL. React escapes a style value for HTML only, and the HTML parser hands a &quot; back to the CSS parser as a quote — so a " in an upload's url closes url("…") and opens a declaration after it, in our origin. It can get there: SahajCloud slugifies an upload's base name and re-attaches the extension verbatim, and Payload's own getFileTypeIdentity does too. Needs an admin manager, and runs no script, so a gate rather than an incident. cssUrl refuses a non-http(s) scheme, re-serialises through new URL, and refuses any quote still standing after that.
  • The correctness pass found a silent failure. A featured mood with timings unfilled names no meditation at any hour; it was dropped with no event at all — the one editor mistake that empties the whole picker was the one case that reported nothing. Now warned, with a test that fails without it.
  • It also found one I had introduced. cssUrl refuses a relative URL, and CLOUDFLARE_R2_DELIVERY_URL is unset outside production, so every upload url is relative there — every circle would have drawn empty with nothing to say why. Now warned, with its own test.
  • The reuse pass moved the meditation read. It was a hand-built query string in server/user-choices.ts; it is now a typed SDK read in server/sahajcloud/meditations.ts, where AGENTS.md says reads belong, with a MeditationsSelect-checked select — a renamed field was coming back absent, which reads as "no meditation for this slot" and drops a tile silently. The hand-rolled try/catch also let withRetry's default fire a captureException at error level beside the warning: two events for one outage, at a level that class of gap must not use. It goes through degrade now.

Dismissed, with reasons.

  • Collapsing the tile's 80px box into the 64px circle. The 80-around-64 geometry is the app's own ChoiceTile, which the ticket pins; the reviewer who found it said the claim needed a drawn page, and a comment was the cheaper outcome. It has one.
  • Dropping the Europe/London case from visitorTimeOfDay's spec as duplicating lib/time-of-day.test.ts. It does, but feat(components): a MoodPicker for the user-choices index block #334's verification checklist asks for Sydney and London at one instant in that file by name.
  • Gating SplashLoader's unquoted url() with the same helper. Tried, and reverted: its background may be a site-relative path, which an absolute-URL gate must refuse, and its own spec pins that. No page renders that atom — only the barrel, its spec and its story reach it — so the sink is unreachable by a visitor. The helper is there if it is ever wired up. Percent-encoding a path that may already be encoded is how %20 becomes %2520, so the gate stayed strict and says so.

Docs: server/sahajcloud/AGENTS.md records the second locale=all read and corrects which mechanism keeps a draft out of the answer (the access config, not the select). server/CACHING.md gains the fact the slot depends on and the file did not state — nothing stamps a page response, so no colo keeps a copy, which is what makes a per-visitor render safe. The root AGENTS.md names the CSS url() gate beside the isSafe* ones.

Detail

Why locale: 'all' and not the page's locale. filterMeditationsByLocale filters every find to req.locale, so ?locale=fr&where[id][in]=… answers totalDocs: 0 and the picker would render empty in nine of the ten launch languages. locale=en answers, but drops a localized slot — a French mood may name a French meditation. all is the only spelling that serves both, and meditations returns _status as a plain string there rather than a per-locale map, which pages would not.

Why the server guesses at all. Resolving on the browser alone leaves the first paint showing whatever hour the Worker's UTC clock is in, and then moving. Reading Cloudflare's zone server-side renders the right moods immediately for nearly every visitor, and the browser corrects the rest after mount. Page HTML is not edge-cached, which is what makes a per-visitor render safe; server/CACHING.md now says so, and says what would have to change first if HTML caching is ever added.

The axe gate was passing over a page with no tiles. None of its targets carried a resolved content-index block at all, so the picker was never rendered by it. The article fixture carries one now, and a second case pins the picker on the walked path — as the existing one does for the Dropdown atom — so a fixture that drifts fails rather than going quiet.

One test stub was passing for the wrong reason. The jsdom suite stubs Intl.DateTimeFormat to report a chosen zone. As an arrow function it is not constructible, so timeOfDaySlot's own new Intl.DateTimeFormat(zone, …) threw, the TypeError landed in that function's catch, and every case read as "unusable zone" — which happened to match the expectation. It is a function now, and the two zones are expected to differ, which is what catches this.

Why the quote survives in a host. " is not a forbidden domain code point, so new URL('https://h");z-index:0/**/;background-image:url(…);a:b/*') round-trips intact — the host supplies the quote, the port the :, the path the rest of a declaration. Only the configured delivery host could put one there, never an editor, so this was the gate matching its own claim rather than a reachable sink. The check reads the serialised string, which is where the remaining quote is.

Night folds into evening. The upstream choices define a night slot and leave it empty on all 14 featured moods, so hours 0–2 resolve to evening. nightMeditation is selected by nobody here.

Closes #334

A `user-choices` block now renders the app's mood screen on the web: one
round tile per featured mood that has a published meditation for the
visitor's time of day, each a link straight to that meditation. The page
adds no wording — the heading is the editor's own lexical content and each
tile shows the mood's own localized title.

The slot is resolved twice. The server reads the visitor's zone from
Cloudflare, so nearly every visitor gets the right moods in the first paint
and nothing moves; the browser re-reads its own zone after mount and swaps
only where the two disagree. `useTimeOfDaySlot` answers `null` on the render
that hydrates, which is what keeps the two from rendering different markup.
The boundaries are the app's own — morning opens at 3am, not 5 — so a mood
opens the same meditation on both surfaces.

The slot meditations are read by id at `locale=all`, never at the page's
locale: `filterMeditationsByLocale` answers `totalDocs: 0` to a `find` at
any single non-English locale, so a page in any of the nine other launch
languages would offer nothing. A slot whose meditation is a draft or gone is
dropped with a bounded warning naming the mood and the slot, and a mood left
with no slot is dropped with it, so no tile links nowhere.

The icons are SahajCloud SVGs drawn in `currentColor`, so each is a CSS mask
filled with the mood's colour rather than an `<img>`, which would render
them black. A colour that is not a hex value falls back to the site teal.

`ContentIndexBlockFields.type` now comes from the generated block instead of
restating it, and the two new stored filter fields are declared, which is
what `blocks.test.ts` asked for once the schema carried them.

Refs #334

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

The slot is proven from both ends: `visitorTimeOfDay` reads a stubbed
Cloudflare zone, where Sydney and London at one instant resolve to different
slots, and a jsdom suite drives the after-mount swap through a stubbed
browser zone — confirming the server's guess, replacing it, narrowing the
full set, and leaving it standing where `Intl` will not answer.

That stub has to be a `function`, not an arrow: `timeOfDaySlot` reads the
hour through `new Intl.DateTimeFormat(zone, …)`, and an arrow is not
constructible, so the `TypeError` landed in that function's own catch and
read as an unusable zone. Every case passed for the wrong reason until the
two zones were expected to differ.

The axe gate's article fixture now carries a resolved `user-choices` block,
because none of its targets held a content-index block at all — the gate
passed over a page with no tiles in it. A second case pins the picker on the
walked path, as the existing one does for the Dropdown atom, so a fixture
that drifts fails rather than going quiet. `target-size` and `color-contrast`
stay off by name there, so the 44×44 target and the focus ring remain the
keyboard walk-through's to measure.

Refs #334

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjXBkv8QoXfemTq8d1B
An upload's `url` comes from SahajCloud and goes straight into the mood
tile's `mask-image`. React escapes a `style` value for HTML only — `["'&<>]` —
and the HTML parser hands the quote back to the CSS parser as a quote, so
escaping is not what stops a `"` in that value from closing the CSS string
and opening a declaration after it. A full-viewport overlay and an off-origin
image fetch are both reachable that way, in our own origin.

The quote can really get there: SahajCloud slugifies an upload's base name and
re-attaches the extension verbatim, and Payload's own `getFileTypeIdentity`
takes it verbatim too, so `"`, `;`, `(` and `)` survive into `filename` and
into the virtual `url` built from it. It needs an admin manager — uploads are
admin-only — and it executes no script, which is why this is a gate rather
than an incident.

`cssUrl` is the gate, beside the three `isSafe*` ones, because a scheme and a
spelling are both how a URL is spelled. It refuses anything that is not
http(s) and re-serialises through `new URL`, whose WHATWG parser
percent-encodes `"` to `%22` and drops tabs and newlines — so the string
cannot be terminated from inside it. A refused icon drops the icon, not the
tile.

`SplashLoader` joins this: it is the same sink fed the same way, from a
Cloudflare Images URL built off a CMS id, and its `url()` was unquoted, which
is the easier of the two to break out of. One line, and the helper this change
adds is what it needed.

Refs #334

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

`server/sahajcloud/AGENTS.md` said there was one locale-agnostic fact worth
`locale=all`. There are two now: the meditation a mood names for a time of
day, where `all` is the only spelling that answers at all — a single
non-English locale comes back `totalDocs: 0`, and `locale=en` answers while
silently dropping a localized slot.

`server/CACHING.md` gains the fact the mood picker's slot depends on and the
file did not state: nothing stamps a page response, so no colo keeps a copy,
which is what makes a per-visitor render safe. Anything that adds HTML caching
has to narrow that read first, or one visitor's time of day is served to the
next.

Refs #334

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjXBkv8QoXfemTq8d1B
Gating `SplashLoader` turned out to break what it documents: its background
may be a site-relative path, which an absolute-URL gate must refuse, and its
own spec pins that. Percent-encoding a path that may already be encoded is how
`%20` becomes `%2520`, so the gate stays strict and says so, rather than
growing a looser branch for one caller.

That atom's unquoted `url()` is left as it was. No page renders it — only the
atoms barrel, its spec and its story reach it — so the sink is unreachable by
a visitor, and the helper is there if it is ever wired up.

Refs #334

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

Two review passes found the resolver re-implementing four things the repo
already had, and one of them was costing a double Sentry report.

The meditation read is now `getPublishedMeditationIds` in
`server/sahajcloud/meditations.ts`, a typed collection read through the SDK
with a `MeditationsSelect`-checked select, where AGENTS.md says every read
belongs. The hand-built query string gave that up: a renamed field came back
absent, which reads as "no meditation for this slot" and silently drops a
tile, where the typed select makes it a compile error. It degrades through
`degrade` with `withRetry(..., { reportFailure: false })` — the pairing
`docs/rules/rest-api.md` names — because the hand-rolled try/catch let
`withRetry`'s own default fire a `captureException` at error level beside the
warning, billing two events for one outage at a level this class of gap must
not use. It answers `null` rather than an empty set, so a read failure drops
the picker once instead of warning per mood.

`refId` and `asText` replace local copies of themselves, and the block's
`select` is built from `SLOT_FIELDS` rather than a second list of the same
three field names — a slot missing from the select was invisible in exactly
the way the typed select now prevents.

`resolveContentIndexMoods` joins its two siblings in `content-index.ts`, so
the orchestrator's three branches read alike and the one-key `{ moods }`
wrapper is gone, along with a candidate shape that built a `ResolvedMood`
whose own doc comment said it could not exist.

Two silent failures reported, each with a test that fails without it:

- A featured mood with `timings` unfilled names no meditation at any hour. It
  was dropped with no event at all — the one editor mistake that empties the
  whole picker was the one case that reported nothing.
- An icon URL the CSS gate refuses. A delivery host left unset makes every
  upload `url` relative, so outside production every circle drew empty with
  nothing to say why.

The tile is a grid item again rather than `display: contents`, which has a
history of dropping an `li` out of the accessibility tree — and which jsdom
and axe both call fine, since neither computes CSS.

Refs #334

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjXBkv8QoXfemTq8d1B
The `locale=all` note credited `select[_status]` with preventing the dead
link. A client read of a drafts-enabled collection is already filtered to
published documents by the access config, and this repo sends no preview
secret, so an unpublished meditation is simply absent from the answer. The
select is the second line of defence, and the note now says which is which.

Refs #334

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

sydevs-dispatcher Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

🤖 no session running
CI fix 2

recent dispatches
  • 20:27Z resolve-conflicts · attempt 1 · session · done
  • 20:27Z resolve-conflicts · attempt 1 · session
  • 19:35Z address-review · attempt 1 · session · done
  • 19:35Z address-review · attempt 1 · session
  • 19:21Z review-pr · attempt 1 · session · done

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

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

Copy link
Copy Markdown
Contributor Author

Not fixable in this pass. The red step is the contract check, which aborts the job before lint, typecheck and unit run.

types/payload/payload-types.ts here carries the user-choices delta. SahajCloud main does not produce it yet, so the gate refuses the copy. All three routes out are dead:

  • Keep the delta — the contract check fails, as it just did.
  • Run pnpm types:cms and commit — it writes exactly main's copy, and tsc --noEmit then gives 6 errors in blockConverters.tsx:378, content-index.ts:81,293 and blocks.ts:89,90.
  • Sync, then widen ContentIndexBlockFields locally — lib/content/blocks.test.ts:161 pins it to the generated type with toEqualTypeOf, so the drift guard fails instead. Weakening that guard is not on the table.

Nothing else is red. The lean gate passes on this branch as it stands: lint, tsc, 1809 tests in 173 files. So the PR goes green once sydevs/SahajCloud#1259 merges and the copy is re-synced — the merge order your body already states.

Pushed nothing.

🤖 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 24, 2026
@sydevs-dispatcher sydevs-dispatcher Bot moved this from Working to Awaiting in SYDevelopers Technical Roadmap Nov 24, 2026
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 24, 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 05fa79b Commit Preview URL

Branch Preview URL
Nov 25 2026, 08:33 PM

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 24, 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 05fa79b Commit Preview URL

Branch Preview URL
Nov 25 2026, 08:33 PM

@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
Both sides appended a describe block to the end of lib/urls/urls.test.ts:
cssUrl here, encodeUrl on main. Both kept, in that order.

encodeUrl and cssUrl stay separate functions on purpose. encodeUrl is
idempotent and leaves reserved characters alone, because a sitemap <loc>
carries an upstream canonical this repo must pass through; cssUrl
re-serialises through new URL so a quote cannot close url("…"). Neither
can do the other's job.

The contract-check failure on this head is unrelated to the conflict and
survives the merge: the hand-copied user-choices delta in
types/payload/payload-types.ts is still ahead of SahajCloud main, as the
PR body states. sydevs/SahajCloud#1259 merges first.

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

Copy link
Copy Markdown
Contributor Author

Merged main in. One conflict, in lib/urls/urls.test.ts: both sides appended a describe to the end of the file — cssUrl here, encodeUrl from #341. Both kept.

The two helpers stay separate on purpose. encodeUrl is idempotent and leaves reserved characters alone, because a sitemap <loc> carries an upstream canonical this repo must pass through. cssUrl re-serialises through new URL so a quote cannot close url("…"). Neither does the other's job.

Lean gate green on the merge: lint, Prettier, tsc --noEmit, 1853 tests in 176 files. The branch's diff against main is still exactly its own 24 files, so nothing drifted in.

The Lint, Typecheck & Unit failure on the previous head was not the conflict and survives the merge. It is the contract check: the hand-copied user-choices delta in types/payload/payload-types.ts is still ahead of SahajCloud main. sydevs/SahajCloud#1259 merges first, as the PR body says.

🤖 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 Pending in SYDevelopers Technical Roadmap Nov 25, 2026
@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 Pending to Working in SYDevelopers Technical Roadmap Nov 25, 2026
@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 Pending to Working in SYDevelopers Technical Roadmap Nov 25, 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

Right shape for #334 — resolver, organism, wiring, the server/browser slot split it specifies, no new dependency — and the widened ContentIndexBlock['type'] is guarded at every consumer. Two things cut against it: the generated types carry three deltas unrelated to this ticket under a body line saying nothing else drifted, and it is heavy in indirection and prose — a cache, a resolver hop, a one-caller hook in its own file, one fact in three places.

Findings, each on an inline thread.

  • blocker payload-types.ts:1080 — the delta is not the one the body describes.
  • should-fix blocks.ts:78 — extend the generated block.
  • should-fix MoodPicker.tsx:68 — the ⚠ and #334 disagree on the CORS rule.
  • should-fix useTimeOfDaySlot.ts:16 — fold the one-caller hook in.
  • should-fix time-of-day.ts:65 — drop the formatter cache.
  • should-fix content-index.ts:249 — fold the resolver hop.
  • should-fix sahajcloud/AGENTS.md:113 — prose restates its JSDoc.
  • should-fix CACHING.md:32 — cut to the ⚠ and a pointer.
  • should-fix urls.ts:97 — trim a 28-line JSDoc.
  • consider user-choices.ts:21 — type the slot map against keyof UserChoice.

What was checked. #334 and the outline, hunk by hunk — accurate. Read whole on the branch: the five server files, the three lib files, both components, both docs, the a11y fixture. Ladder beyond new-pieces.mjs: no dependency, the new QUERY_BY_TYPE entry reuses SLOT_FIELDS, no round-tile or mask helper to reuse. Streamliner: 37 pieces and a whole file, 32 kept, 7 findings, all checked. Every fields.type comparison: user-choices branches before contentIndexCard and resolvedItems. payload-types.ts diffed against origin/main — no consumer. No preview URL in the body, no fixture in .claude/workflow.json. No question threads.

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


Generated by Claude Code

Comment thread types/payload/payload-types.ts Resolved
Comment thread lib/content/blocks.ts Resolved
Comment thread lib/time-of-day.ts Resolved
Comment thread server/content-index.ts Resolved
Comment thread server/sahajcloud/AGENTS.md Resolved
Comment thread server/CACHING.md Resolved
Comment thread lib/urls/urls.ts Resolved
Comment thread server/user-choices.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 25, 2026
@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
`Record<TimeOfDay, string>` accepted any field name. An upstream rename, or a
field left out of the select, comes back `undefined`, which reads as "no
meditation for this slot" and drops the tile with no event at all —
`content-index.ts` warns about exactly that in a comment the compiler could
not enforce. `satisfies Record<TimeOfDay, keyof UserChoice>` makes it a build
failure instead.

Refs #334

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjX2t7feivHHdYPZx9s
`resolveContentIndexMoods` was a single-purpose hop with one caller and no
test of its own, unlike `resolveContentIndexItems` and
`resolveContentIndexTracks`, which the spec calls directly. Every
user-choices case already goes through `resolveContentIndexBlocks`.

Refs #334

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjX2t7feivHHdYPZx9s
The slot resolves once per render and once after mount, so the map was
machinery against a cost nobody measured — and most of its twenty lines was
the JSDoc arguing that cost. Building the formatter inside the existing `try`
keeps the same hour and sends the same `RangeError` to the same `catch`, and
drops the module-level state a stubbed `Intl.DateTimeFormat` could outlive.

Refs #334

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjX2t7feivHHdYPZx9s
`useTimeOfDaySlot` and `browserTimeZone` had one caller each, inside this
folder, yet the barrel published both. The hook now sits beside the component
that uses it, with the same `null` first render and the same eslint-disable,
and the barrel publishes only what another module can reach. Counter-precedent
for a hook in its own file: `MeditationPlayer/useCircularProgress.ts`.

Refs #334

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjX2t7feivHHdYPZx9s
`ContentIndexBlockFields` restated all eight stored fields, which is what the
`shortcut:` marker above it was waiting to discharge. Extending
`Omit<ContentIndexBlock, 'id' | 'blockName' | 'blockType'>` is type-identical
— `blocks.test.ts` asserted exactly that equality — and leaves the generated
type as the one source for a field or a `type` added upstream. The guard goes
with it: it now compares the interface against its own base.

Refs #334

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjX2t7feivHHdYPZx9s
Both ⚠ claims and the SahajCloud reason a `"` reaches an upload `url` stay —
that is the gotcha. The WHATWG percent-encoding walk-through goes, because the
`new URL` call shows it, and so does the closing paragraph on where the helper
lives, which restates AGENTS.md's rule that URL spelling lives in this module.

Refs #334

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjX2t7feivHHdYPZx9s
The `filterMeditationsByLocale` story, the `totalDocs: 0` answer, the
`locale=en` trap and the access-config note all sit in
`getPublishedMeditationIds`' own ⚠ JSDoc. Prose never restates code, so the
`locale=all` section names the read and the one fact that sends a reader to
it. `MEDITATION_STATUS_SELECT` loses the same duplicated clause.

Refs #334

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjX2t7feivHHdYPZx9s
The `cache-headers.ts` inventory is mechanism, and the rule above it already
says Cloudflare bypasses what the app does not stamp. The closing sentence on
the first paint is in `visitorTimeOfDay`'s own JSDoc. What is left is the ⚠ and
the pointer to the read that depends on it.

Refs #334

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjX2t7feivHHdYPZx9s
#334's *Interfaces* records the rule on `assets.sydevelopers.com` going live
for production, every preview and localhost on 2026-11-24. The ⚠ still said
the circles draw empty until it does, which reads as a live blocker. What
remains is the standing hazard: a host that stops answering cross-origin draws
them empty with nothing in the markup to show why.

Refs #334

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjX2t7feivHHdYPZx9s
The URL-spelling rule listed an `href` and `window.location` as the
destinations a gate stands in front of, and `isSafe*` as the gate names. This
branch adds a third destination and a gate that is neither — `cssUrl` also
re-serialises, because a scheme check cannot see a quote closing the CSS
string.

Refs #334

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjX2t7feivHHdYPZx9s
The gate claimed re-serialising through `new URL` is what stops a `"` closing
`url("…")`. That holds for the path, query and fragment, and not for the
authority: `"` is not a forbidden domain code point, so
`https://h");z-index:0/**/;background-image:url(…);a:b/*` round-trips intact —
the host supplies the quote, the port the `:`, the path the rest.

Only the configured delivery host can put a quote there, never an editor, so
this is the gate matching its own claim rather than a reachable sink. The check
reads the serialised string, because that is where the remaining quote is, and
nothing legitimate carries one by then.

Refs #334

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

Copy link
Copy Markdown
Contributor Author

Ten critic threads, nine adopted and one rebutted. Each thread carries its reply and SHA. Pushed dac2fef.

Adopted, one commit each: extend the generated block, discharging the shortcut: marker and its now-tautological guard (d9d55e8); fold the one-caller hook in (df18f2a); drop the formatter cache (65ff3e7); fold the resolver hop (51014df); type the slot map against keyof UserChoice (80872d5). The icons' CORS rule went live on 2026-11-24, so the ⚠ and Manual verification 1 say so (2b7fcf7). Three prose cuts (2a67017, 686c632, c3f27e0).

Rebutted, the payload-types.ts blocker. The file is pnpm types:cms's own output, re-run byte-identical on this head, so reverting the three hunks would fail the contract check. The false line was the body's, claiming nothing else drifted.

Found while trimming that JSDoc: new URL leaves a " in the authority, so cssUrl's claim was overstated. dac2fef refuses a surviving quote, with a test. Only the delivery host could put one there.

Lean gate green: 1853 tests in 176 files, plus the build.

🤖 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 Pending in SYDevelopers Technical Roadmap Nov 25, 2026
@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 Pending to Working in SYDevelopers Technical Roadmap Nov 25, 2026
#342 landed the same two files from the other side: it re-synced the copied
payload types and, with no resolver for the new `user-choices` index type,
added a stopgap that emptied the block.

`types/payload/payload-types.ts` takes main's copy whole. It is the newer
`pnpm types:cms` output — SahajCloud #1268 against this branch's #1259 — and
carries every field this branch reads, so re-running the command here would
only reproduce it.

`server/content-index.ts` keeps this branch's resolver and drops main's
stopgap. The two cannot both stand: the early return in
`fetchContentIndexDocs` empties the read the mood resolver is built on, and
`Exclude<…, 'user-choices'>` on `QUERY_BY_TYPE` refuses the entry that
performs it. The stopgap's own limit — an empty index until a user choice
renders — is what this branch lifts: a mood tile resolves to a meditation
href, never to a card through `contentIndexCard`, so nothing drops.

`lib/content/blocks.ts` keeps this branch's `interface … extends Omit<…>`.
Both sides derived `ContentIndexBlockFields` from the generated block in the
same commit window; only the spelling differed, and this one holds
`ResolvedMood` and the two `resolved*` fields the picker attaches.

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

Copy link
Copy Markdown
Contributor Author

Merged main, which had reached the same two files from the other side (#342).

  • types/payload/payload-types.ts — main's copy whole. It is the newer types:cms output, SahajCloud #1268 over this branch's #1259, and carries every field this branch reads.
  • server/content-index.ts — this branch's resolver, and main's stopgap dropped, its shortcut: marker with it. Both cannot stand: the early return empties the read the moods are built on. That marker's limit was an empty index until a user choice renders, which is what this branch lifts.
  • lib/content/blocks.ts — this branch's interface … extends Omit<…>. Both sides derived the same type from the generated block; only the spelling differed.

Lean gate green on the merge: lint, Prettier, tsc, 1853 tests.

🤖 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 Pending in SYDevelopers Technical Roadmap Nov 25, 2026
@sydevs-dispatcher
sydevs-dispatcher Bot marked this pull request as ready for review November 25, 2026 20:33
@sydevs-dispatcher
sydevs-dispatcher Bot requested a review from Ardnived November 25, 2026 20:33
@sydevs-dispatcher sydevs-dispatcher Bot moved this from Pending 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.

feat(components): a MoodPicker for the user-choices index block

2 participants