Skip to content

fix(lessons): translating a Path Step no longer overwrites its English text - #978

Merged
sydevs-bot merged 9 commits into
mainfrom
claude/fix-977-localize-lesson-panels
Oct 20, 2026
Merged

sydevs-bot merged 9 commits into
mainfrom
claude/fix-977-localize-lesson-panels

Conversation

@sydevs-bot

@sydevs-bot sydevs-bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • A Path Step's title and intro panels are now stored per language, so a translator cannot overwrite the English every app user sees.
  • The French already typed into two steps' English slots is carried into French; the English it replaced is typed back in the admin after deploy (option A, settled on the diff).
  • Joined: CleanupOrphanedMedia now scans every locale — localizing panels would otherwise make a file referenced only by a French panel look orphaned, and the job trashes those.
  • Joined: the same scan could never resolve a reference under a named tab, so AppCards' per-view images and button icons already read as orphans. One joinPath fixes it.

Change outline

Contract — the collection, and what a write in a second locale may omit

Both fields move out of the base table. Neither may be required, for two different reasons, so the admin stops enforcing content and Launch Readiness reports it instead.

 lessons                                    src/collections/Lessons/Lessons.ts
   title  text  required
+    localized                              # was one value for all 19 locales
-    required                               # Payload validates a required localized
                                            #   field against that locale's OWN value,
                                            #   so this refused every non-English write
                                            #   that did not also carry a title
   panels  array
+    localized                              # the ARRAY, not its text fields
-    required, minRows: 1, defaultValue: [{}]
                                            # each one makes a write in a second locale
                                            #   store a blank list, which then hides the
                                            #   panels that locale falls back to
     title, text, media → files, subtitles  # unchanged; now per locale with the array
 weMeditateAppStatus → Path Lessons         src/globals/WeMeditateAppStatus/sections/lessons.ts
+  lesson-title-set   # the title `required` no longer enforces
   panels-set         # already covered the empty panel list
   intro-audio-set, meditation-set, article-localized, …

Contract — the two migrations

The generated delta cannot be applied as issued: it adds _locale as NOT NULL to a populated table and drops lessons.title without reading it. The backfills are what make it applicable.

-- 20261017_093546_localize_lesson_title_and_panels   (schema + backfill)
lessons_panels   + _locale          -- nullable → UPDATE all rows 'en' → SET NOT NULL
lessons_locales  + title            -- nullable; INSERT … ON CONFLICT lifts every
                                    --   lessons.title in as that step's 'en' row
lessons          - title            -- only after the lift
-- down: lessons.title restored from the 'en' row (any locale's title as a
--       fallback, '' when none), then the non-English panel rows deleted
-- 20261017_095800_rescue_french_lesson_panels        (data only)
-- Matches a step by an accent-free substring of the French in its English panels,
-- skips a step that already has French panels, derives each new row id from the
-- English row's. So: no-op with no Path Steps, no-op on a second apply, no-op
-- once the English is corrected, and `down` deletes only the rows it wrote.
lessons_panels   INSERT _locale='fr'  SELECT … FROM lessons_panels WHERE _locale='en'

Flow — the media-cleanup scan

An invisible reference reads as an orphan, and the job trashes orphans. A localized field's value is invisible to a single-locale read, and so is a field whose recorded path is not a path.

 traverseField(field, …)                        src/jobs/CleanupOrphanedMedia/schemaUtils.ts
+  FieldReference.localizedAt                   # which path segments a `locale: 'all'`
                                                #   read returns as a { [locale]: value }
                                                #   map, read off each field's OWN
                                                #   `localized` flag while walking
+  joinPath(pathPrefix, name)                   # a named tab at an empty prefix built
                                                #   `.default.media` — no key any document
                                                #   has. AppCards nests its named view
                                                #   tabs inside an unnamed one, so every
                                                #   per-view image read as an orphan
 findReferencedIds(payload, targetCollection)   src/jobs/CleanupOrphanedMedia/CleanupOrphanedMedia.ts
   scanCollectionForReferences(…)
-    find { depth: 0 }                          # default locale only
+    find { depth: 0, locale: 'all' }
+    select: selectRootsOf(ref paths)           # `all` × every unread field × its
                                                #   per-locale afterRead hooks
     extractIdsFromDocument(doc, ref)
+      getValueAtPath splits at ref.localizedAt, and reads no keys to decide
   scanCollectionForLexicalReferences(…)
-    find { depth: 0 }
+    find { depth: 0, locale: 'all', select: selectRootsOf([richTextField]) }
+    localeValues(doc[field], ref.localizedAt.includes(0)) → one tree per locale

Preview

  • Path Steps list — the Path Step list; the locale selector top-right is what the change is about
  • Launch Readiness — the new Title set row under Path Lessons

Data: not seeded. previewUrl.seed is unset in .claude/workflow.json and this session holds no PREVIEW_ADMIN_EMAIL, so neither link can be opened on content from here. A Railway preview carries no rows, so a reviewer has to create one Path Step, then switch the admin locale to French and edit its title and panels there.

Migration

  • New migrations: src/migrations/20261017_093546_localize_lesson_title_and_panels.ts, src/migrations/20261017_095800_rescue_french_lesson_panels.ts
  • Impact: lessons.title moves to lessons_locales.title as en; lessons_panels gains _locale, every existing row marked en. Then two steps get a French copy of their English panel list. No row is dropped and no title or panel text is lost.
  • Reversible: yes, with one leftover row. The dump diff covered three tables: lessons and lessons_panels came back byte-identical, and lessons_locales did not. up inserts a locale row for every step, including steps that had none, and down drops the title column and leaves those rows behind with every remaining value NULL — harmless, and not byte-exact. The schema down restores lessons.title from the English locale row and deletes the non-English panel rows, so a French translation made after the up is discarded, which is what reverting this means. The data migration's down deletes only the rows it wrote, by their derived ids.
How the migrations were verified, since no test lane runs them

push: !isProduction means dev and both test lanes sync the schema with Drizzle push and never replay the migration chain, so CI is silent about this folder.

Verified on a scratch Postgres instead: the chain was applied with these migrations held out of the folder, leaving the pre-change schema. Then seeded — three steps with titles, three panels, a locale row carrying an article but no title, a step with no title at all, and the two exact French strings read from production — and payload migrate run.

  • up: every title arrived in lessons_locales as en, every panel row marked en, lessons.title dropped, and both affected steps given a complete French panel list. Other steps untouched.
  • down: English titles and panel rows came back byte-identical (diff against the pre-up dump of lessons and lessons_panels), the French panel rows were gone, and the step with no title restored as '' rather than aborting the restored NOT NULL.
  • Both rescue guards were replayed by hand: INSERT 0 0 when French panels already exist, INSERT 0 0 once the English is corrected. The loosened matcher was replayed too: it still matches a curly-apostrophe and guillemets variant.

Test results

  • Lean gate: ✓ pnpm lint && pnpm typecheck && pnpm typecheck:tests && pnpm test:unit (2584 unit tests), re-run on the merged base
  • Targeted specs: 60 passed — lessons, cleanup-orphaned-media, schema-utils, on the merged base. The earlier pre-merge run also passed wemeditateAppStatus, cleanup-jobs, meditation-transcription and collections-smoke
  • Build: N/A (Railway builds the preview)

Every new assertion was watched failing at the site that causes it: the three locale-isolation cases with the two localized flags removed, the readiness case with the check removed, the orphan case with the scan reverted to a single locale, the localization marks with recordLocalized no longer marking, and the tab path with the old interpolation.

Manual verification

  1. In the admin, open a Path Step, switch the locale to French, change its title and one panel, save. The English must be unchanged, and the other way round.
  2. Save a French title only on a step with no French panels. It must succeed, and the French app must still show the English panels (GET /api/lessons/<id>?locale=fr).
  3. After deploy, confirm production step 0's panel and step 1's second panel now carry the French under ?locale=fr.
  4. Then a manager types the English back into step 0's only panel and step 1's second panel, which still hold that French. Option A, chosen by the reviewer; @antontcymbal owns it. Two admin fields, no code.

Notes for reviewer

  • Dropping title's required was not in the ticket. It is forced: with required, updating a step in French without also typing a French title is refused, and the repo's existing per-locale meditation spec went red proving it. The lesson-title-set readiness check is what replaces the enforcement. The key is prefixed because the generated statusConfig.json flattens check keys across sections and app-cards owns title-set.
  • The English originals are not restored by this branch, and that is the agreed outcome. Neither is in this repo, and lessons has no version history, so production cannot give them back. Inventing a quote attributed to a named teacher is worse than a visible defect, so the branch carries the French into fr and leaves the two English slots to a manager (step 4 above).
  • The new cleanup case sits last in its file: the throughput cases above it assert against the orphan backlog every earlier case leaves, and one more run of the job spends the budget they measure.
  • Until this ships, the French translator should leave Path Step intros alone, and nobody should correct the two English slots. The rescue migration reads the French out of them, so correcting the English first deletes the only copy.
Review passes, and the two findings dismissed

Ran /simplify (four lenses) and /code-review high; pr-review-toolkit is not installed here. comment-lint.mjs clean. Security review skipped — no path matches securityReview.triggerPattern.

Acted on: the select above (locale: 'all' otherwise multiplies every field the scan ignores, including two Lexical sanitizer hooks, by the locale count); the rescue matcher loosened from byte-exact to an accent-free substring, because a migration that matched nothing would still record as applied; the derived row id hoisted to one sql const, since up and down must spell it identically; a comment naming the wrong readiness key; three comment blocks restating src/collections/AGENTS.md.

Acted on after the adversarial review: the locale split moved onto the schema walk (FieldReference.localizedAt), which drops both the key-shape inference and the locale list extractIdsFromDocument took — and turned up the named-tab path defect above.

Dismissed:

  • payload.config.localization?.localeCodes ?? [] — does not typecheck. The property is false | {…}, and optional chaining does not narrow false. Moot now: the job no longer reads the locale list at all.
  • prepare in the readiness section reads through the English fallback, so lesson-title-set and panels-set cannot fail for a non-English locale. True, and it is the pre-existing shape for article-localized and meditation-set as well — the ticket names branch fix/status-locale-isolated-req as the fix for per-locale judging, so taking it here would collide with it. The new check still bites where dropping required newly permits a blank: English.

Not taken, as outside this change: deduplicating the Lexical scan across the files and images passes (it is target-agnostic, so the two passes build the same id set from the same I/O). Pre-existing, and its own change.

Closes #977

A Path Step's title and its intro panels were stored once for every
language, so a translator who switched the editor to French and typed
there replaced the English text every app user sees. Two steps on
production hold French in their English slots because of it (#977).

`title` and the whole `panels` array are now `localized`. Localizing the
array rather than each panel's text fields keeps the migration to one
`_locale` column on `lessons_panels`, makes the panel video's subtitles
per-language for free, and stops one language's translator deleting or
reordering another's panels. The cost is that a panel added in English
does not reach French until someone adds it there; Launch Readiness
reports that gap through its `panels-set` check.

`panels` loses `required`, `minRows` and its default empty row. With any
of them, an update in a second locale writes a blank panel list, which
then hides the panels that locale falls back to.

`title` loses `required` too, which the ticket did not ask for. Measured:
Payload validates a required localized field against that locale's OWN
value, and the English fallback does not satisfy it — the same behaviour
`src/collections/AGENTS.md` records for `publishSpecificLocale`. So
`required` refuses every write in a second locale that does not also carry
a title for it, and the existing per-locale `meditation` spec went red
proving it. Launch Readiness gains a `lesson-title-set` check for the
blank title this now permits. The key is prefixed because a check key is
global across sections and app-cards owns `title-set`.

The generated migration is augmented, because the generated delta cannot
be applied as issued: it adds `lessons_panels._locale` as `NOT NULL` to a
populated table and drops `lessons.title` without reading it. The two
backfills are what make it applicable, and `down` restores the column from
the English locale row and deletes the non-English panel rows.

Verified on a scratch Postgres carrying the pre-change schema: the chain
was applied with this migration held back, then steps, panels, a locale
row with an article but no title, and a step with no title at all were
seeded, then up and down run. Every English title and panel came back
byte-identical, the French panel rows were gone, and the step with no
title restored as empty rather than aborting the `NOT NULL`.

Each new spec was watched failing with the `localized` flags removed and
with the readiness check removed.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VVEKTqb9fx1newcaZ6a6Ex
`CleanupOrphanedMedia` read each collection at the default locale, so a
reference held only by a localized field was invisible to it — and an
invisible reference reads as an orphan, which the job then trashes.

Localizing a Path Step's `panels` (#977) puts `panels.*.media` and its
subtitles behind that blind spot, which the new integration case proves:
with the scan reverted to a single locale, a file referenced only by a
French panel is trashed. The same hole already covered a localized
`richText`, so the Lexical scan is read the same way.

Both scans now read `locale: 'all'` and hand the walker the configured
locale codes. `localeValues` splits the `{ [locale]: value }` shape only
when every key is a configured locale, so a group whose subfields happen
to look like locale codes is left alone, and an empty list — a caller that
read one locale — splits nothing.

The new integration case sits last in the file because the throughput
cases assert against the orphan backlog every earlier case leaves, and one
more run of the job spends the budget they measure.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VVEKTqb9fx1newcaZ6a6Ex
Two Path Steps carry French where their English panel text and title
belong, typed there while `panels` was shared across every language: step
0's only panel holds a Shri Mataji quote in French, and step 1's second
panel holds a French title over English text (#977). Re-read from
production today, read-only, and those two fields are still the only ones
affected.

Localizing `panels` alone would leave that French as the English every app
user sees, and whoever restores the English would overwrite it. So this
data migration gives each affected step a French panel list of its own,
copied from its English one, which carries the French forward.

The English it replaced is NOT restored here. Neither original is in this
repo or recoverable from production — `lessons` has no version history —
and inventing a quote attributed to a named teacher is worse than leaving
a visible defect. The PR asks the Path content owner for both strings.

Data only, so the snapshot is the previous migration's, per
`src/migrations/AGENTS.md`. Both halves are guarded and both were measured
replaying the statement: a step is matched by the exact French string in
its English panels and skipped if it already has French panels, so the
migration inserts nothing on an environment with no Path Steps, nothing on
a second apply, and nothing once the English is corrected. Row ids are
derived from the English row's, which is what lets `down` delete the rows
this migration wrote and leave a hand-authored French panel alone.

Verified on the same scratch Postgres: with the two French strings seeded
in English slots, up gave both steps a complete French panel list and left
every other step alone, and down removed exactly the derived rows.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VVEKTqb9fx1newcaZ6a6Ex
Three facts a reader cannot re-derive from the code: that the array is
localized rather than its text fields, and what that trades away; that
`required` is refused on `panels` and on `title` for two different
reasons, the second one Payload's own validation of a localized field;
and that a localized upload reference needs a `locale: 'all'` scan or the
media-cleanup job trashes a file in use.

The schema-introspection example gains the locale codes its caller now
passes, and the Storyblok importer's guide says the panels it writes land
in English.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VVEKTqb9fx1newcaZ6a6Ex
- `select` the fields each media scan actually reads. `locale: 'all'` returns
  every translation of every field and runs a field `afterRead` hook once per
  locale, so reading whole documents to look at two paths multiplied the cost
  of the ones it ignores — `Pages.content` and `Lessons.article` each carry a
  Lexical sanitizer hook and are the largest values in their rows.
- `extractIdsFromDocument`'s `locales` is required, not defaulted. An omitted
  list splits no locale map, which is right for a single-locale read and loses
  every translated reference for an `all` one — the #977 failure, re-armed.
- The rescue migration matches an accent-free substring instead of the whole
  French string. A migration that matched nothing would still record as
  applied, so one curly apostrophe would have made it unrepeatable. Measured:
  the substring still matches a curly-quote and guillemets variant, and still
  inserts nothing once the English is restored. Its derived row id is now one
  `sql` const, since `up` and `down` must spell it identically.
- The comment on `title` named the wrong readiness key, and three comment
  blocks restated what `src/collections/AGENTS.md` already holds.

Both migrations were re-verified end to end after the edit, on a scratch
Postgres carrying the pre-change schema: up, then down, with the English
titles and panel rows coming back byte-identical.

Dismissed, with reasons in the PR body: `payload.config.localization?.` does
not typecheck (the property is `false | {…}`), and the readiness section's
own fallback-blind read belongs to the branch the ticket names for it.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VVEKTqb9fx1newcaZ6a6Ex
@railway-app

railway-app Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

🚅 Deployed to the SahajCloud-pr-978 environment in sahajcloud

Service Status Web Updated
SahajCloud ✅ Success (View Logs) Web Oct 20, 2026 at 4:57 pm UTC
1 service not affected by this PR
  • mailpit

@sydevs-bot sydevs-bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 question for the reviewer, one per thread.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Oct 17, 2026
@sydevs-bot

sydevs-bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 no session running

recent dispatches
  • 16:47Z address-review · attempt 1 · session · done
  • 16:47Z address-review · attempt 1 · session
  • 19:25Z resolve-conflicts · attempt 1 · session · done
  • 19:25Z resolve-conflicts · attempt 1 · session
  • 10:53Z address-review · attempt 1 · session · done

Written by the sydevs dispatcher. Sessions never edit this comment.

@sydevs-bot sydevs-bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧐 Adversarial review

The diff is the size #977 asked for: two localized flags, the two migrations they force, and the readiness check that replaces the dropped required. The CleanupOrphanedMedia change is correctly joined — localizing panels makes a French-only file read as an orphan, and the job trashes those. Nothing here is smuggled. One design question on how that scan learns which fields are localized, and one timing risk on the rescue.

Beyond this PR: the scan read the default locale before today, so a reference held only by a localized rich text (Pages.content, Lessons.article) has always been invisible to it. This fixes that class going forward, but nothing looks back at what was already trashed for it. Worth a ticket?

Findings

  • should-fix — the locale split is inferred from key shapes at scan time, when the schema walk already knows it (schemaUtils.ts:263).
  • should-fix — the rescue loses the French if the English is corrected before deploy (20261017_095800_rescue_french_lesson_panels.ts:40).
  • consider — down leaves behind the lessons_locales rows up created (20261017_093546_localize_lesson_title_and_panels.ts:40).

What was checked. #977 against the diff. Lessons.ts, schemaUtils.ts and CleanupOrphanedMedia.ts read whole. Both migrations against the pre- and post-change snapshots: lessons_locales carries the unique index ON CONFLICT needs, and lessons_panels has no unique on _order, so one _order per locale is safe. Every localized: true in src/collections classified — none is an upload or a files/images relationship, so locale: 'all' changes nothing for them. Preview answers 200; not opened, no PREVIEW_ADMIN_EMAIL here, as the body says. Reviewer profile read.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@sydevs-bot sydevs-bot added bot:working Lock: a cloud session is running on this item. Removed when it ends. and removed bot:working Lock: a cloud session is running on this item. Removed when it ends. labels Oct 17, 2026
`traverseField` already reads every field's config, so the walk records
which path segments a `locale: 'all'` read returns as a `{ [locale]: value }`
map, on `FieldReference.localizedAt`. Extraction splits exactly there.

That drops both halves of the inference it replaces: `localeValues` no
longer reads key shapes to guess whether an object is a locale map, and
the locale list is no longer threaded through four functions. Payload
deletes `localized` from a field nested inside a localized one, so the
flag read is the whole answer.

Also fixes a reference the scan could never resolve. A named tab's path
was built as `${pathPrefix}.${tab.name}`, which yields `.default.media`
when the prefix is empty — no key any document has. AppCards nests its
named view tabs inside an unnamed tab, so every per-view image and button
icon read as an orphan, which is the #977 failure in another spelling.
Both now go through one `joinPath`.

The unit spec covers the walk against a stub config rather than
`localeValues` alone, since what is recorded is now the property that
matters. Each new assertion was watched failing at its cause: the
localized marks with `recordLocalized` no longer marking, and the tab path
with the old interpolation.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01QJgQpAB9gJUE9jaG5arTfc
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

Three threads, all adopted. Pushed 3e1ff27, 10b1eb3.

  • The locale split moved onto the schema walk, as FieldReference.localizedAt. The key-shape read and the threaded locale list are gone. It exposed a second invisible reference: a named tab at an empty prefix built .default.media, so AppCards' view images read as orphans.
  • The rescue's timing: the question thread and the body now say not to correct the two English slots until this ships.
  • Reversibility: the body now names the three tables the dump diff covered, and that lessons_locales is not byte-exact.

The look-back question is #979: nothing has checked what the job already trashed for a reference it could not see.

Base was current. Lean gate ✓ (2546 unit) plus 51 targeted. The question thread waits on the content owner.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@sydevs-bot sydevs-bot removed the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Oct 17, 2026
@sydevs-bot
sydevs-bot marked this pull request as ready for review October 17, 2026 11:20
@sydevs-bot
sydevs-bot requested a review from Ardnived October 17, 2026 11:20
@sydevs-bot
sydevs-bot enabled auto-merge October 17, 2026 11:20
@sydevs-bot sydevs-bot added bot:working Lock: a cloud session is running on this item. Removed when it ends. and removed awaiting labels Oct 17, 2026
main added three migrations while this branch added two, so src/migrations/index.ts
conflicted in both its import block and its array. Both sets are wanted, and neither
side's migrations touch the other's tables.

The five entries are interleaved by timestamp rather than appended, because that is
the order `migrate:create` regenerates this file in and the order `prodMigrations`
applies the chain.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SrYFAzP7KmEpwpohPT6CN1
@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-978 October 17, 2026 19:33 Destroyed
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

Merged main. One conflict, src/migrations/index.ts: both sides had appended to the registry, so both sets are kept, interleaved by timestamp rather than appended — that is the order migrate:create regenerates this file in and the order prodMigrations applies. Neither side's migrations touch the other's tables.

⚠ The merge leaves the snapshot chain out of timestamp order (src/migrations/AGENTS.md, #566). Newest-by-timestamp is now main's 20261017_102331.json, which predates this branch: it still has lessons.title, and neither lessons_locales.title nor lessons_panels._locale. The next db:migrations:create here will re-emit this branch's lessons DDL — read the generated DDL and heal it (keep the snapshot, empty the bodies). Not regenerated here: this branch has already deployed previews, which AGENTS.md rules out.

Gate green: lint, typecheck (src + tests), 2574 unit. Integration 94 passed — lessons, cleanup-orphaned-media, schema-utils, cleanup-jobs, meditation-transcription, wemeditateAppStatus.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@sydevs-bot sydevs-bot added awaiting bot:working Lock: a cloud session is running on this item. Removed when it ends. and removed bot:working Lock: a cloud session is running on this item. Removed when it ends. awaiting labels Oct 17, 2026
Clean merge. None of main's three commits touches a file this branch does:
the endpoint-permission gate, the routine dependency bump and the seeds
splash fix are all elsewhere. Both AGENTS.md edits were auto-merged into
separate sections.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01XyZquVggCjDfECHEedX1Qu
@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-978 October 20, 2026 16:53 Destroyed
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

One thread, answered. Pushed 81892e3 — a base merge, no code change.

  • Option A is what the branch already builds, so nothing was rebuilt. Thread resolved. The two English slots stay for a manager: that is now Manual verification step 4 in the body, so it outlives the resolved thread. ⚠ They must not be typed in before this deploys — the rescue reads the French out of them.

Base merged: main had moved three commits — the endpoint-permission gate, the routine dependency bump, the seeds splash fix. Clean, and none touches a file this branch does. Both src/collections/AGENTS.md edits auto-merged into separate sections.

Gate green on the merged base: lint, typecheck (src + tests), 2584 unit, plus 60 targeted integration — lessons, cleanup-orphaned-media, schema-utils.

Body refreshed: the test counts, and the settled option.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@sydevs-bot sydevs-bot added awaiting and removed bot:working Lock: a cloud session is running on this item. Removed when it ends. labels Oct 20, 2026
@sydevs-bot
sydevs-bot added this pull request to the merge queue Oct 20, 2026
Merged via the queue into main with commit bceedfd Oct 20, 2026
32 of 33 checks passed
@sydevs-bot
sydevs-bot deleted the claude/fix-977-localize-lesson-panels branch October 20, 2026 17:21
@sydevs-bot sydevs-bot moved this from Revising to Done in SYDevelopers Technical Roadmap Oct 20, 2026
sydevs-bot added a commit to sydevs/WeMeditateWeb that referenced this pull request Oct 20, 2026
sydevs-bot pushed a commit that referenced this pull request Oct 20, 2026
`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
sydevs-bot pushed a commit that referenced this pull request Oct 20, 2026
main gained #978 (translating a Path Step no longer overwrites its English
text) and #985 (the admin Transcript tab). Three files conflicted. Each was
touched on this branch only by 3b05cad, the pure `prettier --write` commit,
so each took main's content and was re-formatted rather than merged hunk by
hunk — there was no hand-written side to weigh:

- docs/architecture.md — main drops the `meditationTranscript` endpoint row
- src/jobs/CleanupOrphanedMedia/schemaUtils.ts — main's `localizedAt` tracking
- tests/COVERAGE.md — main's new rows

`prettier --write .` then ran over the whole merge result. That is part of the
resolution, not a separate change: four of main's files auto-merged
unformatted (CleanupOrphanedMedia.ts and three unit specs), and the
`format:check` step this branch adds would have failed on main's own files.

For all 36 files main changed, the merged content is byte-for-byte
`prettier(main's version)`: 29 formatted files reproduced exactly, 6
prettier-ignored files identical to main, and src/payload-types.ts — the one
hybrid of two generator renderings — reproduced exactly by
`pnpm generate:types`, twice in a row.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01RwENrwzLpaNpXvFXVnvGFR
github-merge-queue Bot pushed a commit that referenced this pull request Oct 21, 2026
…sh fallback (#997)

* fix(status): Launch Readiness answers about the locale, not the English 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

* refactor(status): the request copy moves into runSection, and labels 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

* docs(status): a concurrent sibling read needs the copy too

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

* fix(ci): lessons title and panels are localized now

`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

* fix(status): one request copy, at the read that makes it

`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

* fix(status): the core-pages group stops naming a page count

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

* fix(ci): re-measure the pinned unit spec count

`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

---------

Co-authored-by: Claude <[email protected]>

This branch was successfully deployed

No deployments
sahajcloud / SahajCloud-pr-978 — 81892e3f Deployed Oct 20, 2026 by railway-app[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

fix(lessons): translating a Path Step overwrites its English text

3 participants