Repository navigation
feat(translations): declare a key's English in the schema, reconciled on boot - #1218
Conversation
…te Web `OrnateTextBox` defaults its decorative side label to `'Ancient Wisdom'` from a default parameter, and the block converter passes none, so all 123 ornate blocks render that English word on every locale (sydevs/WeMeditateWeb#262). WeMeditateWeb's `no-restricted-syntax` guard selects `JSXText` and copy props, so a default parameter reaching the markup is invisible to it. The label is `aria-hidden` and rotated onto one vertical line, so it carries a 24-character advisory limit and a description telling a translator it is decoration rather than copy to render faithfully. The data migration ships the English string, which the seed reaches only on a fresh database. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjXXxqsPdZ6LuTSTsiY
|
🚅 Deployed to the SahajCloud-pr-1218 environment in sahajcloud
1 service not affected by this PR
|
|
🤖 no session running recent dispatchesWritten by the sydevs dispatcher. Sessions never edit this comment. |
`_meta.schema_version` carried the derived shape with no `post-#<n>` prefix, because the number is this PR's own and the branch is pushed before it exists. Eleven of the twelve translations seeds spell it `post-#<n>` against a SahajCloud number, so an unnumbered one leaves a later reader no commit to read. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjXXxqsPdZ6LuTSTsiY
`sidetext` defaulted to `'Ancient Wisdom'` in a default parameter, and the block converter passes none, so all 123 ornate blocks rendered that English word on every locale. `no-restricted-syntax` selects `JSXText` and copy props, so a default parameter reaching the markup was invisible to it. The label now reads `blocks.general.wisdom_sidetext`. `??` rather than `||`, so an explicit empty string still suppresses the decoration rather than falling through to the translation. The two generated files carry the key by hand, because neither generator can see a key that is not on SahajCloud's `main` yet: sydevs/SahajCloud#1218 adds it, and the contract sync re-derives `server/payload-types.ts` when that merges. Answers the sidetext question thread on #269 — option B (Ardnived). Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjXXxqsPdZ6LuTSTsiY
sydevs-bot
left a comment
There was a problem hiding this comment.
🧐 Adversarial review
Every claim in this body checks out, and the change is as small as one key can be. What I would push back on is not in the diff — it is that the diff exists. This is the third verbatim per-key copy migration in 48 hours, and the next key implies a fourth. The generic English default #1216 proposed belongs here, not in a fourth PR.
One thing went stale after you opened this. WeMeditateWeb#269 merged at 04:01Z, 15 minutes after this PR opened, so "Merge this before sydevs/WeMeditateWeb#269" now reads backwards. Nothing breaks — the consumer falls through to its committed English mirror, the pre-existing behaviour — but that bullet is the first thing a reviewer reads.
Findings
should-fix— the per-key copy migration is the wrong unit; build the generic default instead (src/migrations/20261119_040000_wm_web_wisdom_sidetext.ts:25).
What was checked
20261119_040000…jsonis byte-identical to20261118_231500…json, as claimed.maxLengthis advisory:stringsSchemaemits it only forstrict === true(src/fields/translationsField.ts:238).- 14 tabs / 25 leaf groups / 197 keys on the branch, matching
_meta.schema_version. - Consumer:
OrnateTextBox.tsx:113on WeMeditateWebmainreadst('blocks.general.wisdom_sidetext'), withsidetext?as a per-block override. A translations key is the right mechanism here, not a block field. - Preview link answers
ON_HOST; nofixture.surfacePathstouched;src/fixture/views.ts:350-351is theTranslationsRow→globalDoc('wm-web-translations')link it claims. BLOCKS_GENERALandaddKey'svalueparameter are single-use indirection, held to match the two siblings. Weighed, not flagged.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
|
No code changed. One thread answered, one false note in the body corrected, nothing pushed. Asked, left open — the per-key copy migration. The generic English Corrected — the body told you to merge this before sydevs/WeMeditateWeb#269. That PR merged at 04:03:51Z, 17 minutes after this one opened, with both generated entries hand-typed. Nothing broke. Until this deploys, that site reads its committed English mirror and every locale still shows Nothing pushed. The branch is level with 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
…ons-wisdom-sidetext #1246 retired this global's ten a11y sub-groups, so the seed's `_meta` prose and its quoted shape both moved under this branch. The conflict is `_meta` alone: main's wording is the true one — no a11y key is declared here any more — and the shape it quotes gains this branch's one key, 13 tabs, 13 leaf groups, 98 declared keys. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjYqULZrbvhm9F3pwHY
|
Merged #1246 dropped this global's ten Nothing else conflicted, and nothing semantic did: Lean gate green, 3863 unit tests. 48 integration cases green across the three translations specs. The body's shape bullet and unit-test count are updated to match. 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
main's #329 re-ran `pnpm types:cms` against SahajCloud main (#1246), which dropped the ten a11y interfaces and the video tab. This branch's hand copy of the contract still carried them, so every one of those groups conflicted. Resolved to main's generated output plus only the shapes this branch's code needs from the unmerged sydevs/SahajCloud#1232: `blocks.live_session`, `blocks.general.days`, `SplashBlock.event` and `ClassDirectoryBlock`. The a11y groups stay dropped — #328 moved those strings into lib/i18n/a11y/, so nothing here reads them from the CMS. `wisdom_sidetext` is re-typed because its own `shortcut:` marker says a contract sync drops it until sydevs/SahajCloud#1218 lands. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjVeQVCd9NZbNZ37XVL
One conflict, in `seeds/wm-web-translations/data.en.json`'s `_meta`: both sides re-stamped `schema_version`, and this branch also extended `source`. Kept this branch's `source` sentence — it names the four mood-finder keys, which main has no reason to mention — and derived the counts from the merged schema: main's `post-#1218 (13/13/98)` plus these four keys is `post-#1223 (13/13/102)`. `tests/unit/translations-seed-meta.spec.ts` derives all three, and passes. #1218 landed on main while this branch waited, so a new key's English is now declared as `default` in `translationsSchema.json` and reconciled on boot. These four keys declare none and stay in the corpus file plus this branch's migration, which is what `tests/unit/wm-web-translations-seed.spec.ts` requires of a key with no default. Whether to convert them is asked on the PR. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjZPhoz9ErHoiLegKGi
…tdown-directory main's #1218 added `blocks.general.wisdom_sidetext` and the `default` keyword that declares a key's English in the schema. Both sides only added, so all three conflicts keep both. - `blocks.general` carries this branch's `days` and main's `wisdom_sidetext`, the countdown labels still together. `blocks.live_session` stays, and the tab description is main's, which names the Ancient Wisdom text box. - `_meta.schema_version` is re-derived rather than merged: 13 tabs, 14 leaf groups, 105 declared keys, as `translations-seed-meta.spec.ts` counts them. - `src/payload-types.ts` is `pnpm generate:types` on the merged tree. The seven new keys declare no `default`, and that is the convention rather than an omission: #1218 refuses a key that sits in both the schema and the corpus file, and these ship their English in `seeds/wm-web-translations/data.en.json`. So `20261119_231000_wm_web_live_session_copy` is still what reaches a database that already holds the global. No snapshot heal this time. main has added no migration since the last merge, so `migrate:create --skip-empty` on the merged tree wrote nothing. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjVZBi3r2prvzbsmPpM
Summary
blocks.general.wisdom_sidetextis the first to use it.Change outline
A new key's English used to reach production through a hand-written data-only
migration — three near-identical ones in 48 hours, differing only in a table
pair, a key and a value. The declaration moves beside the key, and one generic
pass puts it where the per-key migrations used to.
Contract — the key declares its own English
wm-web-translations · blocks · general src/globals/WeMeditateWebTranslations/translationsSchema.json wisdom_sidetext: type: string maxLength: 24 # advisory: it stands on its side in one line + default: Ancient Wisdom # the English, declared oncedefaultis a standard JSON Schema keyword and is still kept out of theemitted schema: Ajv writes a declared default into the data it validates under
useDefaults, so emitting it would make a save store copy nobody typed.stringsSchemabuilds its properties explicitly, so there is nothing to strip.Flow — two readers, one declaration
Both statements are one
UPDATEper leaf-group column:defaults || stored— the right operand wins, so a word somebody chosesurvives and only an absent key takes the default.
?&test keeps the write off a row with nothing to gain. A no-opUPDATEstill writes a row version, and this runs on every boot.jsonb_typeofkeeps a scalar column out, where the concatenation wouldbuild an array and void the whole group.
committed source; the values are bound parameters.
Scope — what this does not change
A default lands only where nothing is stored, so retiring a key and
rewording stored copy are both still migrations. The 400-odd keys already in
data.en.jsonstay there: the corpus is unchanged, and a key declaring adefaultis kept out of it so the two cannot disagree.Preview
The diff touches none of
fixture.surfacePaths, so it adds no fixture record. The admin view it changes is already a fixture link target (src/fixture/views.ts:350-351,TranslationsRow→globalDoc('wm-web-translations')).Contract impact
src/payload-types.tsgainswisdom_sidetext?: string, unchanged by this revision —defaultnever reaches the emitted JSON Schema, so it generates no type. sydevs/WeMeditateWeb is the consumer; itspnpm types:cmsreads this repo'smain, so the dispatcher's contract sync re-derives it once this merges. sydevs/WeMeditateWeb#269 merged with the entry hand-typed and says so in its own body. No consumer issue is owed.Test results
.claude/skills/pr-prep/check.sh— lint, format, typecheck, typecheck:tests, 3863 unit tests (143s), on the branch merged with currentmaintests/int/translations-english-defaults.int.spec.ts(new),tests/int/translations-globals.int.spec.tsandtests/int/wm-web-translations-seed.int.spec.ts, on the same merge. Unit:tests/unit/translations-english-defaults.spec.ts(10, new),tests/unit/wm-web-translations-seed.spec.ts,tests/unit/translations-seed-meta.spec.tsManual verification
blocks.general.wisdom_sidetextreadsAncient Wisdom. The boot reconciliation is what puts it there, and the deploy log carries nothing for it — it is a plainUPDATE, not a migration.Notes for reviewer
payload_migrationsrow naming a file that no longer exists. Payload walks the files and ignores such a row — boot,migrateandmigrate:statusall do (src/migrations/AGENTS.md), so the preview needs no reset.survives the next ordinary save of the globalfail withundefined; reversing the merge tostored || defaultsmakesfills the absent key of a column whose other key is storedreturnDeclared Hoursover the storedHours. Both are in the new integration spec, and the second builds its own two-key target because the shipped schema declares one default per column.tests/int/translations-english-defaults.int.spec.tsagainst Postgres, including the version row. CI runs it.src/payload.config.tsmatchessecurityReview.triggerPattern. The sweep readenglishDefaults.ts, thesrc/andseeds/diff,quotedDbSchema,stringsSchemaand drizzle'ssqlbuilder, and settled that everysql.rawinput is committed source and the declared copy is a bound parameter.maxLength: 24is advisory and derived, not measured in a browser. The label is[writing-mode:vertical-rl] whitespace-nowrapattext-2xlwithtracking-[0.12em], in a block at least80vhtall, so roughly 22 characters fit at an 800px viewport height. It is a warning in the admin, not a refusal — nostrict: true— because an over-long translation makes the decoration ugly rather than breaking the layout.common.a11y.menu), chore(translations): drop WeMeditate Web's unused video tab #1217 (thevideotab dropped) and refactor(translations): no global declares a screen-reader-only string #1246 (the ten a11y sub-groups dropped) are onmain, so_meta.schema_versioninseeds/wm-web-translations/data.en.jsonnow readspost-#1218 (13 tabs, 13 leaf groups, 98 declared keys)— main's 13/13/97 plus this PR's one key.tests/unit/translations-seed-meta.spec.tsderives all three numbers from the merged schema and passes. The schema file itself merged without a conflict every time: each of those changes and this PR's new key touch different objects.main(20261118_233000_wm_web_menu_key), the third of its kind. This PR's would have been the fourth, and is deleted. The three already applied are frozen history; this convention retires the next one.Detail
Why
onInitrather than a job or a generic migration. A migration runs once ever, so one written generically would still miss every key added after it. A job needs a queue tick and would reach production minutes late, after the first client read of the new key.onInitruns afterprodMigrationson every boot, which is exactly the moment the schema declaring the key and the database that lacks it first meet. It is also whereseedPreviewAdminalready reconciles, for the same reason.Why it never throws. The call is wrapped and logged: a database missing a word is a better outcome than a CMS that will not boot. The log line is
English translation defaults not reconciled.Why blank is not a gap for the boot pass. It runs on every restart, so filling a blank English value would overwrite an operator who deliberately emptied one, again and again. The seed importer does treat blank as absent, because
pnpm seed translationsis a deliberate act somebody ran.Why the registry sits in
src/globals/index.ts. Nothing but the master barrel may import from a global's folder (src/globals/AGENTS.md), and both readers — the boot pass and the seed — need all three globals at once.Not done here.
EMAIL_STRING_DEFAULTS(src/lib/translations/emailStrings.ts) is the same idea for one Atlas group, hand-maintained beside the schema, and could now derive from it. That is a separate change to a group holding live production data, and this PR does not touch it.🤖 Generated with Claude Code
https://claude.ai/code/session_01Mg9rjVWFbaN8WP9sHe8iQp