Repository navigation
fix(image): print image credits, and draw gallery tiles and uploads uncropped - #312
sydevs-bot wants to merge 12 commits into
Conversation
SahajCloud's `images.credit` ("Attribution or copyright information") never
reached the browser: `IMAGE_POPULATE` did not select it, and neither the
upload converter nor the image gallery had a slot for it. 13 of 574 images
carry one, and four English upload nodes reference a credited image: the
two paintings on /history-of-meditation (which the legacy site credited
under the image), /footsoaking and /meditation-works-better-together.
The page read alone selects it (`PAGE_IMAGE_POPULATE`): no other read
renders a credit, and the config's images are serialised into every page.
`populatedImage` trims it and treats the "" SahajCloud stores for an unset
credit as none.
`ImageCredit` prints it as `<small>` under the image, above any caption,
where the legacy `.cb-image-media__credit` sat on narrow screens, in the
muted surface colour: the legacy `#c6c6c6` (our gray-400) is 1.7:1 on
white. The legacy "Credit •" prefix needs a translation key SahajCloud does
not have yet, so the credit prints bare.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjZcE8bs5uRJ6dsg6kw
The gallery converter handed the Image atom only the nearest of five
landscape or square ratios, so a portrait tile was cropped to a square box.
On the live galleries 32 of 41 images are portraits (ratio 0.52-0.90) and
lost 10-48% of their height. The legacy gallery drew them uncropped.
A tile with known dimensions now renders in natural flow
(`forceAspectRatio={false}`), its `width` and `height` attributes reserving
the box, so nothing shifts on load (CLS on the sculpture gallery measured
0.0001 -> 0 at 375px and 0.0005 at 1280px, before and after). The snapped
ratio still picks the srcset ladder, so the variants requested are the same
as before. A tile without dimensions keeps the fixed box, the one case
attributes cannot reserve.
Variable tile heights leave the gallery's CSS columns ending unevenly; the
column order itself is unchanged.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjZcE8bs5uRJ6dsg6kw
The `upload` and `image-gallery` converters drop an image reference that did not populate, which is right, but they drop it silently, and server/AGENTS.md asks for a Sentry warning on every dropped reference so the data gap stays visible. Live, /sushumna carries one in both English and Brazilian Portuguese: its upload points at image 377, which no longer exists, and the depth-3 read returns the node's value as `null`. `getPageBySlug` now walks the page body after a public read and reports every image that `populatedImage` rejects, the same test both converters apply. It logs on every render and sends one Sentry warning per distinct (page, locale, dropped refs) per isolate, bounded like `getWebConfig`'s `reportedConfigGaps`. The locale is part of the key because `pages.content` is localized, so each locale's dangling reference is a separate fix, and a deleted image reads as `null` whichever locale holds it. A preview read reports nothing: the editor is looking at the page, and a draft's gap is not yet a visitor's. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjZcE8bs5uRJ6dsg6kw
The upload converter had the gallery's snapping bug: it handed the Image atom only the nearest of five landscape or square ratios, so a portrait was cropped to a square box. Live, 31 of 60 English rich-text uploads lose more than 5% of the image, among them the credited 800x1652 Ma Lin scroll on /history-of-meditation, cut in half (432x432 instead of 432x892 at 1280px) under the credit an earlier commit prints. The legacy site drew it whole. An upload with known dimensions now renders in natural flow, as gallery tiles do, with `w-full` so a small image still fills its figure. Its `width` and `height` attributes reserve the box (CLS on /history-of-meditation measured 0.108 -> 0.092 at 375px and 0.0037 -> 0.0018 at 1280px). The snapped ratio still picks the srcset ladder, and an upload without dimensions keeps the fixed box. This goes beyond the bundle's literal gallery scope and is its own commit, the last on the branch, so it can be dropped alone. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjZcE8bs5uRJ6dsg6kw
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
wemeditate-design | da16969 | Commit Preview URL Branch Preview URL |
Nov 25 2026, 07:10 PM |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
wemeditate-web | da16969 | Commit Preview URL Branch Preview URL |
Nov 25 2026, 07:10 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 title's three facts belong together, and each is measured. server/AGENTS.md asks for the dropped-image warning outright, so nothing here is smuggled. The ratio fix is sound: a variant in this repo is width=<n> only, so aspectRatio never cropped, and Tailwind preflight's height: auto holds the attribute ratio once the box goes.
What it does not do is reuse what the repo has. Ten bespoke pieces land for a three-fact change, and four have an owner already: warnOnce, populatedImage, and this folder's lexical-helpers.ts. The branch is also 19 commits behind main, and #305 merged after its base — so "a shared bounded-warning helper" under Not in this PR is now a deletion, not a follow-up. Rebase before the next push: #313 makes any lint warning fail the gate.
Findings
Five should-fix, one thread each:
server/dropped-images.ts:88— the dedupe memo re-implementswarnOnce.RichText.tsx:36— a second type namedPopulatedImage.ImageCredit.tsx:16— a one-element<small>wrapper.lib/content-blocks.ts:218—imageCreditfolds into its last caller.server/sahajcloud-client.ts:216—PAGE_IMAGE_POPULATEhas one caller.
What was checked
Read whole: the four RichText modules, content-blocks.ts, cloudflare-images.ts, atoms/Image/Image.tsx, dropped-images.ts, and sahajcloud-client.ts's populate region; server/AGENTS.md and error-utils.ts on main. Contract: credit is already in the synced ImagesSelect (payload-types.ts:4715), so no SahajCloud change. Streamliner: 8 pieces covered, 3 kept, 6 returned, 5 posted — I dropped the DroppedImage → string[] rewrite, since the structured extra.dropped is what an editor queries. No ticket is linked, so the body was the standard; every path it names exists.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
`server/AGENTS.md` names `warnOnce` as the volume bound for a new warning on a read. It reached main with #305, after this branch's base, so the memo here was a second implementation of it. The dedup key, the per-render `console.warn` and the Sentry level are unchanged. The cap moves from 64 gaps to `warnOnce`'s 128 per source. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjYS6tjaST5e7ETsP68
`lib/content-blocks.ts` already exports a `PopulatedImage` and resolves a ref to it, credit and aspect ratio included. The upload converter carried a second type of the same name, and this diff was adding `credit` to both. Drops the local interface, the two-step populated/url guard, and the `imageCredit` and `nearestAspectRatio` imports. Same render. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjYS6tjaST5e7ETsP68
`ARTICLE_CLASS`'s JSDoc records that this repo dropped its `Text` atom as overengineered, and `lexical-helpers.ts` already holds this folder's class helpers. A one-element `<small>` wrapper whose `className` carried one caller's `mb-1` was the same shape again. `IMAGE_CREDIT_CLASS` joins the other helpers, and both converters render the `<small>` themselves. Same markup. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjYS6tjaST5e7ETsP68
Once the upload converter resolves through `populatedImage`, the exported helper has one caller, in its own file. The why moves to the `credit` field's JSDoc, which is where a reader of the type now meets it. `content-blocks.test.ts` already asserts the trimming through `populatedImage`. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjYS6tjaST5e7ETsP68
`PAGE_IMAGE_POPULATE` had one caller and no second in sight. Adding `credit` to `IMAGE_POPULATE` itself is the other fold, but the config read's own test pins it to not select one. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjYS6tjaST5e7ETsP68
|
All five critic threads adopted, one commit each. Nothing rebutted, nothing asked.
Lean gate on Body refreshed. #307 now also conflicts in 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
#327's reorg deleted `server/sahajcloud-client.ts` and split it, so this branch's two edits to it move to where they now live: the page populate's `credit` entry to `server/sahajcloud/selects.ts`, and the public-read `reportDroppedImages` call to `server/sahajcloud/pages.ts`. `server/dropped-images.ts` stays at the `server/` root beside `error-utils.ts` — it reports on a read rather than making one — and its imports take the new `lib/content/` paths. `server/dropped-images.test.ts` now mocks `@sentry/cloudflare`: main moved `error-utils.ts` off `@sentry/react` once the browser-shared error classifier left for `lib/errors/error-type.ts`, so the old mock silenced `warnOnce` and three tests saw no report. The three RichText conflicts were import regions only. Each takes main's `@/` paths and keeps this branch's additions: `populatedImage`, `IMAGE_CREDIT_CLASS`, and `@/tests/_helpers/markup`. `nearestAspectRatio` goes, because the upload converter no longer snaps a ratio. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjZ7B98X5hBMvxoq1m4
|
Merged
One hunk was not textual. Main moved The three RichText conflicts were import regions only. Lean gate on 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
#341 moved `slugify` out of `lexical-helpers` into `lib/urls/slugify`, and this branch added `IMAGE_CREDIT_CLASS` to the same import. The list keeps both: the credit class from here, the slug module from main. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjWoXwc2UgVbP35ujsy
|
Merged #341 moved Lean gate on 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
Summary
enandpt-br.Preview
maindraws all eight as squares.What changed and why
Four commits of work, then a merge of
mainand five review fixes. The upload-ratio commit is optional (beyond the bundle's literal scope), but it is no longer last, so dropping it alone now needsgit revert e35b0ec.server/sahajcloud-client.ts:228;lib/content-blocks.ts:145,:165)PAGE_POPULATEspreadsIMAGE_POPULATE.imagesand addscredit. Live preview gets it too, throughdocumentReadArgs('pages'). The config, lecture and meditation reads are unchanged.populatedImagetrims the value and treats""as no credit. SahajCloud stores""on 442 of the 455 images that have the field at all. 13 of 574 images carry a real credit, and one of those ends in a trailing space.populate[images][credit]=trueis accepted (200). The page read grows by +110 B on /history-of-meditation and +108 B on the sculpture gallery.server/sahajcloud-client.test.ts'selects an image’s credit for the page’s figures, and only on the page read';lib/content-blocks.test.ts'carries a credit trimmed, and none for the "" SahajCloud stores when unset'.lexical-helpers.ts:61;RichText.tsx:201-218;blockConverters.tsx:248-271)<small class="block text-sm tracking-wide text-fg-muted">, fromIMAGE_CREDIT_CLASS.<figure class="break-inside-avoid">, and only a credited tile gets a figcaption..cb-image-media__creditis #c6c6c6, 16px, letter-spacing .3px. That grey is our gray-400, which measures 1.7:1 on white and fails AA. I usedtext-fg-mutedinstead (gray-700, 4.8:1), at 14px withtracking-wide. I put the credit under the tile rather than in the lightbox caption, because that works without JavaScript.RichText.test.tsx'prints an uploaded image’s credit in its figcaption, above the caption', 'gives a credit with no caption a figcaption of its own, and a blank credit none', and 'prints a gallery image’s credit under its tile, and nothing under an uncredited one'. The last one also checks that the class list has no trailing space (review fix).blockConverters.tsx:254)forceAspectRatio={false}pluswidthandheight. The snapped ratio still picks the srcset ladder, so the variants requested do not change. A tile without dimensions keeps the fixed box.nearestAspectRatiodoc inlib/cloudflare-images.tsnow says the ratio picks the srcset widths, and only crops where the caller keepsforceAspectRatio.server/dropped-images.ts; call siteserver/sahajcloud-client.ts:442)droppedImageswalks the Lexical tree forimagesuploads and image-gallery items thatpopulatedImagerejects, the same test both converters use.reportDroppedImageslogsconsole.warnon every render and handswarnOnce(server/error-utils.ts) the signatureslug|locale|refs, which sends one Sentry warning per distinct gap per isolate and caps the memo at 128 per source.getPageBySlugread, never under preview.pages.contentis localized, and a deleted image reads asnullin every locale. Under the old key thept-brgap on /sushumna was silenced. I re-checked live:enandpt-brboth reference 377.server/dropped-images.test.ts(8 tests, including 'reports the same gap once in each locale that carries it') andsahajcloud-client.test.ts'reports an image the page body drops, on a public read only'.RichText.tsx:210-213): the same ratio fix for rich-text uploads, plusw-fullso a small image still fills its figure.aspect-videoassertion was updated to match.warnOnce; the upload converter resolves throughpopulatedImageinstead of a second type ofthat name;
imageCreditfolds intopopulatedImage; the credit's classes areIMAGE_CREDIT_CLASSinlexical-helpers.tsinstead of anImageCreditwrapper component; andPAGE_IMAGE_POPULATEis inlined. Four pieces fewer, and no change to the rendered markup orthe query.
Not in this PR
media.general.image_credit= "Credit • %{credit}", used by the upload converter and theimage-galleryconverter. Until it exists, the credit prints bare.focalX/focalY). It is moot now that tiles with dimensions are not cropped.creditis Turkish ("Ma Lin, 13. Yüzyıl"). The legacy English is "Ma Lin, 13th Century".Reconciled with open PRs
RichText.test.tsx— both branches add atests/_helpers/markupimport. Earlier the merge was textually clean but produced duplicateclassOf/openTagdeclarations (TS2300) and failed the whole RichText suite; it is now one conflict region instead.RichText.tsx— both branches rewrite the single-line./lexical-helpersimport into a list. feat(components): embedded technique pages draw numbered cards, and quotes keep their line breaks #307 addscardHeadingLevel,cardRunandpageCard; this branch addsIMAGE_CREDIT_CLASSand dropsnearestAspectRatio.git merge-tree) cleanly against this head: feat(server): legacy redirect map and lookup for the wemeditate.com cutover #276, feat(server): switch wemeditate.com over to the new site #288, feat(components): a MeditationLibrary for the meditations index block #293, fix(i18n): a key SahajCloud lacks renders the English mirror, not its key path #300, fix(components): popovers are disclosures or dialogs, and a closed Accordion panel is hidden #302, feat(pages): editor-picked discover actions close the home, featured and knowledge pages, with a share row on the rest #311, feat(components): a loader over the lead splash, and a place search for the map-search splash #316, refactor(components): remove the unused Spacer and Box atoms and dead exports #318, feat(textbox): draw the old site's triangle, wash and leaf-circle ornaments on text boxes #319, feat(components): count down to a live class and place the directory #321, refactor(server): a folder per route, under server/routes #326.mainitself, inMasonryGridandContentGrid— files this branch does not touch.server/sahajcloud-client.tsand rewrites the three RichText modules. It conflicted with this branch before these fixes too.imagespopulate entry sits insidePAGE_POPULATE, and thedropped-imagesimport is after the last import line.e370a55in (after feat(components): add a mobile menu, and make the compact bar the phone's header #283 and fix(ci): any lint warning fails the gate, and the repo is formatted to pass it #313 merged), rather than rebasing.Test results
Lean gate:
.claude/skills/pr-prep/check.shon head2e9455b, after mergingmain.tsc --noEmit: clean.pnpm build: passed one35b0ec, before the merge. Not re-run; CI runs it.🤖 Generated with Claude Code
https://claude.ai/code/session_01Mg9rjZcE8bs5uRJ6dsg6kw