Repository navigation
fix(access): narrow manager contact details to the region chain (#908, #1047) - #1105
Conversation
… 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]>
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]>
…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]>
|
🚅 Deployed to the SahajCloud-pr-1105 environment in sahajcloud
1 service not affected by this PR
|
|
🤖 no session running recent dispatchesWritten by the sydevs dispatcher. Sessions never edit this comment. |
sydevs-bot
left a comment
There was a problem hiding this comment.
🧐 Adversarial review
The shape is the one you named on #1045: Part 1's locks kept, the region widening and the log projection replaced by one gated table plus a region-scoped Events.activityLog. The diff matches it. One gate answers both surfaces, the component follows EventRegistrations file for file, and both copies that bypass field locks are closed with a select.
lastLoginAt is the part no ticket asks for: a column, a hand-edited backfill, an importer merge, and a write in createSession. It earns the table's third column and the body says you asked for the backfill, so I name it rather than flag it. Nothing blocking.
Findings
should-fix—laterDatedetachesfirstDomain's doc block fromfirstDomain(seeds/atlas/import.ts:1711).should-fix—types.tsexists for a reasonimport typemakes untrue; the sibling declares its row type indata.ts(ManagerContacts/types.ts:2).consider—managerContactsnow names two different sets of contact methods (src/fields/managerContactsField.ts:20).
What was checked
Read whole on the branch: Managers/access.ts, adminOnly.ts, regionSubtreeAccess.ts, stripLockedFieldsOnSelfRead.ts, session.ts, logField.ts, computeReviewFields.ts, all five ManagerContacts/ files.
Ladder, per new piece: tableColumn reused, not rebuilt; the per-row gate rides resolveManagedDocIds' request memo, so no query per row; relationId taken from documentManagers, as regionSubtreeAccess does.
Consumers: logField's user-submissions caller keeps the default read, and a client still fails eventContactsFieldAccess; createSession's only callers are redeem and magicLinks, so the stamp is a sign-in, not a refresh.
Preview answered 200, unauthenticated — no sign-in link here, and no region to render the table.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
`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
`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
|
Two findings adopted, one rebutted. Pushed as 1d1d712.
The branch was already level with Gate: lint, format, both typechecks, unit lane (255 files / 3459 tests). 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
…scription 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]>
|
@sydevs-bot review The contacts table moved under the field description ( |
sydevs-bot
left a comment
There was a problem hiding this comment.
🧐 Adversarial review
Second look, on the restructure. It is a net reduction: managerContactsField and the ui field are gone, and the table now rides the picker's own Description. The shape I reviewed before is unchanged, so I judged only what moved.
I checked the load-bearing claim rather than taking it: renderField builds hasBeforeOrAfterInput from 'afterInput' in components, a key-presence test, so afterInput: [] does force the re-render. The ⚠ comments on both fields and in the spec are accurate, and the body's "three reads per form-state request" is the right reading of the cost. The same source shows path reaching the component through clientProps, so its extra prop is real, not a guess.
Nothing blocking. Two findings, both pieces that restate something already in reach.
Findings
should-fix—signInDayduplicatesformatShortDatefrom the module this file already imports, under a reason that fits both (ManagerContacts/data.ts:76).consider— the prop type and thedescriptioncast both rewrite types Payload exports (ManagerContacts/index.tsx:33).
What was checked
Read whole on the branch: all four ManagerContacts/ files, and the Regions.managers / Events.manager declarations.
Verified in node_modules, not inferred: renderField.js for the re-render test, RenderServerComponent for {...clientProps, ...serverProps}, FieldDescription (uses path for a class name only, so the '' fallback costs nothing), ServerComponentProps.field: Field.
Ladder: Table, FieldDescription, tableColumn, relationId, localeIsolatedReq, humanDurationSince all reused. Layout matches EventRegistrations/ as claimed.
Preview answered 200 unauthenticated, and nothing here gets past the admin gate, so I did not see the table.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
|
Merged
Nothing else conflicted, and Lean gate green: lint, format, typecheck, typecheck:tests, 256 files / 3468 tests. 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
…er-contacts Four conflicts. Three are one fact again: the unit lane's file and test counts, in docs/rules/testing-reqs.md, tests/AGENTS.md and tests/PERF.md. main's #1102 and this branch each added a spec file since the seventh merge, so neither side's number describes the merged tree. Measured instead: 257 files, 3488 tests. AGENTS.md states the file count too and merged clean at the stale 256, so it is corrected here — tests/unit/perf-figures-pinned.spec.ts pins all four against the tree. The fourth is an import line in src/plugins/login/invitations.ts, where this branch added selfOrAdminFieldAccess and #1102 added capture. Both are used, so both are kept. main added no migration, so the chain and its snapshot stand as the seventh merge left them. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjYptMd7SiHURhD6ufY
|
Merged Three were the unit lane's counts, in The fourth was one import line in main added no migration, so the chain and its snapshot stand. Lean gate green (257 files / 3488 tests). 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
…er-contacts Both sides added a unit spec, so both sides had raised the unit-lane counts from the same base and disagreed on the result. #1103 added spawn-subscribe-consent.spec.ts (+1 file, +9 cases); this branch added one (+1 file, +10 cases). Neither side's number describes the merged tree, so the resolution is the merged measurement: 258 files / 3497 tests, confirmed by running the lane. AGENTS.md auto-merged clean and then contradicted it, still reading 257 files. perf-figures-pinned.spec.ts is what catches that — PERF.md is the single writer, and every consumer doc is checked against it. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjZ8PpWrARoFQGw4pkU
|
Merged Both sides added a unit spec and raised the counts from the same base. #1103 added One thing the conflict markers did not show: No semantic conflict in code. Lean gate green: lint, format, typecheck, typecheck:tests, 258 files / 3497 tests passing. 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
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]>
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]>
…idnight The only conflicts were the unit-lane counts, which both sides had moved from the same base: this branch to 258 / 3492 for its new app-card spec, main to 258 / 3494 for #1105's manager-field-locks spec. Neither side is right on the merged tree, which carries both specs. Resolved to the measured merged figures, 259 files and 3499 tests, in tests/PERF.md and the three docs that quote it. AGENTS.md conflicted on neither side and still said 258 files, which perf-figures-pinned.spec.ts counts off disk, so it is corrected here too. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjWtTrd1Ud9zsbd12tv
All four conflicts were one fact: the unit lane's file and test counts. Neither side was right on the merged tree. `main` added one spec (+7 cases) in #1105; this branch added six (+53). Taking either side wholesale would have reddened `perf-figures-pinned`, which counts the specs on disk. Resolved by measuring the merged tree instead: 264 files, 3547 cases, confirmed by the lane itself rather than by adding the two deltas. PERF.md keeps its forty-eighth row at the 263 / 3540 that session measured — a recorded measurement is not the current tree — and gains a forty-ninth for this one. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjYZKEqwyKgc9kgfJ79
Closes #908. Closes #1047. Replaces #1045.
Summary
Before launch, any region manager could read every other manager's email, phone and messaging handles, both on
managersand in every event's activity log. This PR closes both. It follows the approach the Registrations tab uses, in place of #1045's per-reader field widening:nameis readable only by that manager and by admins. This is fix(access): narrow managers' contact details to the reader's region #1045's Part 1, carried over unchanged.Regions.managersandEvents.manager. It shows each manager's name, amailto:email and when they last signed in, on one line (10 Nov 2026 - 3 weeks ago), in red past six months. It is visible only to admins, the event's own manager, and the managers of the region or any region above it.Events.activityLogis readable only by that same set of people.lastLoginAtfield on managers. Every sign-in sets it, and imported Atlas managers get theirs from their Atlas record.maincarries atscfailure. feat(clients): split name into internal label and public title #1108 split the clientsnamefield intolabelandtitle; feat(atlas): audit the embed hosts the captcha challenge refuses #1106 landed afterwards still readingname. The audit script and its spec now readlabel, the internal name. Without it this PR's gate and CI are red for main's reason.Dropped from #1045:
regionContactFieldAccess,resolveContactableManagerIds,logAddressVisibility,logAddressScope, andlogField'saddressesoption with its redact/restore/duplicate hooks.Change outline
Contract — who sees a manager's contact details
Flow — one gate, read past the locks
lastLoginAtloginPlugin appends src/plugins/login/loginPlugin.ts magicLinkIssuedAt + lastLoginAt read: selfOrAdmin · update: () => false · sidebar, read-only createSession src/plugins/login/session.ts - update { sessions } + update { sessions, lastLoginAt: session.createdAt }Preview
Railway builds this PR at sahajcloud-sahajcloud-pr-1105. A fresh preview holds one admin and no regions, so to see the table, create a region and list a manager on it. The gate itself is covered by
tests/int/manager-contacts.int.spec.ts.Test results
check.sh): ✓ lint, format, typecheck, typecheck:tests, unit lane (256 files / 3468 tests).manager-contacts(15, new)event-verification(39)managers-access(21)user-submissions-review-lifecycle(40)manager-magic-linkread: 3 failed;select: 1 failed;2026/11/10again: 1 failed;Descriptionagain: 1 failed.null, a missing key and a NULL row all stay NULL.Description: a region's edit view renders the condensed table, withmailto:links, a one-line sign-in, red past six months, and a muted "Never". The move toafterInputchanges only where the table sits relative to the description.Notes for reviewer
legacyData.lastLoginAt(an ISO string) into the new column. There is no foreign key and no second table, following the fix(transcripts): a new transcript misspells our words, and select hides status #1087 precedent.escalatedstage on,ExpireEventsalready gives every region-manager reminder an "Event manager" card and amailto:"Contact manager" button. The job reads with no user, so the locks never reach it. A newevent-verificationcase pins this.afterInput, never aDescription. Payload renders aDescriptiononce and keeps it through a save, while abeforeInput/afterInputkey is whatrenderFieldtests to re-render a field's components on every form-state request — so the table follows a save. The cost is its three reads per such request.manager-contacts.int.spec.tspins the declaration on the sanitized config. The table therefore sits above the field's description rather than below it, which is what buys back the hand-renderedFieldDescription, itspathprop, theRelationshipFieldnarrowing and the empty-array trap.activityLogfrom form state, and an outsider can no longer read the log, so the tracker shows the stages without dates.docs/rules/access.md.main, where every manager reads every log. The security review rated it 2/10 and dropped it. If you want it closed, the fix is to remove the address fromrole: 'region'entries for a reader who passed the gate only as the event's manager.1f5c3fb3..4e718799) are applied here as one commit, re-resolved against main's derived roles (atlas-manager→atlas-region-manager).🤖 Generated with Claude Code