Repository navigation
feat(clients): split name into internal label and public title - #1108
Conversation
`name` was an internal name doing double duty as the sender name on
registrant emails. It is now `label` ("Internal Name", required) beside
an optional `title` ("Public Title"), matching Meditations.
Registrant emails name a service by `clientPublicTitle`: its title, else
its site's domain, resolved at read time so a later domain change is
never frozen behind a copied title. Manager-facing mail (contact
subjects, usage alerts, the admin dashboard) keeps the internal label.
The list view gains a `domain` column: a read-only virtual field off
`site.domain`, which is `admin.disabled` and cannot be a column itself.
The migration renames the column in place rather than drizzle's
drop + add, so every service keeps its name.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…list The Atlas tab now reads Public Title, Logo, the three colours, Reply-To, then the Mailing List group — the "Brand Colors" and "Registrant Emails" groups were unnamed, so dropping them moves no column. `domain` is a list column alone: the install summary already shows it on the form, so a false `condition` hides the field without dropping the column, which `admin.hidden` would. A stray copy of it inside `mailingList`, added by the previous commit, is removed. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
🚅 Deployed to the SahajCloud-pr-1108 environment in sahajcloud
1 service not affected by this PR
|
|
@sydevs-bot review |
sydevs-bot
left a comment
There was a problem hiding this comment.
🧐 Adversarial review
The diff is no larger than its own body. A rename, one new field, one admin-tab reshuffle, and the reshuffle earns its own commit. The consumer side holds: the select gate only requires a non-empty object (hooks.ts:247), so the widget's stale name key is ignored and organizer drops out instead of 400ing.
Both open questions are about existing rows at boot, not about shape. The rename has no copy step; title has no backfill. Neither is hidden — the body raises the first — but each changes behaviour for every service at deploy, and one two-step migration answers both.
Findings
should-fix— the rename gives the old container a window of failingclientsreads, auth included (migration).should-fix—titleis null everywhere, so every registrant email's sender name becomes a bare domain (migration).should-fix—src/components/admin/InstallGuide/InstallView.tsx:69still saysuseAsTitle="name"(Clients.ts).consider—siteOf's docblock undercounts its readers (domainfield).
What was checked
Read whole: Clients.ts, lib/clients/site.ts, plugins/email/brand.ts, the migration, plugins/usage/hooks.ts. Ladder on both new pieces: clientPublicTitle joins primaryPageUrl and ownedHost in the module that owns SiteFields; the domain twin is forced — site is admin.disabled, allowedDomains a disabled textarea. Consumer side followed into SahajAtlasWeb: fetch.ts:736, types/client.ts, EventMetadata.tsx:72. Swept the branch for a stale name across every collection: 'clients' read and every useAsTitle; one hit, above. The hand edit is what src/migrations/AGENTS.md prescribes for a rename. The preview boots (200), but push: !isProduction means it never replays the chain, so the body's scratch-database run is the only evidence for the migration.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
| // service keeps its internal name. | ||
| export async function up({ db }: MigrateUpArgs): Promise<void> { | ||
| await db.execute(sql` | ||
| ALTER TABLE "clients" RENAME COLUMN "name" TO "label"; |
There was a problem hiding this comment.
should-fix — The rename lands when the new container boots, so the old one's clients reads fail until traffic switches, and API-key auth reads that table. Every widget read 500s in that window, on someone else's page.
Take the split the body offers: add label, copy name into it, drop name in a later deploy. A dead column for one deploy is cheaper than a 500 a host sees.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
There was a problem hiding this comment.
Keep the in-place rename, or split it?
- A — keep the rename (built). One window at deploy where the old container's
clientsreads fail, API-key auth included. - B — add
label, copy, dropnamein a later deploy. No window, butnamemust also lose its NOT NULL or new inserts fail, and this preview has applied the migration, so a rewritten one never runs there.
Reply with a letter.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
| export async function up({ db }: MigrateUpArgs): Promise<void> { | ||
| await db.execute(sql` | ||
| ALTER TABLE "clients" RENAME COLUMN "name" TO "label"; | ||
| ALTER TABLE "clients" ADD COLUMN "title" varchar;`) |
There was a problem hiding this comment.
should-fix — title is null on every existing row, so clientPublicTitle falls through to site.domain for all of them. Every service's registrant emails switch sender name from a human name to a bare domain the moment this deploys.
20261107_213230_transcript_segment_count.ts carries a backfill for this exact shape, at the owner's request (#1087). Backfilling from label re-leaks the internal name, so this is a trade-off to decide, not an edit to make.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
There was a problem hiding this comment.
What should a null title send as?
- A — leave it null (built). Every service's registrant mail sends as its bare domain until someone fills Public Title.
- B — backfill
titlefromlabel. Sender names stay as today, and every internal name becomes public. - C — fall through to the brand, not the domain. Every service sends as Sahaj Atlas until Public Title is set.
Reply with a letter.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
The Install view kept its own `useAsTitle="name"`, which the rename to `label` left naming a field that no longer exists. `SetDocumentStepNav` only tests the prop for presence and `!== 'id'` — the label itself comes from `useDocumentTitle()` — so the breadcrumb never visibly broke, and the next rename could break it for real. `grantSummary.ts` already reads `config.admin?.useAsTitle` rather than keeping a copy. Doing the same here leaves one spelling. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjVtTLK7Y1mm5YssZfw
The new `domain` column reads `site` too, so the docblock's "the two compatibility fields below" undercounted its callers. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjVtTLK7Y1mm5YssZfw
|
Built
Open, waiting on you
🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
Both sides appended their own last entry to the migration list, so the conflict is positional only: #1108's clients label/title migration and this branch's snapshot heal are independent, and both are kept, ordered by timestamp. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjWBjeqwkAh17i3wvun
#1108's `20261110_234836_clients_label_title` snapshot was generated on main, so it carries `intro_audio_id` and `intro_subtitles` on `lessons`. Being newest by filename it is what `migrate:create` diffs against, and a run on the merged tree re-emitted all eight statements the localize migration already ships. Keep that run's `.json`, empty its bodies, and carry no copy of the backfill. A probe `migrate:create` after it writes no files. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjWBjeqwkAh17i3wvun
…er-contacts One conflict, in src/migrations/index.ts: main's #1108 and this branch each append a migration, so both sides claim the last array entry. Both are kept, ordered by timestamp — 20261110_220603_manager_last_login before main's 20261110_234836_clients_label_title. Neither touches the other's table. Everything else merged clean. main's rename of the clients `name` field to `label` plus a new `title` reaches seeds/atlas/import.ts in a region this branch does not touch, and src/payload-types.ts regenerates byte-identical to the merged file. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjUvzMXoQtMoVVQaYYp
#1108 renamed Clients.name to label; #1106 landed after it with two new scripts still reading name. The two touch different files, so GitHub merged #1106 without a conflict and main has not typechecked since: tsc --noEmit on e543e6a reports the same three errors this branch inherited on merging it. Both scripts are operator audits printing an internal identifier, so label is the right half of the split rather than the public title. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjWo4RQkAJtqPe72vrB
…udit `main` does not typecheck. #1106 added `audit-challenge-parents.ts` and `challenge-mounts.ts` reading `Client.name`; #1108 split that field into a required internal `label` and an optional public `title`. Each was green against its own base, and #1106 merged second, so `tsc` fails on `main` itself at three sites — not at any conflict between the two branches. Merging `main` brought the break here, which is why it is fixed here. `label` is the field the split kept for operator-facing output: required, never shown to the public, and what manager-facing mail already uses. `title` is optional and would print nothing for most services. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjZTnsrufohceG18CSK
#1106's audit picks `Client['name']`, which #1108 had already renamed to `label` — it branched before that rename and merged after it, so `main` itself does not typecheck. Nothing caught it: neither lint nor Vitest runs `tsc`, and CI's test step does not either, so the Railway build is the first place it fails. The audit prints the service's internal name, which is what `label` holds. Found by the lean gate on this merge, and fixed here because that gate is what the merge had to pass. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjZ93GJSxZ1zH4BGeHT
#1106's challenge audit selects and prints `Client.name`, which #1108 renamed to `label` in the same release. Both merged, so `main` itself fails `pnpm typecheck` — nothing in either PR's own gate crossed the other, and the type error reaches no test lane. `label` is the internal name, which is what this operator audit wants: every row it prints names a service for somebody to go and configure. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjXtaL1Gdc9Fuxxn6Sz
#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
…#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]>
Summary
A service's
namewas an internal name that also became the sender name on registrant emails. It is now two fields, matching Meditations:label— "Internal Name", required, on the Config tab. Renamed in place fromname.title— "Public Title", optional, on the Atlas tab above the logo.Registrant emails (confirmation, reminder, follow-up) name a service by
clientPublicTitle(src/lib/clients/site.ts): itstitle, else itssite.domain, else the Sahaj Atlas brand as before. The domain is read when the email is built, not copied intotitle, so a later domain change is picked up. Mail to managers — contact subjects, usage alerts, the admin dashboard's open items — keeps the internallabel.Admin
domainis a read-only virtual field offsite.domain, which isadmin.disabledand can't be a column itself. A falseconditionkeeps it off the edit form, since the install summary already shows the domain.titleis on the Atlas tab, solockTabsgives it that tab's write rule: an admin, or a manager of a service with the atlas role. Same as the logo.Migration
20261110_234836_clients_label_titleis hand-edited from drizzle's output. Drizzle generatedADD COLUMN "label" varchar NOT NULL+DROP COLUMN "name", which fails on a non-empty table and would discard every name. The edit isRENAME COLUMN "name" TO "label"+ADD COLUMN "title". Checked on a scratch database: all migrations apply from empty, and a row inserted undernamecame back aslabelafter down → up.⚠ Brief deploy window. The rename runs when the new build boots. Until traffic switches, the old container's
clientsreads fail, and API-key auth reads that table. If that's not acceptable, this can be split into add-and-copy now, dropnamein a later deploy.Cross-repo impact
namefromGET /api/clients/meand publishes it as the schema.orgorganizer. An unknown select key is ignored, so the read still answers 200, butorganizeris omitted until the widget selectstitle(falling back toallowedDomains). Follow-up PR to come there, after this merges andpnpm types:cmspicks up the new types.Testing
pnpm lint,pnpm format:check,pnpm typecheck,pnpm typecheck:tests,pnpm test:unit(254 files)client-hooks(new case for thedomaincolumn, including a narrow select),clients-access,client-canonical,region-canonical-url,atlas-seo,atlas-sitemap,collections-smoke,user-submissions-createregistration-confirmation-email.spec.tscovers the title → domain → brand fallback🤖 Generated with Claude Code