Repository navigation
fix(status): Launch Readiness reports a locale as ready off the English fallback - #997
Conversation
…sh fallback Every non-English locale carries `fallbackLocale: 'en'`, so a section read that named no `fallbackLocale` resolved the English value and a check described "for this locale" passed on it. Six of the seven sections read that way, which made "Meditation assigned" and "Article translated" green for 18 locales in which no Path Step has been translated at all. Each section's `prepare` now passes `fallbackLocale: false` wherever one of its checks reads a localized field, and every read in the global hands the Local API a `localeIsolatedReq` copy. `createLocalReq` assigns `locale` and `fallbackLocale` onto the request it is given, so forwarding the shared one let a section decide what the sections after it resolved — in whichever order Payload runs the virtual fields' `afterRead` hooks. Lectures keeps the fallback, and says why: no check there reads a localized field, so it resolves only the row labels. Pages and User Choices do read one, so their labels get their own fallback read rather than degrading to `#42` on a screen an operator acts on. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01QaWaWVrTnDo4vJWqYfUi2m
…onto the row Review pass over the locale-scoping fix. Four changes, none of them a behaviour change to what the report answers: - `runSection` copies the caller's request once per section. Payload awaits every virtual field's `afterRead` in one `Promise.all`, so the sections run concurrently on one request, and `find` destructures `locale` and `fallbackLocale` off it after its own await — a sibling read can land an assignment inside that window. The invariant belongs to the machinery; a section's own reads still copy wherever they differ from each other. - The fallback title is merged onto the row in `prepare` instead of being threaded as a second channel. `labelOf` then needs no argument it did not already have, and no group evaluator carries a label map it only indexes by an id it holds. - Both label reads select `title` alone and run beside the read they used to wait for. The user-choices one dropped a `where` built from its sibling's rows, which was the only thing forcing it to wait. - `getWmAppConfig` uses the shared `memoizeOnRequest` rather than its own copy of that logic, including the rationale. `DocumentReport.label` now owns why a check and a label want opposite locale policies, so neither section restates it. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01QaWaWVrTnDo4vJWqYfUi2m
The nested-read rule said to skip the `req` copy when the nested call uses the caller's own locale. That is the case #982 bit: concurrent reads on one request repoint each other between `createLocalReq` and the operation's own read of the flags, whatever locale each names. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01QaWaWVrTnDo4vJWqYfUi2m
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
|
🤖 no session running recent dispatchesWritten by the sydevs dispatcher. Sessions never edit this comment. |
`main` moved under this branch: #978 made `lessons.title` and `lessons.panels` localized. The merge therefore turns two of this PR's own assertions false, and CI failed on `expect(fr['panels-set']).toBe(true)`. Both changed checks are now right to report red at a locale with no panels and no title of its own, so the spec says so. The label is the part that needed code: `labelOf` reads `title`, which the section's `fallbackLocale: false` read now nulls, so every Path Step row rendered as `#42` at an untranslated locale — the defect this PR fixes for Pages and User Choices, arriving in a third section. `lessons` joins `readFallbackTitles`, and the fallback title stays out of the documents the checks read so `lesson-title-set` keeps answering per locale. Watched failing first: with the label taken from the per-locale read, the case reports `expected '#1' to be 'English-only lesson'`. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_016kz4f18hn5u39scrC3FDut
|
Two statements in the body above are superseded by that merge:
Watched failing first: with the label taken from the per-locale read, the case reports 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
sydevs-bot
left a comment
There was a problem hiding this comment.
🧐 Adversarial review
The fix matches its ticket: refuse the locale fallback wherever a check reads a localized field, at every read the ticket lists, with lectures as the one documented exception. I checked it — no check there reads a localized field. The two label reads go past the ticket's list and earn it: refusing the fallback nulls a localized title, so those rows would have read #42. The diff is no larger than the problem, and touches no cross-repo contract.
One shape question: the isolation ships twice. runSection copies per section, and every read copies again. Only the second is load-bearing.
Findings
should-fix—runSection's per-section copy is redundant with the 12 per-readisolatedReq(...)calls. One layer should go.src/lib/status/runSection.ts:55should-fix— the body's behaviour table omitslesson-title-setandpanels-set, which this PR also turns red.src/globals/WeMeditateAppStatus/sections/lessons.ts:144consider—pages.ts's "All ten required app pages" group description:APP_PAGE_FIELDSholds 14. Pre-existing, outside a hunk, read in the admin.
What was checked
- Every "this field is localized" claim, off the collection configs. Two carry the fix:
wm-app-config's page relationships are not localized, sofallbackLocale: falseleavespages' core-page ids intact; nor isapp-cards.label, so those rows keep their labels with no fallback-title read. - All seven sections audited for a read taking the section
requncopied: none, and no groupevaluatereads. - Only
WeMeditateAppStatususesrunSection— there is no second status global to fix. - Not verified: the
Promise.alloverafterRead, andcreateLocalReq's assignment — Payload internals, nonode_moduleshere. - Both
## Previewlinks 404 on every path,/included, so the deploy is not up.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
`runSection` copied the caller's request per section and every read inside a section copied again. Only the second is load-bearing: reads within one section differ from each other, so a single copy at the seam could never cover them, and no group `evaluate` reads anything for it to guard. The machinery copy also made the isolation spec vacuous. It asserts the caller's locale and fallback survive every section in `WeMeditateAppStatusSpec.sections`, and passed off `runSection`'s copy whether or not a section's own reads took one. With it gone, dropping `isolatedReq` from `translations`' read reports `translations repointed req.fallbackLocale` — watched failing, then restored. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VuvbQcWhFEViZCoZvbJMsQ
The group read "All ten required app pages" while `APP_PAGE_FIELDS` holds 14, so the figure it showed an operator was wrong by four. A count in that sentence drifts with the list and the group already shows one row per page, so it names none. Its subtle-system sibling keeps "twelve": that set is closed and a migration seeds exactly those slugs. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VuvbQcWhFEViZCoZvbJMsQ
|
Two review findings adopted, one question still waiting on you.
Base was already level with Gate: lint, both typechecks, 2642 unit tests; 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
|
Answered the one open thread and merged
Gate on The body's Test results section is refreshed to match. 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
`perf-figures-pinned.spec.ts` compares PERF.md's recorded file count against the specs on disk, and it read 215 against 216. The lane is otherwise green: 2787 of 2788 passed, this pin the only failure. The extra file came in with `a99aae9` (#1008), which added `tests/unit/signin-token.spec.ts` without re-measuring. So the same assertion is red on `main`, and fixing it here is what gets this PR green — PERF.md's own rule is that the Files / tests row carries "the current tree's" counts while every timing stays with the session that measured it, so the counts move and the 77.9 s median does not. Re-measured on this head, 4 cores: 216 files / 2788 tests, the figure CI reported on `5394892`. The three consumer docs that quote the counts move with it, which is the coupling the spec's second and third claims exist to enforce. #1009 carries 220 / 2835 for its own tree — it adds four spec files of its own, so its numbers cannot stand in for this branch's. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WcsBbMS7ZqEP272YZNHXYk
…-locale-fallback Both sides re-measured the same row. `f158a8f` here corrected the counts for `signin-token.spec.ts`, which `a99aae9` had added without re-measuring; `74e545b` on main corrected them again for its own `textbox-block-conditions.spec.ts`. Main's figures are the merged tree's, and the four documents move together because `perf-figures-pinned.spec.ts` holds them to each other. Re-measured on this merge, 4 cores: 217 files / 2792 tests, matching main's numbers exactly. No source change on either side touches the other's. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01RVzW5RgaHtrq2DvtaNbpFh
|
Merged
Lean gate ✓ on the merge. 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
…-locale-fallback Both conflicts are this branch's code against #998's prettier 3.9.10 reformat, so each hunk keeps this branch's behaviour and prettier reapplies main's shape. - `lessons.ts`: `unitGroupSpecs` kept `labels` in the `evaluate` destructure; main had only collapsed the `.map()` callback onto one line. - `shared.ts`: main reformatted a type annotation inside `getWmAppConfig`'s hand-rolled request cache, which this branch replaced with `memoizeOnRequest`. #1002 localized `app-cards` destination `meditation`, which no check in the `appCards` section reads, so the per-locale table in the PR body still holds. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01AvMHhCzKemzTFd4e7TjxJS
|
Merged
#1002 localized Gate on 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
Clean merge: #997, #998 and #1005 touch none of this branch's seven files. - #998 reformatted 250 files under prettier 3.9.10. `pnpm format:check` passes on this branch's own files unchanged, so none needed reflowing. - #1005 added `tests/unit/admin-condition-fields.spec.ts`, which fails an `admin.condition` reading a field the collection never declares. The five readers of `destination` in `destinationFields()` all sit beside it, so localizing it declares nothing away — that spec passes. - Unit lane on the merge: 218 files, 2795 tests, which is what `perf-figures-pinned` reads. No migration landed on `main` since the last merge, so the snapshot parent is unchanged and `20261021_024228` still regenerates the current one. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NbxY7L3ATnBmYYXfrYrM2X
Summary
#42.Change outline
One rule applied at every read the global issues, one deliberate exception, and one copy of the request per read.
Flow — what a section's read now scopes
virtualReadinessField afterRead → compute(payload, locale, config, req) runSection(spec, { payload, locale, config, req }) src/lib/status/runSection.ts spec.prepare({ payload, locale, config, req }) # req passed through, never copied here - payload.find({ collection, locale, req }) # fallbackLocale sanitised back to 'en' + payload.find({ collection, locale, fallbackLocale: false, req: isolatedReq(req) }) + readFallbackTitles(payload, collection, { locale, req }) # lessons + pages + userChoices + payload.find({ …, select: { title: true }, req: isolatedReq(req) }) + no fallbackLocale → fallback LEFT ON # labels, never checks + rows = docs.map((d) => ({ ...d, title: titles.get(d.id) })) # labelOf needs no new argument group.evaluate(sectionCtx, req)Every read copies; the machinery copies nothing. Payload awaits every virtual field's
afterReadin onePromise.all, so the seven sections run concurrently on one request, andfinddestructures{ fallbackLocale, locale }off it after its ownawait— a sibling read can land its assignment inside that window. A single copy inrunSectioncannot stand in for the per-read ones, because reads inside one section differ from each other too:pagesruns afallbackLocale: falseglobal read beside a fallback-on nodes read, andappCardsreadslocale: 'en'beside two reads at the report locale. It would also hide a section that forgot its own — see the spec note below.Behaviour — which checks change at a non-English locale
Each row is a check that passed off the English value and now reports red when that locale has none of its own. Derived from which fields carry
localized: true, not from a sample.lessonslesson-title-set,panels-set,meditation-set,article-localized,article-has-lecture-linktitle,panels(#977),meditation,articleappCardspublished,title-set,subtitle-set,button-label-set_status(#718),default.title/.subtitle/.buttonTextappConfigrelationship-set,relationship-published,present,audio-set,subtitles-setselfRealizationMeditation,postRealizationLecture,vibeCheckTrackspagespublished,content-localized_status(#718),contentuserChoicesmeditation-<timing>-publishedmorning/afternoon/evening/nightMeditationtranslationsfallbackLocale: false; it gains the isolatedreqlectureslecturesis the exception step 2 of the ticket asks for, and it keeps the fallback. No check there reads a localized field:priority,userChoices,audiencesandmetadataare not localized, andsubtitles-availablealready answers per locale from thesubtitlesrows' ownlocalecolumn. So the fallback resolves only its row labels, andpreparesays so where the reads are.Files — the rule and its users
src/lib/status/ ├── runSection.ts # passes the request through; copying is the read's job └── types.ts # DocumentReport.label owns the checks-vs-labels rule src/globals/WeMeditateAppStatus/ ├── statusConfig.json # regenerated (pnpm generate:statusConfig) └── sections/ ├── shared.ts + │ isolatedReq(req) # one copy per read + │ readFallbackTitles(…) # the title a row shows with the fallback on + │ getWmAppConfig(…) # refuses the fallback; now on the shared memoizeOnRequest ├── lectures.ts # keeps the fallback, and says why ├── lessons.ts, pages.ts, # scope their checks, read their titles beside them │ userChoices.ts # pages.ts also drops its wrong page count └── appCards.ts, appConfig.ts, # scope their checks translations.tsPreview
Data: not seeded.
previewUrl.seedis unset for this repo, and a Railway preview forks configuration rather than content, so both links open on a report whose groups are empty — there is no Path Step, App Card or Page for a check to answer about. Sign in by asking for a link asPREVIEW_ADMIN_EMAIL. The behaviour is covered by the integration specs below instead.Test results
Re-run on
5394892, the merge ofmaininto this branch.pnpm lint,pnpm typecheck,pnpm typecheck:tests. Unit lane 2787 of 2788 passed:tests/unit/perf-figures-pinned.spec.tsfails on the file-count pin, identically onmain—a99aae9(feat(scripts): redeem a sign-in link for a remote seed run's ADMIN_TOKEN #1008) addedtests/unit/signin-token.spec.tswithout re-measuringtests/PERF.md. Not this PR's, and fix(tests): the per-edit hook times out and reports a false failure #1009 already carries the re-measurement (220 / 2835).tests/int/wemeditateAppStatus.int.spec.ts24 passed,tests/int/app-status-readiness.int.spec.ts2 passed.Each new assertion was watched failing first. With the fix reverted, "reports a lesson translated only in English as not ready in French" fails on
meditation-set(expected true to be false) and "leaves the caller's locale and fallback untouched after every section" fails ontranslations repointed req.fallbackLocale. The label case was failed against its own defect — labels taken from the per-locale read while the checks refuse the fallback — and reportedexpected '#1' to be 'English-only choice'.Manual verification
enreads exactly as it does today.#<id>.Notes for reviewer
lessons,pagesanduserChoicesrows would have rendered as#42for every untranslated locale — 30 Path Steps, 14 core pages plus the subtle-system set, and every user choice. They now take their title from aselect: { title: true }read with the fallback on, running beside the check read rather than after it. Answered: option A, keep the English title — the built shape stands unchanged.WeMeditateAppStatusSpec.sectionsand asserts the caller's locale and fallback survive, so a section added later is covered with no edit. A copy inrunSectionwould have passed it for every section whether or not that section's reads took one — measured: with the machinery copy gone, droppingisolatedReqfromtranslations' read reportstranslations repointed req.fallbackLocale. What no deterministic spec can exhibit is the interleaving window itself; that rests on the mechanics in the outline above and insrc/collections/AGENTS.md.in-baseline-audiencestill reads a fallback-resolved value, and this PR cannot reach it.config.baselineCountryis a localized field onwm-app-statusitself, extracted fromdatabyvirtualReadinessField, so the admin's own read of the global resolves it — not anyprepare. Configuration rather than translated content, so English's baseline country is defensible, but it is not a per-locale answer.meditationorarticleinfr,cs,de,esorru.pages.ts's Core app pages group claimed ten required pages whileAPP_PAGE_FIELDSholds 14. It now names no count — the figure drifts with the list, and the group already shows one row per page. Its subtle-system sibling keeps "twelve": that set is closed and a migration seeds exactly those slugs.localeIsolatedReqan optional-reqoverload soisolatedReqandgrantSummary.ts's inline ternary both disappear. The wrapper is this global's named statement of "a read takes its own copy", not just the ternary, and widening a utility with seven callers plus a second plugin buys three lines in a locale-correctness fix. Also dismissed: aperLocaleFindwrapper setting both keys at once —lecturesopts out of half the policy, which that shape cannot express.Detail
Why
fallbackLocale: falsecannot be hoisted anywhere.sanitizeFallbackLocalereturns the locale's own fallback when the argument isundefined, andpayload/dist/config/sanitize.jsdefaultslocalization.fallbacktotrue(this config sets nofallbackkey). So there is no request-level, context-level orProjectRequestContext-level way to say "refuse the fallback" —createLocalReqre-sanitises on every read. A machinery default would also be the wrong depth: "does this check read a localized field?" is content knowledge, andlecturesis the proof.An omitted
fallbackLocaleis not the safe choice. It is sanitised back to the locale's own fallback, so such a read actively undoes afallbackLocale: falseon the same request.getWmAppConfig's memo key is unchanged. Keyed on the locale and depth, because the two callers ask for different depths; both now want one fallback policy, so the key does not carry it. The Pages tab's page relationships are not localized, so the flag changes nothing for thepagessection — onlyappConfig's three localized slots. The swap tomemoizeOnRequestalso evicts a failed load, so a later read in the same request can retry.Named and not taken: machinery-level label hydration.
groupCollectionMapalready maps every row-bearing group to its collection andDocumentReport.labelis the machinery's own field, so "a row's label comes from a fallback-on read of its own collection" could be one hydration step inrunSection— replacing three different per-section label strategies with one. It would have to leave unmatched ids alone, sinceappConfig's rows are global-backed and point at related documents rather than the group's own collection. Out of scope here.Closes #982