Repository navigation
feat(translations): add the keys WeMeditate Web still hardcodes - #925
Conversation
Two WeMeditate Web components render English as literal JSX because `wm-web-translations` declares no key for the copy, so each site sits behind a commented `eslint-disable` (sydevs/WeMeditateWeb#165, #178). A new `discover` tab carries the home page's closing call to action: eight visible strings under `general`, the English taken from the component's own defaults and literals. The three choice titles sit side by side in equal columns, so each carries an advisory `maxLength` of 24. `meditation.general` gains `upsell_web`, `upsell_app` and `upsell_app_link` for the embedded player's message back to the full site. `%{link}` is the link the sentence wraps, as `errors.general.status_page_hint` already does. `upsell_web`'s link text is the bare domain, a brand name rather than a translation, so it gets no key. `discover` declares a lone `general` sub-group where a tab with no screen-reader copy has so far stayed flat (`navigation`, `footer`). The nested form is what the ticket specifies and it is also the cheaper shape: an `a11y` group added later costs nothing, while promoting a flat `discover` column to `discover_general` would be a rename. Only the new column needs DDL. The three upsell keys live inside the existing `meditation_general` jsonb blob. Closes #917 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01TivXo7AWF8YzA76JaL9W4h
Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01TivXo7AWF8YzA76JaL9W4h
…wn counts `translations-globals` asserts the wm-web tab labels and the ordered leaf-group set with `toEqual`, so both went red on the new tab. They are meant to: an exact set is what catches a sub-group dropped from the schema, so they are extended rather than loosened. `_meta.schema_version` in the seed file quotes three counts that were hand-written and derived from nothing. A key added without touching that line left a confidently wrong number, which is what happened to the `13 tabs / 24 leaf groups / 181 keys` it carried. The new case derives all three from the schema and compares. Confirmed red first, against a leaf-group count off by one. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01TivXo7AWF8YzA76JaL9W4h
Two review findings on the descriptions, which are the only context a translator ever gets. The three title keys told the translator to "keep it short" beside a `maxLength` the admin row already renders as a live counter. The reason the limit exists — three titles in equal columns — is the part they cannot re-derive, so only that stays. Neither existing advisory limit in this schema exhorts; the two that do are `strict`, where over-length refuses the save. `upsell_app_link` named what the link points at but dropped the instruction its own precedent carries: `errors.general.status_page_link` says "Translate as a noun phrase, not a sentence". The English "free app" also sits after a possessive that lives in the other key, which leaves an inflecting language no cue about case or gender. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01TivXo7AWF8YzA76JaL9W4h
The sub-group rule read as "both `general` + `a11y`, or neither", and `discover` is now a third shape the paragraph did not describe — a contributor following the text would have made it flat. It says which to prefer and why, so the schema and the rule stop disagreeing. The coverage row still claimed twelve tabs. It was already a tab behind before this change, from the `video` tab in #775. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01TivXo7AWF8YzA76JaL9W4h
|
🚅 Deployed to the SahajCloud-pr-925 environment in sahajcloud
1 service not affected by this PR
|
sydevs-bot
left a comment
There was a problem hiding this comment.
🧐 Adversarial review
The diff is the size of #917 and no larger: eleven keys, a generated migration, a generated type block, and the data-driven seed. It adds no helper and no new mechanism — maxLength without strict is the platform's advisory path, and upsell_app + upsell_app_link copies the status_page_hint pair already next door. The snapshot carries exactly discover_general and version_discover_general, and down drops both.
One real finding, and it comes from the consumer. The three maxLength: 24 descriptions tell translators the titles sit in equal columns; DiscoverMeditation.tsx renders a wrapping centred flex row of intrinsically sized cards. That text is a translator's only context, so a wrong layout claim in it is a product defect, not a comment nit.
Findings
- should-fix —
translationsSchema.json:200— "equal columns" is not what the consumer renders. - consider —
tests/unit/wm-web-translations-seed.spec.ts:126— 31 lines guard a count that has never drifted. - consider —
src/globals/AGENTS.md:152— "likely to grow one" is not a checkable rule.
What was checked
- #917 against the diff. All four acceptance criteria met.
- Consumer,
WeMeditateWeb@main:DiscoverMeditation.tsxlayout and its default-proptitle/subtitle, andMeditationPlayer.tsx:817-838— both sentences and the link text match the seed exactly. translationsField.ts:maxLengthreachesjsonSchemaonly whenstrict, so no Ajv keyword leaks.- Snapshot diffed against
20260929_173315: two columns, plus a newid. The zeroprevIdis this repo's norm — all 78 carry it. - Counts re-derived: 14 tabs, 25 leaf groups, 192 keys.
main's were right too. - Only
data.en.jsonexists underseeds/wm-web-translations/, so no registry needs the group.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
The three title descriptions claimed the titles sit in equal columns. `DiscoverMeditation.tsx` renders a wrapping, centred flex row of intrinsically sized cards — no grid, no fixed widths — so a long title widens its own card and can push the row to wrap. That sentence is a translator's only context, so a wrong layout claim in it is a product defect rather than a comment nit. The replacement says what the layout does and why staying under the advisory limit matters. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01FhEzb5tZVfhL9d12YQ8ykr
"Prefer the lone `general` where a tab is likely to grow one" asks the next author to predict, and gives them nothing to check. It also weakens the two sentences before it: the cost asymmetry already says to nest, since promoting a flat tab to `<tab>_general` is a column rename while adding `a11y` beside an existing `general` is a new column. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01FhEzb5tZVfhL9d12YQ8ykr
|
Addressed all three review threads. Pushed 5450bb7. Adopted
Rebutted
Filed #926 — extend that assertion to the other two seeds, and correct the Atlas counts. Out of scope here. Lean gate green, 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
Summary
eslint-disableregions.discover_general. The three upsell keys ride the existingmeditation_generalblob.Change outline
The keys a client reads from
GET /api/globals/wm-web-translations.discoveris a new tab, between Errors and Article; the upsell keys join an existing group.Types
Each leaf group's JSON column declares its own shape, so the new group gets a named interface rather than an index signature.
Preview
Migration
src/migrations/20261011_194449_wm_web_discover_translations.tsdiscover_generaltowm_web_translations_localesandversion_discover_generalto_wm_web_translations_v_locales. TwoADD COLUMNs, no data read or written.downdrops both. They hold nothing until the seed or an editor writes them.Contract impact
src/payload-types.tsis acontractSyncsource for WeMeditateWeb (server/payload-types.ts) and SahajAtlasWeb (src/types/payload/payload-types.ts); a bot PR re-syncs both after this merges. The consumer wiring is sydevs/WeMeditateWeb#165 phase 3, which is also gated on #918.Test results
lint,typecheck,typecheck:tests,test:unit(2307 passed)translations-globals36,translations-field26,wm-web-translations-seed7 int + 9 unitManual verification
max 24 characterscounter on the three choice titles, and the Meditation tab three new upsell rows.pnpm seed translations. The migration adds the column; it does not fill it. Until the seed runs, the English values do not exist in production, soclientEnglishFallbackhas nothing to merge and a client read returns the new keys blank.Notes for reviewer
discovernests a lonegeneralwhere a tab with no screen-reader copy has so far stayed flat (navigation,footer). This is what feat(translations): add the keys WeMeditate Web still hardcodes #917 specifies, and nesting buys a latera11ygroup for free — flat would need a column rename. Flat is defensible; a review pass argued for it, citing20260608_145829.tsas a cheap rename precedent.src/globals/AGENTS.mdnow names both shapes, so the rule no longer reads as "both or neither". Say if you want it flat.maxLength: 24is headroom, not a measurement — the longest English is "Classes Near Me" at 15. Advisory, notstrict, so an over-length string still saves, and nothing clips: the consumer sizes each card to its own text, so a long title widens its card and can wrap the row. Say if you want itstrict.discover.general.titleandsubtitlereplace default props, not JSX literals, and the consumer's lint selectors do not match a default parameter — its own disable comment covers only the six card strings. feat(translations): add the keys WeMeditate Web still hardcodes #917 lists all eight, so both are declared here. If a page or CMS content ends up owning that heading, those two become dead CMS copy in every locale. Consumer's call, flagged rather than decided.discover) rather than the page it closes (home), per feat(translations): add the keys WeMeditate Web still hardcodes #917. A second home-page string would have nowhere natural to go.maxLength(the row-wrapping cost is the titles'; a subtitle sits under its title in the same card, and "one line on screen" is slot context rather than a bound). Nopreviewtarget on the tab — onlymapdeclares one, and adding panel behaviour is outside the ticket.Detail
Review. No
pr-review-toolkiton this routine, so the pass was/simplify's four lenses plus the deterministic comment lint ("no banned comment added"). Findings acted on: two staletoEqualsets intranslations-globals(also caught locally by running the spec), the redundant "keep it short" clause, the missing inflection cue onupsell_app_link, the unpinned_metacounts, and the AGENTS.md paragraph the new shape contradicted.tests/COVERAGE.mdsaid twelve tabs — already a tab behind from #775, fixed here since it is the same row.The new count assertion was confirmed red first, against a leaf-group count off by one, then restored. The same check was run on the seed-coverage spec by blanking
upsell_app_link: it failed naming that path, which is what establishes the 11 new keys are really covered rather than passing over an empty walk.Column budget.
findGlobalbuilds onejson_build_array()per nested relation, and Postgres caps a function call at 100 arguments — the reason this schema packs a leaf group's strings into one JSON column.wm_web_translations_localesgoes from 26 to 27 arguments;wm_app_translations_localesis the nearest bound at 52. No concern, recorded so nobody re-derives it.Fixture pre-mortem. No new fixture. The seed specs read the real
seeds/wm-web-translations/data.en.jsonand the real schema, and the integration one runs the realTranslationsImporteragainst a database — which is what proves Payload's per-column JSON Schema accepts the new keys, since an undeclared key fails on write rather than in review.Anomaly.
pnpm db:migrations:createlogged a nodemailerETIMEDOUTwhile booting the config — no SMTP host is reachable from this sandbox. It did not affect the generated migration.Closes #917