Skip to content

fix(image): six paths skip the variant pipeline, four over-fetch - #207

Merged
sydevs-bot merged 30 commits into
mainfrom
claude/fix-146-image-variants
Nov 18, 2026
Merged

sydevs-bot merged 30 commits into
mainfrom
claude/fix-146-image-variants

Conversation

@sydevs-bot

@sydevs-bot sydevs-bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Ten render paths now ask Cloudflare for a sized variant instead of serving the /public
    original, or declare the box they actually draw instead of the atom's full-width default.
  • ImageProps.sizes is required, and one lint selector holds every <Image> to an
    aspectRatio, so the eleventh site is an error where it is written rather than a silent
    over-fetch. Not in the ticket; it is what makes the sweep stick.
  • Three of my own sizes were coarser than the default they replaced in the narrow bands. The
    review pass caught them, and the arithmetic is now in the commit and the specs.
  • The review round after that removed the last hand-maintained numbers: the carousel's row
    heights are parsed from their own Tailwind classes, and the raw <img> population nothing can
    hold to the helper is pinned rather than described.
  • fix(image): nothing stops a hand-rolled eager &lt;img&gt;, and three specs cannot fail #152's two loading attributes land here too: this PR rewrites the same two lines.
  • The poster question is answered B: the SSR fallback carries the whole video ladder, and
    the route that nothing bounds declares its own box.
  • The simplification review moved the <Image> rules off a hand-rolled tag scanner onto two AST
    lint selectors, and folded the carousel's two height functions into one.
  • The latest round answers the question that round left open B: sizes is required by the
    type, not by a selector — which forces fix(cards): index-grid cards declare 800px for a 357px box #206's fix into this PR rather than deferring it, so
    this now closes that ticket too.
  • Joined, from the security review this branch had owed: preview discovery read every PR
    comment, so anyone who can comment could steer the smoke suite at their own host. It now takes
    a URL only from the Cloudflare bot. Same file as this branch's CI fix, so it lands here.

Change outline

Behaviour — what each of the ten sites asks for now

Two distinct failures. Part A asked for no variant at all, so the box got the full original.
Part B resolved a variant but let the atom guess the box.

 Part A — no aspectRatio reached the atom, so getImageURL passed the URL through
   Avatar.tsx                     raw <img>, never imported the helper
+    getImageURL(src, AVATAR_VARIANT)            # square xsmall, 200px
   MeditationPlayer.tsx           raw <img>, the circular frame
+    getImageURL(currentMedia.src, FRAME_VARIANT)  # square medium, 800px
+    loading="eager" fetchPriority="high"          # #152's line, handed here
     video branch untouched — an HLS or MP4 source, not an image
   VideoPlayer/index.tsx          the ClientOnly SSR fallback, the only poster in the server HTML
   VideoPlayer/VideoPlayer.tsx    Vidstack's poster, client-only
+    VideoPlayer.tsx calls posterURL() — Vidstack's poster takes one URL
+    index.tsx emits the whole video ladder, governed by posterSizes
+    both in a third module, because index.tsx must not import the
+    browser-only player for a value
+    index.tsx also takes loading="eager"          # #152's line, handed here
   ContentCard.tsx                aspectRatio={imageHeight ? undefined : aspectRatio}
+    aspectRatio={aspectRatio} + forceAspectRatio={!imageHeight}
+    # the ratio was overloaded as a layout flag; forceAspectRatio already split them
   Column.tsx                     width/height but no ratio
+    aspectRatio="square" forceAspectRatio={false} sizes="160px"

 Part B — a variant, but sizes left to DEFAULT_SIZES (800px at desktop)
+  AudioPlayer.tsx       sizes="48px"                             # w-12 h-12
+  HeaderDropdown.tsx    (min-width: 1024px) 400px, calc(50vw - 32px)
+  TechniqueCard.tsx     1024px 384px / 768px 336px / 448px 448px / 100vw
+  MusicLibrary.tsx      968px 416px / 768px calc(50vw - 68px) / 448px 416px / calc(100vw - 64px)
+  ContentCard.tsx       takes a `sizes` prop, forwarded to the atom
+  ContentCarousel.tsx   derives three lengths per slide (below)

Enforcement — the type, where a selector could not see

A selector reads whether a tag carries a prop, so a component forwarding a sizes of its own
that is undefined passed it. That is #206 exactly.

 ImageProps                                            components/atoms/Image/Image.tsx
-  sizes?: string                 # from ComponentProps<'img'>
-  DEFAULT_SIZES = '(max-width: 640px) 100vw, (max-width: 1024px) 50vw, 800px'
+  sizes: string                  # tsc faults a call site that declares no box
+    # the fallback is gone: it was the 800px-into-a-48px-tile default

 eslint.config.js
-  two no-restricted-syntax selectors: aspectRatio and sizes
+  one: aspectRatio. The prop is optional by design — an <Image> whose src is
+  not Cloudflare's needs no ratio — so no type can demand it

 the chain that renders an <Image> it does not size takes one of its own
+  ContentCard     sizes: string           # was optional
+  ContentGrid     sizes: string           # item's own still wins
+  ContentIndex    sizes: string
+  blockConverters CONTENT_INDEX_CARD_SIZES, beside the Container that sets the width
+    (max-width: 639px) 100vw, (max-width: 1023px) 50vw, 360px
+  ContentCarousel item sizes optional — it derives one per slide

#206's own fix is that last line. Its decision was already settled (A — a sizes prop on
ContentGrid
, 2026-11-17), the queries are 639/1023 because react-masonry-css switches on
innerWidth <= breakpoint, and 360px is the first round number above the widest card (357px at
a 1120px content column) that shares a srcset rung with it at DPR 1, 2 and 3.

An item's override is ??, not a pre-spread default. An item built by spreading a wider
shape can carry an explicit sizes: undefined, and a spread hands that straight on. The grid and
the carousel both resolve it explicitly now, and a spec pins the undefined case.

Types — one new width, one newly exported constant

 SIZE_WIDTH_MAP                                        lib/cloudflare-images.ts
-  square: { small: 400, medium: 800, xlarge: 1200 }
+  square: { xsmall: 200, small: 400, medium: 800, xlarge: 1200 }
-export type ImageSize = 'small' | 'medium' | 'large' | 'xlarge'
+export type ImageSize = 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge'
-const ASPECT_RATIO_VALUES: Record<AspectRatio, number>
+export const ASPECT_RATIO_VALUES: Record<AspectRatio, number>
+  # already here, now exported and indexed directly. The one caller that must
+  # size a box itself renders `height × ratio` wide, and nothing else says how
+  # wide. An accessor function over it narrowed nothing — the key type is total

xsmall lands only on square — an avatar box is 24–96px, a Column image 128–160px, and
the old floor was 400. getVariantName already falls back to medium for a ratio without the
tier, so no other ladder moves; two specs pin video, 4-3 and 3-2 unchanged. The one side
effect is a 200w entry at the head of every square srcset, which sizes governs.

Flow — why one length per carousel row was wrong

A slide is h-NN w-auto, so its width follows the item, not the row. ContentCard's default
ratio is square, so the common case was being handed a 16:9 figure.

 ContentCarousel                      components/molecules/blocks/ContentCarousel/ContentCarousel.tsx
   CAROUSEL_SIZES[size]
-    imageSizes: '512px'              # the lg row at 16:9, for every slide in it
+    imageHeight: 'h-56 sm:h-64 lg:h-72'   # the only place the height lives
   per slide
-    sizes={imageSizes}
+    sizes={slideSizes(imageHeight, item.aspectRatio)}
+      slideSizes('h-56 sm:h-64 lg:h-72', ratio) parses 56/64/72 out of the class
+        # parsed, not restated: Tailwind compiles only a class it finds
+        # verbatim, so the string stays the source and the numbers derive
+      width(h) = ceil(h × 4px × ASPECT_RATIO_VALUES[ratio])
+      → square lg: 1024px 288px, 640px 256px, 224px
+      → video  lg: 1024px 512px, 640px 456px, 399px
   sizes={item.sizes ?? slideSizes(...)}  # the item's own still wins

Files — three added

 tests/
+├── _helpers/cloudflare-images.ts   # CF_BASE, CF_PUBLIC_URL derived from it, PASSTHROUGH_SOURCES
 └── guards/
+    └── image-variants.test.ts      # the aspectRatio selector really matches, and the
+                                    # raw <img> population it cannot reach is pinned
 components/molecules/VideoPlayer/
+└── poster.ts                       # the poster's one width, its ladder and its bounded
+                                    # sizes, shared by index.tsx and VideoPlayer.tsx
 pages/lectures/[id]/embed/
+└── Page.test.tsx                   # the one route that overrides the bounded default

Preview

Both branch aliases, read from the Cloudflare check summaries rather than derived:

All five verified 200 on the branch aliases, re-checked this round. Every page renders from live
SahajCloud data, so nothing needed seeding. The two Ladle links moved: they pointed at wm-design.pages.dev,
the retired Pages host this branch's own CI fix stopped selecting, and the playground is now the
wemeditate-design Worker alias. The web pages were verified at 05b49de; one round since then
changed a rendered URL, so /lectures/:id and /lectures/:id/embed are worth a fresh look, and
the merge of main carries #214's own change to those pages.

Test results

  • Lean gate: ✓ .claude/skills/pr-prep/check.sh — lint 0 errors, tsc --noEmit, test:run.
    Re-run green after each review round, and after each merge of main — 4 commits this round.
    One new lint warning: the author-filter commit adds a console.error, and no-console is a
    warning under scripts/** by config, which is how the file's other 14 log lines read.
  • Tests: 1034 passed / 108 files
  • Each new spec was watched failing with its call site reverted, then green restored — including
    the derived carousel heights, the raw <img> pin, and both loading="eager" assertions. Both
    lint selectors were watched faulting a real call site, and the spec watched failing with a
    selector broken. This round: the grid's sizes: undefined spec was watched failing against the
    pre-spread default, and the @ts-expect-error pin watched reporting itself unused with
    sizes made optional again
  • Build: ✓ pnpm build, and dist/server carries no Vidstack or hls.js code
    (isHLSProvider|MediaPlayerInstance|Hls.isSupported finds nothing), so the new poster.ts
    did not pull the browser-only player into the Worker
  • comment-lint clean. /security-review ran and found nothing — it had been skipped on the
    claim that no path matches securityReview.triggerPattern, but
    scripts/get-cloudflare-preview-url.mjs matches ^scripts/, so it was owed. Report in the
    summary comment

Manual verification

Items 1–3 of the ticket's checklist are done, on the deployed preview — results below. What
is left for a human is item 4, and the two criteria the CMS has no content for.

  1. ✓ No stray /public, except refactor(image): route hand-rolled &lt;img&gt; elements through the Image atom #150's. /inspiration and /about-meditation are at 0;
    the home page had 2 and /shri-mataji 1, and every one of them was the md:hidden raw
    <img> in ContentOverlay's mobile branch — which this ticket's Interfaces section assigns
    to refactor(image): route hand-rolled &lt;img&gt; elements through the Image atom #150, and which refactor(image): route hand-rolled &lt;img&gt; elements through the Image atom #214 has since shipped. The merged branch should be at 0 everywhere.
    The ticket's own grep over-counts: imagedelivery\.net[^"]*/public matches across a whole
    srcSet attribute, so it reported 48 on a page with 2. The precise pattern is
    imagedelivery\.net/[^/]*/[^/]*/public.
  2. ✓ Variants are live. /shri-mataji requests 200/400/800/1200 on the square ladder and
    1024/1536 on video, with the new width=200 appearing 6 times.
  3. ✓ Generated URLs resolve. width=200, width=400 and width=1024 on two real image ids
    each return HTTP/2 200 with content-type: image/jpeg, so flexible variants are on for the
    account — the prerequisite fix(image): SahajCloud URLs never match the Cloudflare variant pattern #141 settled. (I could not run this before deploying:
    SAHAJCLOUD_API_KEY is empty in the routine environment, /api/clients/me returns
    user: null, so I had no real image id until the preview gave me one.)
  4. ☐ Yours: compare /shri-mataji and /meditate-now against the preview at mobile and
    desktop widths. The variants change bytes, not layout, so anything that moves is a defect.

Two criteria the CMS cannot exercise yet. No page in the content set renders an Avatar
(zero <img> with rounded-full across nine pages) or a VideoPlayer poster (zero
aspect-video w-full object-cover). Both are covered by SSR specs asserting the exact markup,
but neither has been seen on a real page — worth knowing before this is called verified.

Notes for reviewer

  • The poster question is answered: B, built. The SSR fallback now emits the whole video
    ladder, and posterSizes names the box — defaulting to the bounded max-w-4xl case, with
    /lectures/:id/embed passing 100vw through LecturePlayer. Vidstack's own poster still
    takes a single URL, so the mounted player keeps one width, as option B said it would. That
    thread is settled; one new one is open, below.
  • fix(image): nothing stops a hand-rolled eager &lt;img&gt;, and three specs cannot fail #152's two attribute edits are taken here, at your ask, since this PR rewrites both lines:
    loading="eager" fetchPriority="high" on the MeditationPlayer frame, loading="eager" on
    the VideoPlayer SSR poster. fix(image): nothing stops a hand-rolled eager &lt;img&gt;, and three specs cannot fail #152 keeps the guard, its three mis-cased Image.test.tsx
    assertions and the docs/rules/design-system.md rule. DESIGN_SYSTEM.md already states the
    hero rule, so no doc went stale.
  • Each prop is held by what can hold it. sizes is required by ImageProps, because a
    selector reads a prop's presence and a forwarded undefined passes that. aspectRatio keeps
    its selector, because the prop is optional by design — an <Image> whose src is not
    Cloudflare's needs no ratio, so no type can demand it. The scanner both replaced had to track
    quotes and braces by hand to find where a tag ends; the AST reads the same thing exactly, and
    faults the call site in the editor. An exemption is an eslint-disable-next-line with a stated
    reason, which is this repo's own convention and still lands in the diff.
  • The selector stops at <Image>, and the spec says so with a measurement. Holding a raw <img> to
    getImageURL needs exemptions: of the six raw <img> in the scan set only two name the helper
    in the tag — the atom's own is the pipeline, one paints a bundled SVG, and two reach the helper
    a hop away. The population is pinned instead, so a seventh is a red test and a decision.
    Merging main moved that pin: refactor(image): route hand-rolled &lt;img&gt; elements through the Image atom #214 migrated ContentOverlay and AtlasContent, which is
    exactly what the docstring said would happen there rather than here.
  • fix(cards): index-grid cards declare 800px for a 357px box #206 lands here, at your ask. It was filed on the way — ContentCard's sizes reached no
    caller but the carousel, so the content-index grid declared 800px for a ~357px card — and it
    was the open decision blocking a required sizes. You answered B, in this ticket, and its
    own decision had already settled on A — a sizes prop on ContentGrid, so the two fit
    together and this PR closes it. The ticket's one criterion that B supersedes is marked there.
  • The question thread is settled and resolved. It asked whether sizes should be required by
    the type rather than by lint; option B is built.
  • Rejected review findings, each with the reason:
    • Derive Avatar's width from its size prop. The ticket considered the range and chose one
      tier; 200px covers the largest box (96px) at 2x, and the only caller today is 64px.
    • Fix ContentOverlay and AtlasContent too, since the one-line fix is proven here. They
      are refactor(image): route hand-rolled &lt;img&gt; elements through the Image atom #150's, by this ticket's own Interfaces section.
    • Drop the per-site pass-through specs as duplicates of the library's. Acceptance criterion 8
      asks for it "at every site touched", and a site could mangle the URL on its own.
    • Give TechniqueCard's mobile arm a calc(100vw - 3rem) gutter. Not a regression, and the
      gutter belongs to a page template the component does not own — it has no production caller
      yet, only its story.
    • Reuse lib/head.tsx's identical getImageURL(url, getVariantName('video','large')). Same
      expression, different contract — that one is the OG image.
    • Name the getImageURL(x, getVariantName(r, s)) composition as one exported helper. Checked
      again under your simplification ask, and the count was overstated: four call sites spell it
      nested (Image.tsx twice, SplashLoader, lib/head.tsx) and this PR adds none of them —
      its three hand-rolled sites hoist a module constant instead, which is what keeps
      MeditationPlayer from recomputing at 10 Hz. A combined helper would undo that hoist and
      touch only files this ticket does not own.
Detail

Measured on the preview: the thumbnail win is real, and width=800 is not always a win.
Five real images, bytes from content-length:

image /public width=200 width=400 width=800
09131159 40,474 8,516 27,201 82,976
504d3db7 59,380 3,849 9,749 29,183
3b33f2f9 23,806 5,305 15,142 170,519
372a4438 54,078 3,520 8,974 24,018
6012d771 145,558 6,880 22,074 75,365

width=200 beats the original by 6–21× every time, which is the avatar and thumbnail case this
ticket exists for. But Cloudflare upscales — it does not cap at the source width, so for the
two small-source images width=800 costs 2–7× more than /public did. Where a srcset plus a
sizes governs the choice that is harmless, because the browser picks a lower rung. It is a real
risk wherever a site emits a single URL and no srcset. That was the poster's case, and it is
the measurement behind answering the question thread B: the SSR fallback now carries a
srcset, so only the MeditationPlayer frame (800) still spends one fixed width.

Why three of my own sizes were wrong, and how. All three declared a maximum that holds only
at the top of a breakpoint band, so the browser rounded up a rung for the whole band. Square
ladder 200/400/800/1200, at DPR 1:

Site real box declared picked should pick
MusicLibrary, viewport 768px 316px (max-w-md less its own p-4, halved by the grid) 448px 800 400
HeaderDropdown, viewport 768px 352px ((V − 64) / 2) 480px 800 400
ContentCarousel lg, square, desktop 288px (the row height — a square slide is as wide as it is tall) 512px 800 400

The old DEFAULT_SIZES picked 400 in two of those bands, so each was a 4× regression against the
code I was replacing, not merely a missed saving. Each now declares the expression rather than
its ceiling, and each spec asserts the wrapper's own classes beside the sizes, so a pixel
number cannot outlive the box it describes.

The carousel went one step further: its numbers are no longer written down. heights
restated imageHeight as nine figures that nothing checked, which is the same defect as a
sizes outliving its box. slideSizes parses the three units out of the class string and
multiplies by 4px, so the class string is the single source — and it has to stay literal,
because Tailwind compiles only a candidate it finds verbatim in a scanned file. A TrackHeight
template-literal type carries the three-band shape, so the parser needs no unreachable error
branch. The simplification round folded the separate trackHeights into it: the intermediate
{ base, sm, lg } had one caller and one producer. The 4px unit itself is the last assumption,
and layouts/tailwind.test.ts pins it against the compiled stylesheet, where a --spacing
override would otherwise shift every carousel sizes in silence.

The MeditationPlayer comment's arithmetic was wrong, and the ticket's was too. That box is
488px — max-w-lg less inset-2 and the 4px border — so at 2x it wants 976, and 800 is a
deliberate ~0.8x sample, not coverage. The next square width is 1200, for 2.25x the pixels. The
real headroom is a srcset, which a hand-rolled <img> has none of. The comment now says that.

What option B buys, in widths. The poster's ladder is 640/800/1024/1536. Bounded, the
player's box is max-w-4xl in LectureTemplate and 32px narrower inside PageTemplate's
Container; both pick the same rung at every band, so one default covers them —
(min-width: 896px) 896px, 100vw. At DPR 2 that band now reaches 1536 instead of the fixed
1024. Unbounded, /lectures/:id/embed sets no Layout, so an iframe at 1280–1920px was taking a
~0.6x sample; 100vw lets it take 1536. Below 896px every route drops to 800 or 640, which the
old single width never did.

The two loading attributes are a preload, not a hint. React 19 hoists a
<link rel="preload" as="image"> for any <img> that is not loading="lazy", so the explicit
eager is what buys the preload at both sites — MeditationTemplate renders the player as the
page's only content, and the VideoPlayer fallback is the only poster in the server HTML. Both
assertions were watched failing with the attributes removed.

Fixture pre-mortem. The specs assume SahajCloud sends …/<image_id>/public. Verified against
the real producer, not assumed: sydevs/SahajCloud
src/plugins/storage/cloudflareImagesAdapter.ts builds `${config.deliveryUrl}/${imageId}/public`.
ContentCard.test.tsx had been using the bare …/<image_id>/ shape, which no read produces and
which is how #141 stayed green while the pipeline was dead; it now uses the real spelling, from
one shared helper rather than twelve pasted copies. That helper also dropped the :203 line
number the comment had been pinning in a sibling repo — a moving target, which the code-comments
rule rules out.

Variant constants are hoisted to module scope at all three hand-rolled sites.
getVariantName takes literals, and MeditationPlayer re-renders at 10 Hz for the whole of a
meditation, where the Image atom next door already memoises the identical computation.

One blind spot left, recorded beside the selector. A selector reads whether a tag carries a
prop, so a caller forwarding sizes={sizes} and handed undefined read as compliant — that was
#206, and the required type is what closed it. The remaining one: the selector reads <Image>
tags only, which leaves the six raw <img> out of scope, so the spec measures that population
and pins it rather than leaving the reason for stopping as an unchecked claim. One hazard the
move to lint inherits: no-restricted-syntax is a single rule id, so it shares the block that
holds the untranslated-copy selectors, and that block's ignores and any disable region for copy
silence it too. Neither reaches an <Image> today, and the comment says so.

What a required sizes costs, and where. 48 of the touched lines are a story or a spec
declaring a box it had been leaving to the default — Image.stories.tsx names the column of its
own grid, Image.test.tsx passes a neutral 100vw. That is the price of the type, and it is
paid once. No production call site changed: all 14 already passed a sizes, which is what made
B free at the atom. The only production length this round adds is the content-index grid's.

Review passes. /simplify (4 agents) then /code-review high — pr-review-toolkit is not
installed in a routine, confirmed with ListPlugins. Then the adversarial review's three
findings, all built. The simplification round added /security-review, which the trigger path
had owed since the CI fix landed: clean, with the paths it read and the attack paths it ruled out
recorded in the summary comment.

Closes #146
Closes #206


Generated by Claude Code

claude added 11 commits October 27, 2026 22:39
`square`'s smallest width was 400px, while an avatar renders at 24–96px and a
Column image at 128–160px. Flexible variants make a width a map entry rather
than a Cloudflare dashboard entry, so the tier costs nothing upstream.

`getVariantName` already falls back to `medium` for a ratio that lacks the
requested tier, so no other ladder moves. The one side effect is a `200w` entry
at the head of every `square` srcset, which `sizes` governs.

Refs #146

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjVM6CEHequybD7bprE
Each of these reached an `imagedelivery.net` URL with no aspect ratio, so it
asked Cloudflare for no variant and got the `/public` original at full file
size. An author avatar is a 40px box fed a full-resolution portrait.

`Avatar` and the `MeditationPlayer` frame hand-roll an `<img>`, so they call
`getImageURL` directly. The `VideoPlayer` poster renders twice — the SSR
fallback and Vidstack — from two modules that must not import each other, so
the width lives in a third, `poster.ts`.

`ContentCard` dropped `aspectRatio` whenever a fixed `imageHeight` was set.
`forceAspectRatio={false}` keeps the fixed-height, natural-width layout while
the ratio still picks a variant and a srcset. `Column` draws its own square box
and needed the same treatment.

Refs #146

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjVM6CEHequybD7bprE
Each resolved a variant but left `sizes` to the atom's full-width default, so
the browser picked an 800px srcset entry for a box as small as 48px. That half
only became real once #147 made the pipeline work; before it, these served
`/public` too.

`ContentCard` takes a `sizes` prop and `ContentCarousel` derives one from its
own image height, since a slide's width is its image's natural width.

Refs #146

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjVM6CEHequybD7bprE
Each spec was watched red with its call site reverted, and green with it
restored. The fixtures are spelled `…/<image_id>/public`, the shape
sydevs/SahajCloud `src/plugins/storage/cloudflareImagesAdapter.ts:203` builds;
`ContentCard`'s old bare `…/<image_id>/` is what let #141 stay green while the
pipeline was dead.

Every file also asserts the pass-through: a bundled asset, a story
placeholder and the SahajCloud dev `/api/<collection>/file/<filename>` URL
each render unchanged, with no srcset.

Vidstack's own poster cannot be reached through SSR, so `posterURL` is
asserted directly — it is the single resolution both branches call.

Refs #146

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjVM6CEHequybD7bprE
The widths table and the size-tier list were both stale once `square` gained
its thumbnail width.

The new paragraph is the part that would have prevented the ticket: the table
documented which widths exist but never that `aspectRatio` is what asks for a
variant at all, nor that a box narrower than the viewport has to say so. Ten
call sites each missed one of those two.

Refs #146

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjVM6CEHequybD7bprE
Ten new specs had pasted the same URL, and four had re-typed its variant-less
base beside it — two 50-character literals per file that a single typo
decouples, leaving the test asserting against a URL no code produces.
`CF_PUBLIC_URL` now derives from `CF_BASE`, as `lib/cloudflare-images.test.ts`
and `Image.test.tsx` already do for their own copies.

The provenance comment went with it, and lost the `:203` line number it had
been pinning in a sibling repo — a moving target, which the code-comments rule
rules out. `lib/cloudflare-images.ts` cites the same adapter without one.

The resolver's own specs keep their local copies: a spec for `getImageURL` must
not take its input from a helper that `getImageURL`'s callers share.

Refs #146

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjVM6CEHequybD7bprE
Three of the ten `sizes` were coarser than the atom's old default in the
narrow bands, so they regressed what they meant to fix.

`MusicLibrary` claimed a flat 448px. The column is `max-w-md` less its own
`p-4`, so 416px at the widest — and only 316px in the `md` two-column band,
where 448 fetched 800 and 400 covers it. `HeaderDropdown` claimed 480px, the
maximum of a two-column range that starts at 352px, with the same effect. Each
now declares the expression rather than its ceiling.

`ContentCarousel` was worse. A slide is `h-NN w-auto`, so it renders
`height × ratio` wide, which makes the width a property of the item, not of
the row. One flat 16:9 length over-declared a square card — ContentCard's
default, and the common case — by 1.78x, enough to cross a rung and fetch four
times the pixels, and over-declared a 16:9 card on mobile too. It now derives
three lengths from the row's own heights and the item's own ratio, so
`aspectRatioValue` is exported for the one caller that must size a box itself.

Each spec asserts the wrapper's classes beside the `sizes`, so a pixel number
cannot outlive the box it describes.

Arithmetic, square ladder 200/400/800/1200, at DPR 1:

| Site | box | was | now |
| --- | --- | --- | --- |
| MusicLibrary, 768px wide | 316px | 800 | 400 |
| HeaderDropdown, 768px wide | 352px | 800 | 400 |
| Carousel lg, square, desktop | 288px | 800 | 400 |

Refs #146

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjVM6CEHequybD7bprE
`getVariantName` takes literals at all three hand-rolled sites, so it belongs
at module scope. `MeditationPlayer` is the one that matters: it re-renders at
10 Hz for the whole of a meditation, and the `Image` atom next door already
memoises the identical computation.

The frame comment's arithmetic was wrong, and is now right. That box is 488px
— `max-w-lg` less `inset-2` and the 4px border — so 800px is a deliberate
~0.8x sample at 2x, not coverage; the next square width is 1200, for 2.25x the
pixels. The real headroom there is a srcset, which a hand-rolled `<img>` has
none of.

`ContentCard`'s two comments shrank: one was narrating the code it replaced,
the other paraphrasing the atom's own prop doc.

Refs #146

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjVM6CEHequybD7bprE
Fourteen call sites were missing one or the other, and nothing but prose on
`ImageProps` asked for them. This makes the next one a red test naming its
file and line, rather than a silent 20x over-fetch nobody looks for.

The population is small and closed — twelve sites, all compliant — so the
guard goes green on the tree as it stands. Both arms were watched failing
first, by dropping `sizes` from AudioPlayer and `aspectRatio` from Column.

A scan that matches nothing fails open, so a third case pins what it found,
as `jsx-literals.test.ts` does for the lint selectors. `EXEMPT` is empty and
takes a reason, not just a path: a caller that truly wants the intrinsic-ratio
mode or the full-width default is a decision, not an omission.

Refs #146

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjVM6CEHequybD7bprE
It was keyed by file and returned early, so exempting one `<Image>` tag would
have silently stopped checking every other tag in that file. It was also
empty, so nothing needed it: a caller that truly wants the intrinsic-ratio
mode or the full-width default now edits the guard, which puts the reason in
front of a reviewer at the moment it is claimed.

The docstring also records what this guard cannot see. It reads whether a tag
mentions a prop, so a caller forwarding `sizes={sizes}` and handed `undefined`
reads as compliant — which `ContentCard`'s grid callers do (#206).

Refs #146

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjVM6CEHequybD7bprE
Every other guard in this repo is named from the doc stating its rule —
`design-tokens` here, `theme-utilities` from the tailwind rule. This one was
not, so a reader of the new paragraph could not tell the rule was checked.

Refs #146

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

@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

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 27, 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 65fecd1 Commit Preview URL

Branch Preview URL
Nov 18 2026, 07:31 PM

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

sydevs-bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 no session running
CI fix 1

recent dispatches
  • 19:26Z resolve-conflicts · attempt 1 · session · done
  • 19:26Z resolve-conflicts · attempt 1 · session
  • 19:04Z address-review · attempt 1 · session · done
  • 19:04Z address-review · attempt 1 · session
  • 18:41Z fix-ci · attempt 1 · session · done

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

@sydevs-bot sydevs-bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

🧐 Adversarial review

The diff matches #146: ten named sites, two new files, no refactor smuggled in. Only the guard and aspectRatioValue go beyond the ticket, and the ## Summary names the first.

The aggregate question is the mechanism: ten hand-derived pixel strings that must track Tailwind classes nothing can diff them against, three of ten wrong on the first pass by the PR's own account. Worth asking what removes most of them — one shared class-to-px table, or sizes="auto", which is lazy-only and not in every browser.

Findings

  • should-fix — the guard covers <Image> only; 4 of the 10 fixed sites are raw <img>. tests/guards/image-variants.test.ts:29
  • should-fix — heights mirrors imageHeight in nine unchecked numbers. ContentCarousel.tsx:19
  • consider — aspectRatioValue is a one-line accessor for one caller. lib/cloudflare-images.ts:100
  • consider — the hand-written sizes mechanism above.

What was checked

  • Read whole: Image.tsx, Avatar, Column, ContentCard, ContentCarousel, HeaderDropdown, MusicLibrary, TechniqueCard, poster.ts, cloudflare-images.ts, the guard and _source-scan.
  • item.aspectRatio traced to populatedImage → nearestAspectRatio, so slideSizes follows the intrinsic ratio, not a flat row figure. Both callers build items by spread and set no sizes, so the pre-spread order is safe today.
  • All four previews 200. /shri-mataji serves widths 200/400/800/1024/1200/1536 and one /public (ContentOverlay, #150's). /meditate-now: zero /public, 9 images on the atom's default sizes — #206 reproduced, rightly filed not folded in.
  • poster.ts as a third module: passed. The alternatives pull Vidstack into the Worker or make the impl import its own barrel.
  • No contract surface moves, and two specs pin the ladders xsmall must not touch.

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


Generated by Claude Code

Comment thread tests/guards/image-variants.test.ts Resolved
Comment thread lib/cloudflare-images.ts Resolved
@sydevs-bot sydevs-bot removed the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Oct 28, 2026
@sydevs-bot sydevs-bot moved this from Working to Pending in SYDevelopers Technical Roadmap Oct 28, 2026
@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Oct 28, 2026
@sydevs-bot sydevs-bot moved this from Pending to Working in SYDevelopers Technical Roadmap Oct 28, 2026
`aspectRatioValue` was a one-line accessor over a `Record<AspectRatio,
number>` whose key type is already total, so it narrowed nothing and bought
no call-site clarity. Export the table and index it: one export fewer, and
the "why a caller needs the number" note now sits on the data.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjUq7tB5AF9tinbwNNW
`heights` restated `imageHeight` as nine numbers with nothing checking that
the two stayed in step. The class string has to stay literal — Tailwind
compiles only a candidate it finds verbatim in a scanned file — so the
numbers are now parsed from it instead of typed beside it.

A `TrackHeight` template-literal type carries the three-band shape, which
keeps the parser free of an unreachable error branch. The spec asserts the
`h-*` classes beside each `sizes`, the discipline AudioPlayer, MusicLibrary
and TechniqueCard already use, and `layouts/tailwind.test.ts` pins the 4px
unit against the compiled stylesheet, since a `--spacing` override is the one
thing that would shift every carousel `sizes` silently.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjUq7tB5AF9tinbwNNW
The scan reads `<Image>` only, and four of the ten sites #146 fixed are a
hand-rolled `<img>`. Holding those to `getImageURL` needs the exemption list
this guard refuses: of the eight raw `<img>` in the scan set only two name the
helper in the tag, and the two that genuinely pass an unsized URL are #150's,
so that arm would ship red.

Pin the population instead. A new raw `<img>` anywhere in the scan set is now
a red test and a decision, rather than a silent eleventh over-fetch outside
the guard. The docstring carries the measurement, and the pin is what stops
that measurement rotting.

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

@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 eslint.config.js Resolved
Discovery read every PR comment. Anyone who can comment can post a
`*.workers.dev` URL, and `matchesTarget` is a substring check over the project
name, so `https://wemeditate-web.<anything>.workers.dev` matched the target and
the smoke suite would measure that host and report it green.

Sources 2-4 read deployment statuses, commit statuses and check runs, which
only an app with write access can set. Comments were the one open surface.

It also stops a candidate nobody meant to offer: our own summary comments quote
the preview URL in prose, so they were candidates too.

A Cloudflare rename degrades to the other three sources rather than failing,
since comments are only the first source tried. Found by the /security-review
this branch's `scripts/` change had owed; it rated the exploit below its
reporting bar because no credential reaches the selected host, but a false-green
smoke check is worth one line.

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

Copy link
Copy Markdown
Contributor Author

Simplified, on your review body — "look for opportunities to streamline and simplify the code." main merged in first, 8 commits, clean.

Built

  • The <Image> guard was a 45-line quote-and-brace state machine. Two no-restricted-syntax selectors read the same thing off the AST, and fault the call site. 4625a66
  • trackHeights fed one caller, so slideSizes parses the class string itself — one replace, no intermediate shape. 66055f6
  • DESIGN_SYSTEM.md still named the guard as the enforcement. 57aa438

Joined

  • /security-review was owed: scripts/ matches the trigger path, so the body's claim that nothing did was wrong. Clean — but discovery read every PR comment, so anyone who can comment could point the smoke suite at their own host. Cloudflare's bot only now. 98620d1

Asked

Gate green: 1004 passed / 104 files.

🤖 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 17, 2026
@sydevs-bot sydevs-bot moved this from Working to Awaiting in SYDevelopers Technical Roadmap Nov 17, 2026
@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 18, 2026
@sydevs-bot sydevs-bot moved this from Awaiting to Working in SYDevelopers Technical Roadmap Nov 18, 2026
A `no-restricted-syntax` selector reads whether a tag carries a prop, so
a caller forwarding `sizes={sizes}` and handed `undefined` passed it.
That is #206 exactly, and no selector can see it.

`ImageProps.sizes` is now `string`, so `tsc` faults the call site that
declares no box. The chain above it takes one of its own and passes it
on, because none of them knows its own width: `ContentCard`, then
`ContentGrid` and `ContentIndex`, and the length is chosen in
`blockConverters` beside the `Container maxWidth="xl"` that sets it —
`(max-width: 639px) 100vw, (max-width: 1023px) 50vw, 360px`, the three
`react-masonry-css` bands over a 1120px content column. That is #206's
own fix, which the type change forces rather than defers.

The grid and the carousel resolve an item's override with `??` rather
than a pre-spread default: an item built by spreading a wider shape can
carry an explicit `sizes: undefined`, and a spread hands that on.

`aspectRatio` keeps its selector. The prop is optional by design — an
`<Image>` whose src is not Cloudflare's needs no ratio — so no type can
demand it. `Image.test.tsx` pins the new requirement with a
`@ts-expect-error`: make `sizes` optional again and tsc reports the
directive unused.

Closes #206

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

Copy link
Copy Markdown
Contributor Author

B built, in this ticket — 687fa13. main merged in first, 4 commits, clean.

Answered

  • Should sizes be required by the type? — ImageProps.sizes is string, so tsc faults a call site that declares no box. The chain above it takes one of its own: ContentCard, ContentGrid, ContentIndex, with the length picked in blockConverters beside the Container that sets the width. The sizes selector is gone; aspectRatio keeps its one, since no type can demand an optional prop.

#206 lands with it

Requiring sizes forces the grid chain to carry a length, which is #206's fix, so this PR now closes it. Its decision had already settled on the same shape. One superseded criterion is struck there.

Cost

48 of the changed lines are a story or spec declaring a box it had left to the default. No production call site moved — all 14 already passed a sizes.

Gate green: 1034 passed / 108 files.

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


Generated by Claude Code

@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 18, 2026
…variants

Both sides fixed #184, the retired wm-design.pages.dev preview, in different
places. main narrows PREVIEW_URL_RE to workers.dev, so no pages.dev candidate
is ever extracted; this branch kept the wider regex and dropped such candidates
in discoverUrl. Took main's: it is the earlier cut, and tests/guards/preview-
discovery.test.ts pins extractPreviewUrl returning null for a pages.dev host.
isRetiredPagesPreview and its call are gone — unreachable once the regex cannot
produce one. The SahajAtlasWeb#266 breadcrumb is folded into main's comment.

The branch's own additions in that file survive untouched: the PR-comment
author allowlist, which is this branch's security fix, and the label refactor
in discoverUrl. docs/cloudflare-previews-ci.md takes main's paragraph for the
same reason, keeping this branch's mention of the `skipping …` log lines, which
discovery still prints.

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

Copy link
Copy Markdown
Contributor Author

Merged main (4a0feae). Two conflicts, both the same story: this branch and main each fixed #184 in a different place.

scripts/get-cloudflare-preview-url.mjs — took main. It narrows PREVIEW_URL_RE to workers.dev, so a pages.dev candidate is never extracted; this branch kept the wider regex and dropped such candidates later, in discoverUrl. main's cut is earlier, and tests/guards/preview-discovery.test.ts pins extractPreviewUrl returning null for a pages.dev host. isRetiredPagesPreview and its call are gone — unreachable once the regex cannot produce one. The sydevs/SahajAtlasWeb#266 breadcrumb is folded into main's comment.

This branch's own additions to that file survive: the PR-comment author allowlist (its security fix) and the label refactor.

docs/cloudflare-previews-ci.md — main's paragraph. Kept this branch's mention of the skipping … lines, which discovery still prints.

Lean gate green after the merge: lint 0 errors, tsc clean, 1084 tests / 112 files.

🤖 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 18, 2026
@sydevs-bot sydevs-bot moved this from Working to Awaiting in SYDevelopers Technical Roadmap Nov 18, 2026
@sydevs-bot
sydevs-bot added this pull request to the merge queue Nov 18, 2026
@sydevs-bot sydevs-bot moved this from Awaiting to Pending in SYDevelopers Technical Roadmap Nov 18, 2026
Merged via the queue into main with commit 6e31182 Nov 18, 2026
24 of 25 checks passed
@sydevs-bot
sydevs-bot deleted the claude/fix-146-image-variants branch November 18, 2026 19:51
@sydevs-bot sydevs-bot moved this from Pending to Done in SYDevelopers Technical Roadmap Nov 18, 2026
sydevs-bot pushed a commit that referenced this pull request Nov 18, 2026
`main` #207 added `MusicLibrary.test.tsx` and `AudioPlayer.test.tsx` to pin
the `sizes` each component advertises. This branch had already written a
`MusicLibrary.test.tsx` of its own, and had replaced `AudioPlayerProps`
`tracks` with the `state`/`controls` pair.

MusicLibrary.test.tsx keeps both suites in one file. The album-art spec is
unchanged beyond a fixture rename, and `renderToStaticMarkup` is a server
render whatever environment holds it, so the file's jsdom opt-in leaves that
markup contract where it was.

AudioPlayer.test.tsx keeps `main`'s assertion and states the player pair the
spec needs. `<AudioPlayer tracks={[track]} />` no longer type-checks, and the
48px box it measures is unaffected by who owns the track index.

The component hunks merged clean: `MusicLibrary.tsx` carries the new `sizes`
inside the hoisted hook, and `AudioPlayer.tsx` keeps its 48px thumbnail while
reading `state.currentTrack`.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjZYuTjX2vtP6zEpMYz
sydevs-bot pushed a commit that referenced this pull request Nov 18, 2026
…ontrast

#207 gave `Image` and `ContentCard` a `sizes` prop and made it required on
`ContentCard`, while this branch had sorted the same prop lists and recoloured
the same stories. Four files conflicted, every one of them on that overlap, so
both sides are kept in all four.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjXEpiA9teFyoetKjha
sydevs-bot added a commit that referenced this pull request Nov 18, 2026
Merging main brought in the thumbnail-sizes spec #207 added, written
against the `tracks` prop this branch replaced. AudioPlayer is now
presentational, so the spec builds the state and controls the hook would
hand it. Its three assertions are unchanged.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjYpgD65LmAMV3o2pLU
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(cards): index-grid cards declare 800px for a 357px box fix(image): six paths skip the variant pipeline, four over-fetch

3 participants