Repository navigation
fix(image): six paths skip the variant pipeline, four over-fetch - #207
Conversation
`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
left a comment
There was a problem hiding this comment.
1 question for the reviewer, one per thread.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
Deploying with
|
| 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 |
|
🤖 no session running recent dispatchesWritten by the sydevs dispatcher. Sessions never edit this comment. |
sydevs-bot
left a comment
There was a problem hiding this comment.
🧐 Adversarial review
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 —
heightsmirrorsimageHeightin nine unchecked numbers.ContentCarousel.tsx:19 - consider —
aspectRatioValueis a one-line accessor for one caller.lib/cloudflare-images.ts:100 - consider — the hand-written
sizesmechanism 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.aspectRatiotraced topopulatedImage→nearestAspectRatio, soslideSizesfollows the intrinsic ratio, not a flat row figure. Both callers build items by spread and set nosizes, so the pre-spread order is safe today.- All four previews 200.
/shri-matajiserves widths 200/400/800/1024/1200/1536 and one/public(ContentOverlay, #150's)./meditate-now: zero/public, 9 images on the atom's defaultsizes— #206 reproduced, rightly filed not folded in. poster.tsas 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
xsmallmust not touch.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
`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
Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjUq7tB5AF9tinbwNNW
sydevs-bot
left a comment
There was a problem hiding this comment.
1 question for the reviewer, one per thread.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
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
|
Simplified, on your review body — "look for opportunities to streamline and simplify the code." Built
Joined
Asked
Gate green: 1004 passed / 104 files. 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
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
|
B built, in this ticket — 687fa13. Answered
#206 lands with it Requiring 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 Gate green: 1034 passed / 108 files. 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
…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
|
Merged
This branch's own additions to that file survive: the PR-comment author allowlist (its security fix) and the
Lean gate green after the merge: lint 0 errors, 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
`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
…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
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
Summary
/publicoriginal, or declare the box they actually draw instead of the atom's full-width default.
ImageProps.sizesis required, and one lint selector holds every<Image>to anaspectRatio, so the eleventh site is an error where it is written rather than a silentover-fetch. Not in the ticket; it is what makes the sweep stick.
sizeswere coarser than the default they replaced in the narrow bands. Thereview pass caught them, and the arithmetic is now in the commit and the specs.
heights are parsed from their own Tailwind classes, and the raw
<img>population nothing canhold to the helper is pinned rather than described.
loadingattributes land here too: this PR rewrites the same two lines.the route that nothing bounds declares its own box.
<Image>rules off a hand-rolled tag scanner onto two ASTlint selectors, and folded the carousel's two height functions into one.
sizesis required by thetype, 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.
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.
Enforcement — the type, where a selector could not see
A selector reads whether a tag carries a prop, so a component forwarding a
sizesof its ownthat is
undefinedpassed it. That is #206 exactly.#206's own fix is that last line. Its decision was already settled (A — a
sizesprop onContentGrid, 2026-11-17), the queries are639/1023becausereact-masonry-cssswitches oninnerWidth <= breakpoint, and 360px is the first round number above the widest card (357px ata 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 widershape can carry an explicit
sizes: undefined, and a spread hands that straight on. The grid andthe carousel both resolve it explicitly now, and a spec pins the
undefinedcase.Types — one new width, one newly exported constant
xsmalllands only onsquare— an avatar box is 24–96px, aColumnimage 128–160px, andthe old floor was 400.
getVariantNamealready falls back tomediumfor a ratio without thetier, so no other ladder moves; two specs pin
video,4-3and3-2unchanged. The one sideeffect is a
200wentry at the head of every square srcset, whichsizesgoverns.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 defaultratio is
square, so the common case was being handed a 16:9 figure.Files — three added
Preview
Both branch aliases, read from the Cloudflare check summaries rather than derived:
the two
ContentOverlaymobile<img>s were the only/publicleft on it; refactor(image): route hand-rolled <img> elements through the Image atom #214 has sincemigrated both on
main, so the merged branch should serve none— the fullest page: 6
width=200srcset entries, plus 400/800/1200 and the video ladder—
ContentCardthumbnails throughContentGrid; this is where fix(cards): index-grid cards declare 800px for a 357px box #206 is visibleand Avatar
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-designWorker alias. The web pages were verified at 05b49de; one round since thenchanged a rendered URL, so
/lectures/:idand/lectures/:id/embedare worth a fresh look, andthe merge of
maincarries #214's own change to those pages.Test results
.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, andno-consoleis awarning under
scripts/**by config, which is how the file's other 14 log lines read.the derived carousel heights, the raw
<img>pin, and bothloading="eager"assertions. Bothlint selectors were watched faulting a real call site, and the spec watched failing with a
selector broken. This round: the grid's
sizes: undefinedspec was watched failing against thepre-spread default, and the
@ts-expect-errorpin watched reporting itself unused withsizesmade optional againpnpm build, anddist/servercarries no Vidstack or hls.js code(
isHLSProvider|MediaPlayerInstance|Hls.isSupportedfinds nothing), so the newposter.tsdid not pull the browser-only player into the Worker
comment-lintclean./security-reviewran and found nothing — it had been skipped on theclaim that no path matches
securityReview.triggerPattern, butscripts/get-cloudflare-preview-url.mjsmatches^scripts/, so it was owed. Report in thesummary 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.
/public, except refactor(image): route hand-rolled <img> elements through the Image atom #150's./inspirationand/about-meditationare at 0;the home page had 2 and
/shri-mataji1, and every one of them was themd:hiddenraw<img>inContentOverlay's mobile branch — which this ticket's Interfaces section assignsto refactor(image): route hand-rolled <img> elements through the Image atom #150, and which refactor(image): route hand-rolled <img> 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[^"]*/publicmatches across a wholesrcSetattribute, so it reported 48 on a page with 2. The precise pattern isimagedelivery\.net/[^/]*/[^/]*/public./shri-matajirequests 200/400/800/1200 on the square ladder and1024/1536 on video, with the new
width=200appearing 6 times.width=200,width=400andwidth=1024on two real image idseach return
HTTP/2 200withcontent-type: image/jpeg, so flexible variants are on for theaccount — the prerequisite fix(image): SahajCloud URLs never match the Cloudflare variant pattern #141 settled. (I could not run this before deploying:
SAHAJCLOUD_API_KEYis empty in the routine environment,/api/clients/mereturnsuser: null, so I had no real image id until the preview gave me one.)/shri-matajiand/meditate-nowagainst the preview at mobile anddesktop 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>withrounded-fullacross nine pages) or aVideoPlayerposter (zeroaspect-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
ladder, and
posterSizesnames the box — defaulting to the boundedmax-w-4xlcase, with/lectures/:id/embedpassing100vwthroughLecturePlayer. Vidstack's own poster stilltakes 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.
loading="eager" fetchPriority="high"on theMeditationPlayerframe,loading="eager"onthe
VideoPlayerSSR poster. fix(image): nothing stops a hand-rolled eager <img>, and three specs cannot fail #152 keeps the guard, its three mis-casedImage.test.tsxassertions and the
docs/rules/design-system.mdrule.DESIGN_SYSTEM.mdalready states thehero rule, so no doc went stale.
sizesis required byImageProps, because aselector reads a prop's presence and a forwarded
undefinedpasses that.aspectRatiokeepsits selector, because the prop is optional by design — an
<Image>whose src is notCloudflare'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-linewith a statedreason, which is this repo's own convention and still lands in the diff.
<Image>, and the spec says so with a measurement. Holding a raw<img>togetImageURLneeds exemptions: of the six raw<img>in the scan set only two name the helperin 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
mainmoved that pin: refactor(image): route hand-rolled <img> elements through the Image atom #214 migratedContentOverlayandAtlasContent, which isexactly what the docstring said would happen there rather than here.
ContentCard'ssizesreached nocaller but the carousel, so the
content-indexgrid declared 800px for a ~357px card — and itwas the open decision blocking a required
sizes. You answered B, in this ticket, and itsown decision had already settled on A — a
sizesprop onContentGrid, so the two fittogether and this PR closes it. The ticket's one criterion that B supersedes is marked there.
sizesshould be required bythe type rather than by lint; option B is built.
Avatar's width from itssizeprop. The ticket considered the range and chose onetier; 200px covers the largest box (96px) at 2x, and the only caller today is 64px.
ContentOverlayandAtlasContenttoo, since the one-line fix is proven here. Theyare refactor(image): route hand-rolled <img> elements through the Image atom #150's, by this ticket's own Interfaces section.
asks for it "at every site touched", and a site could mangle the URL on its own.
TechniqueCard's mobile arm acalc(100vw - 3rem)gutter. Not a regression, and thegutter belongs to a page template the component does not own — it has no production caller
yet, only its story.
lib/head.tsx's identicalgetImageURL(url, getVariantName('video','large')). Sameexpression, different contract — that one is the OG image.
getImageURL(x, getVariantName(r, s))composition as one exported helper. Checkedagain under your simplification ask, and the count was overstated: four call sites spell it
nested (
Image.tsxtwice,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
MeditationPlayerfrom recomputing at 10 Hz. A combined helper would undo that hoist andtouch only files this ticket does not own.
Detail
Measured on the preview: the thumbnail win is real, and
width=800is not always a win.Five real images, bytes from
content-length:/publicwidth=200width=400width=80009131159504d3db73b33f2f9372a44386012d771width=200beats the original by 6–21× every time, which is the avatar and thumbnail case thisticket exists for. But Cloudflare upscales — it does not cap at the source width, so for the
two small-source images
width=800costs 2–7× more than/publicdid. Where a srcset plus asizesgoverns the choice that is harmless, because the browser picks a lower rung. It is a realrisk 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
MeditationPlayerframe (800) still spends one fixed width.Why three of my own
sizeswere wrong, and how. All three declared a maximum that holds onlyat 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:
MusicLibrary, viewport 768pxmax-w-mdless its ownp-4, halved by the grid)HeaderDropdown, viewport 768px(V − 64) / 2)ContentCarousellg, square, desktopThe old
DEFAULT_SIZESpicked 400 in two of those bands, so each was a 4× regression against thecode 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 pixelnumber cannot outlive the box it describes.
The carousel went one step further: its numbers are no longer written down.
heightsrestated
imageHeightas nine figures that nothing checked, which is the same defect as asizesoutliving its box.slideSizesparses the three units out of the class string andmultiplies 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
TrackHeighttemplate-literal type carries the three-band shape, so the parser needs no unreachable error
branch. The simplification round folded the separate
trackHeightsinto it: the intermediate{ base, sm, lg }had one caller and one producer. The 4px unit itself is the last assumption,and
layouts/tailwind.test.tspins it against the compiled stylesheet, where a--spacingoverride would otherwise shift every carousel
sizesin silence.The
MeditationPlayercomment's arithmetic was wrong, and the ticket's was too. That box is488px —
max-w-lglessinset-2and the 4px border — so at 2x it wants 976, and 800 is adeliberate ~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-4xlinLectureTemplateand 32px narrower insidePageTemplate'sContainer; 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 fixed1024. Unbounded,
/lectures/:id/embedsets no Layout, so an iframe at 1280–1920px was taking a~0.6x sample;
100vwlets it take 1536. Below 896px every route drops to 800 or 640, which theold single width never did.
The two
loadingattributes are a preload, not a hint. React 19 hoists a<link rel="preload" as="image">for any<img>that is notloading="lazy", so the expliciteageris what buys the preload at both sites —MeditationTemplaterenders the player as thepage's only content, and the
VideoPlayerfallback is the only poster in the server HTML. Bothassertions were watched failing with the attributes removed.
Fixture pre-mortem. The specs assume SahajCloud sends
…/<image_id>/public. Verified againstthe real producer, not assumed:
sydevs/SahajCloudsrc/plugins/storage/cloudflareImagesAdapter.tsbuilds`${config.deliveryUrl}/${imageId}/public`.ContentCard.test.tsxhad been using the bare…/<image_id>/shape, which no read produces andwhich 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
:203linenumber 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.
getVariantNametakes literals, andMeditationPlayerre-renders at 10 Hz for the whole of ameditation, where the
Imageatom 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 handedundefinedread 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 populationand pins it rather than leaving the reason for stopping as an unchecked claim. One hazard the
move to lint inherits:
no-restricted-syntaxis a single rule id, so it shares the block thatholds the untranslated-copy selectors, and that block's
ignoresand any disable region for copysilence it too. Neither reaches an
<Image>today, and the comment says so.What a required
sizescosts, and where. 48 of the touched lines are a story or a specdeclaring a box it had been leaving to the default —
Image.stories.tsxnames the column of itsown grid,
Image.test.tsxpasses a neutral100vw. That is the price of the type, and it ispaid once. No production call site changed: all 14 already passed a
sizes, which is what madeB free at the atom. The only production length this round adds is the
content-indexgrid's.Review passes.
/simplify(4 agents) then/code-review high—pr-review-toolkitis notinstalled in a routine, confirmed with
ListPlugins. Then the adversarial review's threefindings, all built. The simplification round added
/security-review, which the trigger pathhad 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