Skip to content

fix(transcripts): a new transcript misspells our words, and select hides status - #1087

Merged
sydevs-bot merged 15 commits into
mainfrom
claude/fix-1084-transcript-spelling-and-status
Nov 10, 2026
Merged

sydevs-bot merged 15 commits into
mainfrom
claude/fix-1084-transcript-spelling-and-status

Conversation

@sydevs-bot

@sydevs-bot sydevs-bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • A transcription request now carries the glossary's own spellings as Lemonfox's prompt, and the glossary covers the IAST forms a prompt-less run wrote.
  • A select naming a computed field no longer strips the stored fields its hook reads, so ?select[status]=true stops reporting failed for finished transcripts.
  • Review round two, all three answers built. manipura and vishuddha take our own spelling; status is backed by a stored segmentCount instead of the whole cue column; and the declaration moved onto the field, with a plugin installing the hook wherever one exists.
  • Joined, not listed: pages had the same defect — ?select[webUrl]=true answered null for every published page. Confirmed in the integration lane before fixing.
  • Joined, not listed: meditations had it too — ?select[durationMinutes]=true and ?select[title]=true each answered null. The parent collection of the row fix(transcripts): a new transcript misspells our words, and select hides status #1084 was filed against, and the one place an internal select compensated by hand while an API client could not.
  • Joined, docs: docs/architecture.md claimed no client key reads meditation-transcripts. It does, which is who paid for the co-select the stored count has now replaced.

Change outline

Flow — what the transcription request now sends

The prompt is built from the same list that corrects the output, at the one seam every caller passes through.

 requestLemonfoxTranscript({ apiKey, audioUrl, locale })   src/jobs/TranscribeMeditation/lemonfox/transcribe.ts
   form.append('file', audioUrl)
   lemonfoxLanguage(locale)                                # unchanged
+  glossaryPrompt(locale)                                  src/collections/MeditationTranscripts/glossary.ts
+    PASSES.get(baseLanguage(locale))                      # the map applyGlossary already walks
+    dedupe `written`, join ', ', stop at PROMPT_MAX_CHARS
+    → "Mooladhara, Swadhistan, Swadhisthana, Nabhi, …"    # 23 spellings, 222 chars
+  form.append('prompt', …)                                # omitted for a language no entry claims
   form.append('response_format', 'verbose_json')

Then the pass that guarantees it, unchanged, with seven new rows behind it:

 glossary.json                heard → written
+  muladhara      → Mooladhara          # what a prompt-less run wrote
+  condalini      → Kundalini
+  kundalinee     → Kundalini
+  svadhisthana   → Swadhisthana
+  ajna           → Agnya
+  manipura       → Manipur             # our spelling of the word that was said
+  vishuddha      → Vishuddhi           # joins the row `vishuddhi` already had

A synonym is still refused: Nabhi names the same chakra with a different word, so no entry writes one.

Contract — what a selected read answers

Observable to any API client, which must send a select on every read.

 GET /api/meditation-transcripts?select[status]=true
-  status: "failed"        for every completed row      # 121 of production's rows
+  status: "completed"
+  segmentCount: 143       # a scalar, not the cue column
 GET /api/meditation-transcripts?select[error]=true
-  error: null             for a run that had failed
+  error: "Lemonfox returned 422: …"

 GET /api/pages?select[webUrl]=true
-  webUrl: null            for every published page
+  webUrl: "https://…/the-slug"

 GET /api/meditations?select[durationMinutes]=true
-  durationMinutes: null   for every meditation
+  durationMinutes: 11
 GET /api/meditations?select[title]=true
-  title: null             for every meditation with frames
+  title: "Meditation for Anahat"

 GET /api/images?select[url]=true                       # and the other seven upload collections
-  url: null               unless the caller also sent select[filename]
+  url: "https://imagedelivery.net/…"

Files — the declaration moves onto the field

A field now says what it reads, and a plugin installs the hook. Nothing restates a shared field's inputs.

 src/plugins/
+└── virtualFields/
+    ├── declare.ts            # virtualFieldInputs(...) → the field's own `custom`
+    ├── collect.ts            # the declarations at one collection's data level
+    ├── ensureVirtualFieldDeps.ts   # moved from src/lib/utilities/; the plugin is its one caller
+    └── plugin.ts             # mounts the beforeOperation hook where a field declared something
 src/fields/
 └── publicUrlFields.ts        # `inputs` is now a REQUIRED option, shared by its three fields
 src/plugins/storage/
 └── urlFields.ts              # url / previewUrl / hlsUrl / mp4Url declare filename (+ mimeType)
 src/collections/
-├── Events/Events.ts          # the hand-written map is gone from all four
-├── Pages/Pages.ts
-├── Meditations/Meditations.ts
-└── MeditationTranscripts/MeditationTranscripts.ts   # + segmentCount, written by stampSegmentCount
 src/migrations/
+└── 20261107_213230_transcript_segment_count.{ts,json}   # the column, plus the backfill
 tests/utils/
 └── testHelpers.ts            # ⚠ registers the plugin too, or the lane has no repair at all

Preview

Railway names the preview after the PR number, so these hosts are live once the build finishes. Data: not seeded yet — previewUrl.seed is unset in .claude/workflow.json, so there is no seed command to run, and a Railway preview forks configuration rather than content. Every link below therefore opens on an empty collection until you create a row; the Manual verification steps say what to create. Sign in by asking for a link as PREVIEW_ADMIN_EMAIL.

  • Meditations list — create one from a recording here; its Video → Transcript tab is where the spellings land
  • Pages list — create and publish one, then read its webUrl through the API below
  • /api/pages?select[webUrl]=true — null before this change, a URL after it
  • /api/images?select[url]=true — the co-select this PR retires, on the collection you can see without a key
  • GET /api/meditation-transcripts?select[status]=true and GET /api/meditations?select[durationMinutes]=true on that host — both need a client key

Test results

  • Lean gate: ✓ lint, format, tsc over src/, tsc over tests/, unit lane (244 files, 3172 cases); 92 s for the whole gate
  • Targeted specs: ✓ meditation-transcripts.int (15), virtual-field-select.int (2, new), meditations.int (25), pages.int (23), events.int (11), plus atlas-submission-routing.int, event-verification.int, atlas-seo.int, atlas-sitemap.int, storage-utils.int, collections-smoke.int — 281 cases over the two batches, all green
  • Contract step: timeout 300 pnpm db:migrations:create --skip-empty wrote one migration this round, for segment_count. One ADD COLUMN, no rename and no enum churn; the DDL was read before committing, and the backfill is the hand edit option B asked for
  • Security review: ran (the diff touches collections/*/hooks/ and payload.config.ts); no findings. The select the plugin widens is not an authorization boundary — field read access still applies — and the two new inputs a caller can now see, filename and mimeType, are already returned by any read that selects nothing
  • Build: N/A — Railway builds it

Manual verification

  1. On the preview, create a meditation from a short recording saying "Mooladhara", "Kundalini" and "Sahasrara", wait for the transcript, and read all three in Video → Transcript. The ticket notes macOS say -v Samantha reproduces the original misspellings. This is the one criterion no test can reach — it needs a real Lemonfox call, and the lane forbids one.
  2. On production, GET /api/meditation-transcripts?limit=200&select[status]=true with a client key: expect 121 completed, not 121 failed, and no segments in the response. The migration's backfill is what makes those 121 right on the deploy itself.

Notes for reviewer

  • All three threads are answered and resolved. The spelling, the segments cost and the field-level declaration each became a commit of its own.
  • segmentCount is not the stored status column status.ts rejects. That rejection stands for the reason it was written: a second record of a run can disagree with the job row, and did. A count has one writer, cannot claim processing, and is a pure projection of segments in the same row.
  • The backfill runs in the migration, not a job. src/migrations/AGENTS.md refuses a hand-edited backfill unless asked, and option B asked. Without it every pre-existing row reads segment_count IS NULL and derives as failed on the deploy — fix(transcripts): a new transcript misspells our words, and select hides status #1084 again, on exactly the rows it was filed for. CASE WHEN jsonb_typeof(segments) = 'array' … is one statement over one table with no foreign key.
  • publicUrlFields.inputs is required, deliberately. An optional one would be the same forgettable declaration one level down. regions passes [] with the reason beside it.
  • One behaviour change beyond the three asks. events.appUrl now declares region and _status, where the hand-written map named only webPath and webUrl. It reads null either way today, because events configures no app base — but a field and its siblings disagreeing was the omission this change exists to make impossible.
  • What the plugin cannot reach, by design. A declaration inside a named group, array, block or tab belongs to that key's own select, which the top-level hook does not patch. collect.ts descends through row, collapsible and an unnamed tab only — which is what reaches publicUrlFields' collapsible and Meditations' tabs. A unit case pins both halves.
  • Earlier dismissed review findings (unchanged): merging the new it.each tables into the existing ones, dropping the differential assertion in the transcripts int case, and deriving the prompt only from entries whose heard differs beyond case — that last predicate would drop Mooladhara, Kundalini and Sahasrara, which are exactly the words we want asked for.
Detail

Why the prompt lives in the HTTP client, not the job. transcribe.ts already maps locale → language there "so no caller repeats the mapping". The defect was that nothing sent a prompt, so putting the derivation at the single seam makes it un-forgettable; passing it from TranscribeMeditation.ts would let the next caller omit it. The cross-owner import matches the job folder's existing one (TranscribeMeditation.ts already imports MeditationTranscripts/lemonfox).

Why the cap is 448 characters. Whisper's prompt window is about 224 tokens and nothing reports an overflow, so the list is cut here, in file order, rather than at an end we do not control. Two characters per token is a floor for transliterated Sanskrit. The list is 222 characters now that vishuddha folds into Vishuddhi, and a spec pins that the whole list still fits — so the cut fires on nothing, and turns red before it ever would.

Fixture pre-mortem. glossary.spec.ts's prompt cases assume every entry names pt as well as en, so the two languages' prompts are the same string; verified against src/collections/MeditationTranscripts/glossary.json and src/lib/locales/index.ts. virtual-field-deps.spec.ts assumes Payload hands the hook { operation, args } with the caller's select on args. virtual-field-declarations.spec.ts assumes custom survives onto a field config Payload itself never reads, and that a plugin sees the collections as written, before sanitization — verified against payload's Plugin type.

Every new assertion was watched failing. This round: the two spelling rows (reverted → 3 red), the count write (gated to return early → 2 red), the derivation (handed the cue array it used to take → red), and the upload declarations (removed from the factories → both int cases red, expected null to be '/api/images/file/…'), plus the collector and the prepend order against a broken walk. Earlier rounds are in the commits.

Why the hook moved out of src/lib/utilities/. tests/unit/lib-boundary.spec.ts fails a module under src/lib/ whose only consumer lives outside it, and the plugin is now that one consumer. src/plugins/ is where a module registered in payload.config.ts belongs.

Why meditation-transcripts-data.spec.ts gained no cases, though the ticket's checklist asks for them: none of the seven new heard forms appears in the seed corpus — that library was transcribed with a prompt, which is the ticket's own premise. Assertions there would have been vacuous, and that file exists to rule out exactly that. Its pinned counts are therefore untouched, and it passes. The new-form cases live in glossary.spec.ts, which owns applyGlossary.

The unit-lane figures moved to 244 / 3172 for the two new specs. perf-figures-pinned.spec.ts holds that across tests/PERF.md and its four consumer docs, so a stale figure anywhere reddens the lane.

Closes #1084

🤖 Generated with Claude Code

https://claude.ai/code/session_01Mg9rjY5YeGYqkyhkH9RmYX

The library's 126 transcripts read correctly because the run that made them
sent Lemonfox a list of our terms as its `prompt`. The live job sent none, so
a transcript made today came back with `muladhara` for Mooladhara and
`condalini` for Kundalini, and `glossary.json` mapped one heard form per word,
so nothing caught either.

Both halves are restored, and both are needed: the prompt makes a right
spelling likelier, the glossary pass is what guarantees it (#897, decision 3).

`glossaryPrompt` builds the list from the same `written` forms the pass
applies, so the vendor is asked for exactly the spellings we would correct it
to, and the list cannot drift from the one that corrects it. It is built inside
`requestLemonfoxTranscript` from the locale that is already mapped there, so no
caller can forget it, and a language no entry claims sends no prompt rather
than English spellings.

Whisper's window is about 224 tokens and nothing reports an overflow, so the
list is cut here, in file order, rather than at an end we cannot see. Today's
24 spellings are 234 characters against a 448 cap, and a spec pins that the
whole list still fits — a cut is a decision to make, not a cap to raise.

The new heard forms are the five IAST spellings a prompt-less run produces
(`muladhara`, `condalini`, `kundalinee`, `svadhisthana`, `ajna`) plus the two
classical names #1084 asked to review. `manipura` and `vishuddha` take their
own capital rather than being rewritten to Nabhi and Vishuddhi: a narrator
saying Manipura said Manipura, and a rename would impose a terminology choice
nobody made — the same reason `anahat` and `anahata` both stand.

None of the seven appears in the seed corpus, which is what the pinned
spelling counts in `meditation-transcripts-data.spec.ts` rest on, so that
file's figures are untouched.

Refs #1084

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjYRkZwx5HJqKQNf5VE
`status` and `error` are computed on read from `segments` and the job row, and
an include-mode `select` strips a stored field before the afterRead field hooks
run. So `?select[status]=true` told a caller every finished transcript had
failed — all 121 of production's completed rows — while the admin tab, which
decides from the cues, looked fine.

Events solved exactly this for `webPath`, `webUrl` and `offersMailingList`,
with a hook holding a hard-coded dependency map. That map is data, not
behaviour, so the hook becomes a factory in `@/lib/utilities/virtualFieldDeps`
and each collection declares its own deps inline on `beforeOperation`. Events'
single-purpose `hooks/ensureVirtualFieldDeps.ts` goes with it: a map plus one
call reads better at the call site than in a file of its own.

`meditation-transcripts` declares `status: ['segments', 'job']` and
`error: ['job']`. The `error` half is the same defect, unreported: a select
naming `error` without `job` answered null for a run that had failed.

Answering `null` for an unselected input was the ticket's other option. It
fails its own fourth criterion — the two reads must agree — so the input goes
back in instead.

⚠ The cost is that the input is returned too, because nothing can select a
field for a hook alone. `?limit=200&select[status]=true` therefore carries 200
full cue arrays. Reviewer's call: the alternatives are a per-row existence
query (200 queries), or a stored status column, which `status.ts` rejects for a
reason that still holds — a second record of a run can disagree with the job
row, and did.

Refs #1084

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjYRkZwx5HJqKQNf5VE
`perf-figures-pinned.spec.ts` pins the file count to what is on disk and makes
every consumer doc agree with `tests/PERF.md`, so adding
`virtual-field-deps.spec.ts` turns the lane red until the figures move. 240
files and 3110 cases, measured on this branch. Timings are untouched: the
lane still runs in 56 s here, inside the 78 s the table records.

Refs #1084

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjYRkZwx5HJqKQNf5VE
Found while generalising `ensureVirtualFieldDeps` for #1084: `pages` has the
same defect and nothing had declared it. `webPath`, `webUrl` and `appUrl` are
computed on read from `slug`, behind `publicUrlFields`' publish gate on
`_status`, and an include-mode `select` strips both before the afterRead field
hooks run.

An API client must send a `select` on every read (`docs/rules/api-clients.md`),
so `?select[webUrl]=true` answered null for every published page — the one
shape a consumer asking only for a page's URL would use. Confirmed against the
integration lane before fixing: the unselected read gave
`http://localhost:5173/scratch-page`, the selected one gave null.

`appUrl`'s extra gate reads `data.id`, which a select always returns, so all
three take the same two inputs.

`regions` spreads the same factory and needs nothing: it sets
`requirePublished: false` and `buildRegionWebPath` reads only `data.id`.

Refs #1084

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjYRkZwx5HJqKQNf5VE
No behaviour change. What the simplify, reuse, efficiency and altitude passes
found worth fixing:

`ensureVirtualFieldDeps` now uses `isRecord` (`@/lib/utilities/isRecord`, the
repo's single source for that guard) instead of carrying its own `typeof`
check, which drops two casts. `Object.entries(deps)` is hoisted into the
factory, where it is resolved once, rather than rebuilt on every read — the
conversion from a module-level map made that hoist available and had not taken
it. And inputs are tested against the growing object again, as the deleted hook
did: Events shares `region` and `_status` between `webPath` and `webUrl`, so the
flat `.filter` wrote both keys twice. The select is copied only once something
is added, so a read naming no computed field keeps the caller's own object.

`glossaryPrompt` and its cap had been inserted between `applyGlossary`'s
docblock and `applyGlossary`, leaving that docblock describing a constant and
the function with none.

Events' `beforeOperation` comment goes back to the per-field reason the
deleted hook carried — which input each computed field reads — and leaves the
general rule to the helper's own docblock. The `#1084` story is told once at
`glossaryPrompt` rather than restated at the call site.

`docs/rules/endpoints.md` was the one doc surface left stale: its co-select
bullet taught the caller-side fix alone, so an endpoint author never learned a
collection can settle it. `src/AGENTS.md`'s new entry had been appended inside
the `url` note's text, which left that note with no visible end.

Two unit cases went: a list of chakra names every rewrite case above it already
pins, and a no-locale prompt assertion folded into the existing no-locale case,
which builds the identical request. Hence 3108 cases, not 3110.

Refs #1084

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjYRkZwx5HJqKQNf5VE
Two stale lines, found during this ticket's docs sweep.

`docs/architecture.md` said `meditation-transcripts` is "named in
`RESTRICTED_COLLECTIONS`, so no client key reads it". It is not in that set
(`src/plugins/access/config/projects.ts` lists five collections, none of them
this one), and the collection has a `CLIENT_PARENT_STATE_SCOPES` entry — which
exists only for a collection clients do read. `MeditationTranscripts.ts`'s own
docblock and two cases in `tests/int/meditation-transcripts.int.spec.ts` say
the opposite of the doc. The line now states the real rule: a client reads the
rows whose meditation is published and untrashed.

That matters beyond tidiness here, because it decides who pays for this PR's
`segments` co-select — a client feed, not just the admin panel.

Both the collection entry and the `TranscribeMeditation` entry also described a
transcription that sends no vendor prompt, which is no longer true.

Refs #1084

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

railway-app Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

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

Service Status Web Updated
SahajCloud ✅ Success (View Logs) Web Nov 10, 2026 at 5:31 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.

2 questions for the reviewer, one per thread.

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


Generated by Claude Code

@sydevs-bot

sydevs-bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 no session running
CI fix 1

recent dispatches
  • 17:14Z resolve-conflicts · attempt 1 · session · done
  • 17:14Z resolve-conflicts · attempt 1 · session
  • 22:44Z resolve-conflicts · attempt 1 · session · done
  • 22:44Z resolve-conflicts · attempt 1 · session
  • 21:53Z resolve-conflicts · attempt 1 · session · done

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

@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 5, 2026
@sydevs-bot sydevs-bot moved this from Pending to Working in SYDevelopers Technical Roadmap Nov 5, 2026
The smoke spec `cors-preflight.e2e.spec.ts` failed on
`expect(allowed).toContain('x-turnstile-token')`, reading back only
`…, x-sahajcloud-preview-secret` from the preview.

Nothing in this branch caused it, and nothing in this branch could fix it.
#1085 landed on main one commit ago, adding both the assertion and the
`TURNSTILE_TOKEN_HEADER` entry in `payload.config.ts` that satisfies it. The
two reach CI by different routes: Actions checks out the pull request's merge
ref, so the suite already ran main's new assertion, while Railway builds the
preview from the branch head, which predates the config change. The spec
therefore asked a server built without the header for that header.

Merging the base closes the gap — the next preview builds with the entry.

Refs #1084

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjWtNAKQrTJVjeBpXuQ
@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-1087 November 5, 2026 23:55 Destroyed
@sydevs-bot sydevs-bot removed the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 5, 2026
@sydevs-bot sydevs-bot moved this from Working to Pending in SYDevelopers Technical Roadmap Nov 5, 2026
@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 6, 2026
@sydevs-bot sydevs-bot moved this from Pending to Working in SYDevelopers Technical Roadmap Nov 6, 2026

@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 three things #1084 asked for are here, each at the one seam a later caller cannot forget, and the joined pages fix is the same defect in the same read path. Nothing is smuggled in: moving ensureVirtualFieldDeps out of Events/hooks/ is forced by the second and third declarations, and it deletes a hard-coded map while adding a parameter. Both judgement calls are already question threads, so I asked neither again.

The one shape question is membership. The diff builds the shared owner, then leaves meditations outside it — while its own co-select comment calls a dropped input a silent correctness regression, and the new file documents that the next computed field can still forget a declaration rather than making that impossible.

Findings

  • should-fix — meditations carries the same select defect and declares nothing. Thread on src/lib/utilities/virtualFieldDeps.ts:19.
  • consider — the declaration could sit on the field and be installed once, not per collection. Thread on that file's line 30.

What was checked

Read whole on the branch: virtualFieldDeps.ts, MeditationTranscripts.ts, Pages.ts and its webPath, Regions/webPath.ts, publicUrlFields.ts, glossary.ts, transcribe.ts, fallbackTitle.ts, meditationShape.ts. Each declaration checked against the hook reading it: status reads data.segments and data.job, error reads data.job, the three Pages links read slug plus the per-locale _status map. Ladder: Payload declares a hook's stored inputs nowhere, so this is the repo's prior answer parameterised. Every virtual: true field under src/collections walked — Regions needs none, reading id alone with requirePublished: false. Preview up; the body's /api/pages?select[webUrl]=true link answers 403 unauthenticated, needing a client key the body omits.

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


Generated by Claude Code

Comment thread src/lib/utilities/virtualFieldDeps.ts Resolved
@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 Nov 6, 2026
`meditations` is the parent collection of the row #1084 was filed against, and
it carried the same defect. `durationMinutes` reads `data.duration` and `title`
reads `data.subtleSystemNodeWeights`, both of which an include-mode `select`
strips before the afterRead field hooks run — so an API client, which must send
a `select`, read `null` for either one.

`MEDITATION_CARD_SELECT` compensated by hand for the internal card reads, and
its own docblock called a dropped input "a silent correctness regression". An
external caller had no such compensation. The collection now declares both, so
every read path is covered rather than the one that remembered.

`url` is deliberately not declared. The `url`→`filename` co-select is still each
caller's on all eight upload collections (`docs/rules/endpoints.md`), and
retiring that is the wider question asked on this PR's own thread.

That declaration also makes `MEDITATION_CARD_SELECT`'s claim false, so the
docblock now says what still earns each entry its place:
`scoreMeditationByNodes` reads the weights itself.

Refs #1084

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjWKrYmmJZenc8SkY21
@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-1087 November 6, 2026 00:23 Destroyed
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

One finding adopted, one asked. Pushed 76903ee.

  • Adopted — meditations declared nothing. It now declares durationMinutes: ['duration'] and title: ['subtleSystemNodeWeights']; each watched failing with the other declared alone. Resolved.
  • Asked — a field declaring its own inputs. Recommended B, its own ticket: it rewrites the read path of eight upload collections. Open, so it holds the merge.

Joined with the first: MEDITATION_CARD_SELECT's docblock said dropping a co-select nulls the virtual. The declaration makes that false, so it now names what still earns each entry its place.

The two question threads from the first review still wait on you — the segments co-select, and manipura/vishuddha.

Lean gate green. meditations.int (25) and lecture-related-meditations.int (16) pass.

🤖 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 Nov 6, 2026
@sydevs-bot sydevs-bot moved this from Working to Pending in SYDevelopers Technical Roadmap Nov 6, 2026
@sydevs-bot
sydevs-bot marked this pull request as ready for review November 6, 2026 00:40
#1058 extracted both atlas endpoints' resolution into `seo/resolve.ts` and
`sitemap/resolve.ts`, taking the `SELECT` blocks this branch had only
re-commented. Took main's `index.ts` on both, and re-applied the comment where
the blocks now live — the `ensureVirtualFieldDeps` wording main kept names a
module this branch moved under `src/plugins/virtualFields/`.

`src/migrations/index.ts` keeps both new migrations, in timestamp order:
`20261106_094841_clients_one_site` then `20261107_213230_transcript_segment_count`.
Their DDL is disjoint, and the newest snapshot
(`20261107_225000_atlas_clock_copy.json`) is main's schema plus `segment_count`
alone, so the chain re-emits nothing.

The four pinned unit-lane figures are re-measured rather than taken from either
side: 254 files and 3431 cases, both branches' new specs counted.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjWRrD1cdL3yf1xuhrv
@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-1087 November 10, 2026 17:25 Destroyed
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

Merged main in. #1058 had moved both atlas endpoints' SELECT blocks into seo/resolve.ts and sitemap/resolve.ts, so main's index.ts won on both and the comment this branch changed was re-applied where the blocks now live.

src/migrations/index.ts keeps both migrations, in timestamp order: clients_one_site, then transcript_segment_count. Their DDL is disjoint, and the newest snapshot is main's schema plus segment_count alone, so the chain re-emits nothing.

The four pinned unit-lane figures were re-measured rather than taken from either side: 254 files, 3431 cases.

Lean gate green. atlas-seo.int, atlas-sitemap.int, pages.int, meditation-transcripts.int and virtual-field-select.int pass — 117 cases.

🤖 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 Nov 10, 2026
@sydevs-bot sydevs-bot moved this from Working to Pending in SYDevelopers Technical Roadmap Nov 10, 2026
@sydevs-bot
sydevs-bot added this pull request to the merge queue Nov 10, 2026
Merged via the queue into main with commit b3a33f5 Nov 10, 2026
14 of 15 checks passed
@sydevs-bot
sydevs-bot deleted the claude/fix-1084-transcript-spelling-and-status branch November 10, 2026 17:54
sydevs-bot added a commit to sydevs/WeMeditateWeb that referenced this pull request Nov 10, 2026
@sydevs-bot sydevs-bot moved this from Pending to Done in SYDevelopers Technical Roadmap Nov 10, 2026
sydevs-bot pushed a commit that referenced this pull request Nov 10, 2026
All four conflicts were the unit lane's file and test counts again, the
same fact that conflicted at `7700e72`. Both sides re-measured from the
merge base's 251 / 3382: main's transcript and virtual-field work (#1087)
to 254 / 3431, this branch to 255 / 3433. Neither is right once both sets
of specs are in the tree, so the four docs are recounted against the
merged tree: 258 files / 3469 tests.

Both numbers are measured, not summed. The file count sums — 258 is
251 + 4 + 3, and the tree holds 258 — but the test count does not: the
sum would be 3482 and the lane reports 3469. Each side's figure was
captured at its own tree, and `perf-figures-pinned.spec.ts` pins only
the file count to disk, so a summed test count would have passed the
gate while being wrong by 13.

`testing-reqs.md` states the pair twice and both statements conflicted
this time; at `7700e72` only one did.

`tests/PERF.md` gains its own row for this run, per the file's rule that
a measurement is recorded rather than replaced.

No code file conflicted. #1087's virtual-field plugin moves
`ensureVirtualFieldDeps` out of `src/collections/Events/hooks/` into
`src/plugins/virtualFields/`, and this branch touches neither path;
its `src/payload.config.ts` and `src/plugins/storage/urlFields.ts`
edits merged clean beside the preview gate's.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjYMutMUXRWbw4jCzLF
sydevs-bot pushed a commit that referenced this pull request Nov 10, 2026
Merging main brought `20261107_213230_transcript_segment_count`, whose
timestamp sits below this branch's `20261110_172159_snapshot_resync`. The
newest snapshot therefore lacked `meditation_transcripts.segment_count`,
so the next `migrate:create` re-emitted the ADD COLUMN that migration
already ships — the out-of-order snapshot trap (#566), which aborts the
boot migration on its first statement.

The generated `.ts` is emptied and its `.json`, taken on the merged tree,
is kept as the highest-timestamp snapshot. A probe run afterwards writes
no files.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjVM7gex48fVkiiedWq
sydevs-bot pushed a commit that referenced this pull request Nov 10, 2026
main's #1087 landed `segmentCount`, the glossary prompt and the
`virtualFields` plugin on `meditation-transcripts`, which this branch
renamed. Five conflicts, resolved to keep both sides:

- `Transcripts.ts` takes `virtualFieldInputs` and drops main's retention
  imports, since this branch replaced the orphan sweep with a cascade.
- `stampSegmentCount.ts` lands in `Transcripts/hooks/`, where git's
  rename detection pointed it.
- `20261107_213230_transcript_segment_count` now names `transcripts`.
  The rename carries an earlier timestamp, so on a database running the
  whole chain that statement arrives after it and the old name no longer
  resolves.
- `glossary.spec.ts` and `meditation-transcripts.int.spec.ts` take main's
  new cases against the new slug, `source` and `Transcript`.
- `docs/architecture.md` keeps the vendor-prompt sentence and this
  branch's own retention line.

Three imports main wrote against `@/collections/MeditationTranscripts/`
follow the folder.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjVrwJ8PmPr3vtULXhb
sydevs-bot pushed a commit that referenced this pull request Nov 10, 2026
`20261107_213230_transcript_segment_count` carries a timestamp older than
this branch's newest snapshot, so `migrate:create` re-emitted its
`segment_count` column. Keeping the generated `.json` and emptying the
`.ts` heals the chain; a probe run then writes nothing.

`20261110_172005` heals the chain as it stood before this merge, so it is
superseded and goes.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjVrwJ8PmPr3vtULXhb
sydevs-bot pushed a commit that referenced this pull request Nov 10, 2026
The `transcripts` row said nothing about the derived status under a
`select`, or the stored cue count behind it, and the glossary row said
nothing about the vendor prompt. All three now have assertions on this
branch.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjVrwJ8PmPr3vtULXhb
sydevs-bot pushed a commit that referenced this pull request Nov 10, 2026
#1087 moved the unit lane's recorded counts again. Both sides had raised
them from the merge base, so neither figure describes the merged tree;
these are re-measured in the next commit, from this tree's own gate run.

No code conflict. #1087's own files and this branch's do not overlap.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjVR6JWLAcsDvjpUicx
sydevs-bot pushed a commit that referenced this pull request Nov 10, 2026
255 files and 3445 tests, from this tree's own gate run. #1087 raised
main's figures while this branch raised its own, so the merge left all
four consumer docs stating a pair that described neither side.

`perf-figures-pinned.spec.ts` pins the file count to disk, so only that
half could go red; the test count is held by the four docs agreeing,
which is how the figure drifted before (#990).

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjVR6JWLAcsDvjpUicx
sydevs-bot pushed a commit that referenced this pull request Nov 10, 2026
main's #1087 and this branch both bumped the unit lane's pinned figures,
which conflicted in all four consumers of tests/PERF.md. Neither side's
arithmetic is the answer: the figures are a measurement, so the merged
tree was measured. 255 files and 3440 tests, from the lean gate's own run
on the merge — not 251+1+3 / 3382+22+49, which overcounts the tests by 13.

No source overlap. main added the virtualFields plugin and the transcript
segment count; this branch touches registrations, so the two meet only in
those four docs.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjZSYDvxKuooZntr7uU
Ardnived added a commit that referenced this pull request Nov 11, 2026
…#1047) (#1105)

* fix(access): lock every Managers field read to the row's holder or an admin

Ports the first half of #1045 (commits 1f5c3fb..4e71879) onto main, without
its region widening or its activity-log address projection.

`atlas-region-manager` holds a collection-wide `managers: read` so the
`Events.manager` and `Regions.managers` pickers can list other managers
(#821). Nothing narrowed it, so every region manager read every manager's
email, contact methods, notification preferences and imported legacy row.

- `lockManagerFieldReads` gives every field but `name` a self-or-admin `read`
  lock. `email` and `_verified` are redeclared at the top level so the lock
  has a base field to merge onto, keeping Payload's i18n labels.
- `loginPlugin`'s three machine columns carry the same lock.
- `stripLockedFieldsOnSelfRead` stands down off the caller's own row, so an
  internal `overrideAccess` read of a colleague keeps its fields.
- `UserSubmissions.previewEvent` selects only the assigned manager's name.

Refs #908

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* feat(managers): record when a manager last signed in

Nothing recorded it: `sessions` loses its row on sign-out and prunes expired
ones, and `updatedAt` moves on every write, the digest job's included. The
manager contacts table needs it to tell an active colleague from one who
never accepted.

- `loginPlugin` appends `lastLoginAt`, read-only and `update: () => false`,
  with its own self-or-admin read lock like the other appended columns.
- `createSession`, the one place a session is minted, stamps it in the same
  write as the session row.
- The migration adds the column and fills it from `legacyData.lastLoginAt`,
  which the Atlas import kept for 448 of 516 managers. A hand edit, asked for
  on this PR, on the #1087 precedent: a projection of the same row.
- The Atlas import maps it from now on, keeping the later of the stored and
  the legacy date, so an `--update` never rewinds a real sign-in.

Refs #908

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* feat(atlas): show a region's and an event's managers to the managers above

With every field but `name` locked on another manager's row, a region
manager had no way to reach the people their region names. The details come
back the way an event's registrants do: through a surface that checks its own
gate and then reads past the locks, rather than a field lock widened per
reader.

- `mayReadManagerContacts` is the gate: an admin, the event's own manager, or
  an active manager whose owned subtree holds the region. That is a region's
  co-managers and the managers of every region above it, downward only.
- `managerContactsField` puts one shared table under `Regions.managers` and
  `Events.manager`: Payload's condensed `Table` with the name, a `mailto:`
  email and the last sign-in. It reads the stored row by id, never the form
  data, and for an event the published row.
- `Events.activityLog` reads behind the same gate (`eventContactsFieldAccess`,
  through a new `read` option on `logField`), since its reminder entries
  record where each one went. With no row in hand it answers for admins only.
- `previewEvent` loads its target without the log: a proposal reaches the
  managers of the region it proposes, who need not be the event's.
- Region-manager reminders already carry the event manager's email. A case
  now pins it against the new locks.

Refs #908, #1047

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(seeds): keep firstDomain's doc block on firstDomain

`laterDate` landed between the block and the function it documents, so a
reader got the legacy-domain explanation above a date comparison.

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

* fix(admin): declare the contacts row type beside its loader

`import type` is erased, so the client table taking the row type from
`data.ts` pulls no server module into the browser bundle — the shape
`EventRegistrations` already has, where `RegistrationRow` is declared in its
own `data.ts`.

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

* refactor(atlas): render the manager contacts table under the field description

The table is now the `Description` of `Regions.managers` and `Events.manager`
rather than a `ui` field of its own: it renders the field's own description,
then the table, as `PermissionsTable` sits under `Managers.roles`. Both fields
also declare an empty `afterInput`, because Payload otherwise renders a
`Description` once and keeps it through a save, and the table would go on
listing the managers the page loaded with.

The last sign-in is one line, `2026/11/10 - 3 weeks ago`, in three states:
normal, red past six months, and a muted "Never".

Refs #908

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(admin): spell the contacts table's sign-in day with formatShortDate

The table's own helper gave `2026/11/10`, under a reason — one unambiguous
spelling in every locale — that the module's existing `formatShortDate` already
satisfies. It also spells a UTC day, returns `''` for an unparseable value, and
is what the Registrations table beside this one shows a date with, so both
tables now read the same.

The spec spells the expected day out rather than calling the formatter, so the
day the table shows stays pinned against it.

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

* fix(admin): take the contacts component's props from Payload's own types

`path` arrives through `renderField`'s `clientProps`, which Payload types as
`FieldPaths`, so `Pick<FieldPaths, 'path'>` says what `{ path?: string }` was
restating — and it is always set, so the `''` fallback is gone with it.

`admin.description` needed no structural cast either, only a narrower field
type: `ServerComponentProps['field']` is the whole `Field` union, whose `row`
and `tabs` members omit `description`, while both registrations are on a
relationship picker.

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

* fix(admin): put the contacts table in Payload's afterInput slot

`RelationshipInput` renders `AfterInput` and then the `Description` slot, so
the table reaches the same place from the slot Payload already provides for it
— and a `beforeInput`/`afterInput` key is what `renderField` tests to re-render
a field's components on every form-state request, so the save-follows behaviour
now comes from the registration itself rather than from an empty array beside a
`Description` override.

That override existed only to put the table below the description. Paying for
it were four pieces: re-rendering `FieldDescription` by hand, the `path` prop
it needs, the `RelationshipField` narrowing for `admin.description`, and the
empty-array trap with a ⚠ on each field and in the component. The table now
sits above the description instead.

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

* docs(access): cut what the field-lock JSDoc already carries

Three ⚠ blocks restated, near-verbatim, the JSDoc on `selfOrAdminFieldAccess`
and `stripLockedFieldsOnSelfRead` — and this file loads whenever either is
edited, so every reader paid for both copies.

Each keeps its rule, its #NNN breadcrumb and the one line a reader cannot
re-derive, and hands the mechanism back to the JSDoc beside the code that
implements it.

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

* fix(admin): drop the contacts table's unreachable name fallback

`Managers.name` is `required: true`, so `name || email` never took its second
arm — and had it ever fired, the Name column would have printed an email.

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

* chore(migrations): snapshot resync after the seventh main merge

main's 20261110_234836_clients_label_title snapshot was generated on main,
so it knows nothing of the last_login_at column this branch adds — and its
timestamp is the higher of the two. migrate:create diffed against it and
re-emitted ALTER TABLE "managers" ADD COLUMN "last_login_at", which
20261110_220603_manager_last_login already ships. Replaying one statement
aborts the boot migration (#566).

So the generated file keeps only its .json snapshot, taken on the merged
tree, which carries both sides and heals the chain. A probe run afterwards
writes no files.

CI cannot see any of this: push: !isProduction syncs the schema with Drizzle
push and never replays the chain. Only a Railway boot does.

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

* fix(clients): read the audit's service name from label, not name

#1108 split the clients `name` field into `label` and `title`, and #1106
landed afterwards still reading `name`. Each was green on its own branch,
so main carries a tsc failure neither PR could see: `name` is not a key of
Client.

The audit is operator-facing, so it takes `label`, the internal name, not
`title`, which is the name registrants see.

This is main's break, not this branch's, and it reddens this PR's gate and
CI all the same.

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

* refactor(access): trim the manager contact locks to what they need

The new comments were 44% of the PR's added source; cut to the why, keeping
every warning. The unit sweep over the Managers field locks repeated the
integration sweep, which reads the booted config and so already sees the
login plugin's columns and the base auth fields: the integration spec now
carries the non-vacuity check, and the unit spec keeps the
`selfOrAdminFieldAccess` cases. `stripLockedFieldsOnSelfRead` drops its
unselected-field skip, a shortcut that saved nothing once the hook ran on
the caller's own row alone. `MANAGER_PUBLIC_FIELDS` is no longer exported.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(admin): put the contacts table back under the field description

f0f14eb moved the table into `afterInput`, which `Relationship/Input`
renders above the description. Under the description is where the owner
asked for it, as `roles` sits on Managers, so both fields register the
component as their `Description` again, with the empty `afterInput` that
re-renders it after a save. The component's docblock now says why the slot
is `Description`, so the next review can see the placement was chosen.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

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

This branch was successfully deployed

No deployments
sahajcloud / SahajCloud-pr-1087 — 8482d2a1 Deployed Nov 10, 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(transcripts): a new transcript misspells our words, and select hides status

3 participants