Repository navigation
feat(atlas): show where and who in the Events list, and drop the empty Events tab - #1145
Conversation
…y Events tab The Events list showed a title and two stages, so finding a city's classes — or the ones nobody runs — meant opening each row. `region` and `manager` are what the list is scanned for, so both join the default columns. A country's and a region's Events tab could only ever read "No Events found": an event names a city or a venue in `events.region`, and that field's `filterOptions` admits no other level. The condition moves from the join field to the tab, so the tab itself goes rather than leaving an empty one to click. `defaultColumns` names a column path, and a name no namespace declares renders nothing at all — no warning and no empty column. Both fields sit inside unnamed tabs, which give their fields up to the level above, so each is named flat; a rule over every collection now pins that. No schema delta: `pnpm generate:types` leaves `src/payload-types.ts` unchanged, so this needs no migration. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjWfbCpGVN1ukwEYd8V
…wner The tab condition and `events.region`'s `filterOptions` both spelled `['city', 'venue']`, with only a comment holding them together — so a level added to the picker would have left the tab hidden for it. `EVENT_REGION_LEVELS` is that fact, in `src/lib/events/`, which rule 4 names as the home for a fact two collection folders read. The specs lose what they restated. The tab spec derives the hiding levels from `REGION_LEVEL_OPTIONS` rather than naming country and region, so a fifth level gets a case for free, and its helper throws instead of handing back an optional condition. The default-column rule folds into one case: its floor is there to catch an empty sweep, which nothing about the number 15 said better than zero. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjWfbCpGVN1ukwEYd8V
|
🚅 Deployed to the SahajCloud-pr-1145 environment in sahajcloud
1 service not affected by this PR
|
sydevs-bot
left a comment
There was a problem hiding this comment.
2 questions for the reviewer, one per thread.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
|
🤖 no session running recent dispatchesWritten by the sydevs dispatcher. Sessions never edit this comment. |
sydevs-bot
left a comment
There was a problem hiding this comment.
🧐 Adversarial review
Six files, 91 lines, and both behaviours are #1142's two bullets — nothing here the ticket did not ask for. The one new piece, EVENT_REGION_LEVELS, is forced out of both collections by src/AGENTS.md rule 4 and has the two consumers lib-boundary.spec.ts demands. Putting the predicate on the tab rather than the join field matches childLevelVisible ten lines up, so the pattern is the file's own. No contract surface moves: src/payload-types.ts and the Events endpoint types are untouched.
One cost worth naming, which I propose nothing for: managers sits in no project and isImplicitlyReadable fails closed, so an atlas-event-manager holds no managers read and the new Manager column renders a raw id — on every row, since that role reaches only events naming them. The ticket asked for the column.
Findings
should-fix— the newdefaultColumnsguard flattens with hoisting off, so it checks a different name set than the list view builds (tests/unit/sanitized-config-rules.spec.ts:513).consider— thesrc/AGENTS.mdentry names one ofsrc/lib/events/'s two files (src/AGENTS.md:221).
What was checked
- Ladder on the one new piece: nothing already owns "the levels an event may attach to" —
ALLOWED_PARENT_LEVELSis the parent table,REGION_LEVEL_OPTIONSthe full set. The only other['city', 'venue']insrc/issubtitle's, dismissed in the body on a different fact. - Read whole on the branch:
Events.ts(regionalready carrieslabel: 'City / Venue'; every tab is unnamed, so both columns resolve bare),Regions.ts,resolveProposalRegion.ts, both new specs. - Payload's
buildColumnState, for the finding;roles.tsandprojects.tsfor the cost. - Preview: both links 302 to the Cloudflare Access gate, and both
PREVIEW_ACCESS_*variables are unset here. Unreachable.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
`buildColumnState` flattens with `moveSubFieldsToTop: true` and matches `accessor ?? name`, so the guard's hoisting-off flatten checked a different name set than the list actually builds. It got both directions wrong, each watched against the defect before this landed: - `events > address.venueName` — a named group's subfield is a legitimate dotted column, and the guard called it unresolved. - `events > registrationQuestions` — a group with no custom `Cell` is skipped by `buildColumnState`, so the column renders nothing, and the guard passed it. That is the exact failure the guard exists to catch. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjYpMMvAZHnUAKdimdn
The folder already held `updateEventWithoutValidation.ts` and was never listed. Naming only `regionLevels.ts` on arrival reads as though that file were the folder; every neighbour states the folder's purpose. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjYpMMvAZHnUAKdimdn
|
Both review findings adopted, pushed as 2f18ad4.
Merged Waiting on you, both built as option A: the Import classes entry point and the relationship-column cost. Lean gate green: 273 files, 3707 tests. 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
…nship The Events list now opens on City / Venue and Manager, and a relationship cell batch-fetches its target collection whole: `regions` came back with four join subqueries and its public-URL virtuals, `managers` with four joins, once per list page. `enableListViewSelectAPI` narrows that batch to `useAsTitle` — `name` on both — which is the only column the cell renders. On `managers` that is also the only field a non-admin may read (#908), so nothing else was ever usable. It applies to each collection's own list view too, which is the trade: every column there is selected by what is active rather than read whole. `regions` is covered for it already — `publicUrlFields` declares its stored inputs, pinned by `virtual-field-declarations.spec.ts` and read back under a `webUrl`-only select in `region-canonical-url.int.spec.ts`; `managers` carries no virtual field and no hook. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjYD6okZGDoVkgS1saS
Hiding the Events tab above a city took the prefilled "Import classes" link with it: the link sits on that tab's heading, and `targetRegion` accepts a country and a region as readily as a city. A country manager was left with the unprefilled entry on the Events list menu. The edit menu renders at every level, so the link goes there as well. The rule behind it — an unsaved region nothing can target, a venue with no cities to file under, a manager who cannot create an import — moves into `useImportClassesTarget`, so the two surfaces cannot offer it on different terms. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjYD6okZGDoVkgS1saS
|
Both answers built, pushed as d203bfd.
Open, and holding the merge: where Merged Lean gate green: 278 files, 3837 tests. 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
|
One thread answered, nothing to build.
No commit and no push: option A is what the branch already carries. The branch is level with Refreshed 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
* fix(regions): show the Events tab at every region level #1145 hid a region's Events tab above a city, because `events.region` admits only a city or a venue and the join is direct. That took the tab away from every country and region. The tab now shows on every saved region again, whatever its level. `EVENT_REGION_LEVELS` existed so the tab condition and the `events.region` picker could not narrow differently. With the condition gone, the picker is its only consumer, which `lib-boundary.spec.ts` refuses for a `src/lib` module, so the levels go back inline in `filterOptions`. The "Import classes" edit-menu item stays: it offers the link from every tab, not only the Events tab's heading. No schema delta: admin conditions only, so no migration and no type regeneration. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(events): keep the level rename check on the picker Deleting `EVENT_REGION_LEVELS` left `['city', 'venue']` as plain strings: Payload's `Where` does not type `in`, so renaming a level would no longer fail typecheck here. `center` → `venue` (#605) is a rename this repo has already made once. `satisfies Region['level'][]` restores that check at the cost of one type import, and leaves the picker's behaviour unchanged. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjWhhTBryJRfAQLESKH * test(regions): pin the Import classes edit-menu item The assertion went with the level-gate cases, leaving the edit-menu registration untested. It is still the only "Import classes" surface a tab other than Events renders, since the Events tab's heading renders only while that tab is open. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjWhhTBryJRfAQLESKH * fix(regions): list the subtree's classes on the Events tab A join resolves one reverse lookup, and `events.region` admits a city or a venue, so `on: 'region'` leaves the tab empty on a country and on a region — the emptiness #1145 answered by hiding the tab there. The child tabs reach their descendants through `breadcrumbs.doc`; events carry no breadcrumbs, so a join cannot carry the subtree. `RegionEvents` renders Payload's own `RelationshipTable` — the element `JoinField` itself renders — with `region: { in: descendantRegionIds(…) }` in place of the join's `on`. The table re-queries through `getTableState` under the reader's own access, so the predicate asks for rows rather than granting them, and the columns, pagination and document drawers are the join table's. The stored join still answers `on: 'region'` for every API reader; the widening is the admin table's alone. Replacing the `Field` replaces the heading, so the component renders `ImportClassesLabel` itself. `allowCreate` follows the stored level, not the form's: only a city or a venue can hold a class directly, so only there does seeding `region` give the picker's own `filterOptions` a document it accepts. The read that supplies that level is the access gate a server field component owes (#1126). Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjZ5G3bpSAJbneXiqrA --------- Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: sydevs-bot <[email protected]>
Summary
regionsandmanagerssetenableListViewSelectAPI.EVENT_REGION_LEVELSgives "an event attaches to a city or a venue" one owner, so the picker and the tab cannot narrow differently.Change outline
Behaviour — what the Events list opens on
Behaviour — which nodes show an Events tab
The join is direct (
on: 'region'), not recursive like the child-level tabs, so a node above a city lists nothing even when its subtree holds classes.Behaviour — where "Import classes" is offered
The link sits on that tab's heading, so above a city it went with the tab.
targetRegionaccepts a country and a region as readily as a city.Behaviour — what a relationship cell reads per list page
regions.admin, managers.admin + enableListViewSelectAPI: true a list cell's batch read: the whole row → select `useAsTitle` their own list views: the whole row → the active columnsFiles
Preview
A per-PR preview carries no content, so each link below opens on an empty list until someone creates a region and a class.
previewUrl.seedis unset for this repo, so this run could not seed it;PREVIEW_ACCESS_CLIENT_IDandPREVIEW_ACCESS_CLIENT_SECRETare also unset here, so it could not sign in to check either. Data: not seeded yet.Test results
tscoversrc/and overtests/, full unit lane (278 files, 3837 tests)tests/int/regions.int.spec.ts,tests/int/events.int.spec.tsandtests/int/managers-access.int.spec.ts, 47 passedsrc/collections/Managers/matched the trigger. No findings — the diff adds no input path, andenableListViewSelectAPIonly narrows what a read returns.New coverage, each watched failing against the defect before being kept:
tests/unit/regions-events-tab.spec.tsreads the condition off the tab, so it fails if it moves back onto the join field. Restoring the oldhideUntilCreatedreds the country and region cases. It also pins the edit-menu registration: emptyingeditMenuItemsreds it, which is a country left with no prefilled import at all.tests/unit/sanitized-config-rules.spec.tsnow checks every collection'sdefaultColumnsentry against the booted config. Spelling this PR's entrylocation.regionreds it.Migration
None.
pnpm generate:typesleavessrc/payload-types.tsunchanged — the diff touchesadminconfig only, no field shape.Manual verification
atlas-event-manager). That role holds nomanagersread, so the cell renders a raw id — the costdocs/rules/access.mdalready records for fix(access): a published client key reads every manager's name and email #821, now visible by default rather than only to whoever added the column.Notes for reviewer
All three question threads are answered, and nothing is open. The Import classes entry point keeps the tab heading's link and gains the edit menu, the relationship-column cost takes option B, and where
EVENT_REGION_LEVELSlives takes option A — it stays insrc/lib/events/regionLevels.ts, wheresrc/AGENTS.mdrule 4 puts a fact two collection folders read.Dismissed review findings:
levelVisible(levels)factory shared withchildLevelVisible. Declined: the two level lists come from different tables —ALLOWED_PARENT_LEVELS, which theparentpicker also reads, andevents.region's domain — and collapsing the shape hides which.subtitle's['city','venue']two hundred lines down. Declined: that is the levels a listing names, not the levels an event attaches to. Same values today, different facts.tabsIntest helper, a second copy of which sits inmeditation-transcript-tab-wiring.spec.ts. Declined: a one-line type guard, and sharing it edits an unrelated spec.resolveProposalRegion.tsas a third consumer of the new constant. Rejected on reading it:first('venue') ?? first('city') ?? first('region') ?? first('country')is an ordered preference over all four levels, not this set.regionpicker having nofilterOptions. Rejected:src/collections/UserSubmissions/fields.tssays why — Payload validates it on save with a find that forwards the caller'sreq, and a clientreqtrips the select-required client-query gate, so every public create would 400.Detail
Why the tab and not the field.
hideUntilCreatedon the join hid the list and left an empty tab to click. One predicate on the tab answers both "before first save" and "above a city", which is why the diff deletes the field's condition rather than adding beside it. The repo's only other field-tab conditions (Clients.ts) are on the tab too.Why one hook rather than two components.
ImportClassesMenuItemandImportClassesLabelask the same question in two places, and an answer spelled twice is two things that can drift.useImportClassesTargetowns it:nullfor an unsaved region nothing can target, for a venue with no cities to file under, and for a manager withoutimports: create. Neither component decides anything else. The server gate is unchanged —validateTargetRegionstill refuses a region the uploader may not use, whatever a link carries.What
enableListViewSelectAPIcosts. It also makes each collection's own list view select by active column, which is a real behaviour change forregionsandmanagers.regionswas already covered:publicUrlFieldsdeclares its stored inputs throughvirtualFieldInputs, pinned byvirtual-field-declarations.spec.ts, andregion-canonical-url.int.spec.tsreadswebUrlback under a select naming it alone.managerscarries no virtual field and no hook, andnameis the only field a non-admin may read there (#908).Where the constant lives.
src/AGENTS.mdrule 4 sends a fact two collection folders read tosrc/lib/, not into one of their folders — soRegions.tsexporting it forEvents.tswas not an option.lib-boundary.spec.tspasses because it has two consumers outsidesrc/lib.What
admin.conditiondoes not save. Perdocs/rules/admin-ui.mdit hides a field without stopping its subquery, so the join still resolves on a country read. The change is UI-only.Review ran as
/simplifyplus/code-review high's four angles — this session has nopr-review-toolkit.Closes #1142
🤖 Written by the sydevs autonomous loop — see what this is