Repository navigation
feat(events): listing-quality checks, de-localized auto-titling, Atlas seed fixes - #615
Merged
Merged
Conversation
The listing-quality checks need composeEventTitle / EVENT_TITLE_DEFAULTS / addressPlaceName to recognise an auto-filled title, and they live in src/lib/eventQuality. src/lib/ imports nothing from src/collections/ (rule 4 in .claude/rules/project-structure.md), so the pure half of the title hook moves to src/lib/eventTitle/compose.ts. The request-scoped half — resolveTitleTemplates + eventTitleBeforeChange — stays with the collection. Refs #609 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
A registry of named checks flagging an event listing as incomplete or low-quality, with a pure report builder over it. Advisory only — nothing here blocks publishing, hides an event, or gates verification. Three decisions the design rests on: - An auto-filled title is never judged. The auto-title is built from the address, and #605 blanked 78 generic titles precisely so they'd fall back to it, so a naive "title restates the address" rule would fail the majority of listings. Detection is by recomposition (autoTitle.ts), across every slot and against the locale's own templates as well as the English defaults. - Checks split into document scope (description, images, website, contacts — none localized) and per-locale (title quality, translation coverage), so the report can answer "which of my languages is missing a title". - Locale scope is the default locale plus the event's own `languages`, not all 19 — which would show 18 failing checks on nearly every listing. Refs #609 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The URL / email / generic-title regexes and the stale-date rule were defined inline in the data spec. They now come from @/lib/eventQuality, so the grooming pass's definition of "a URL in the description" and the runtime check's cannot drift. The 1970 exemption moves into findStaleDates with it. Refs #609 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
- `qualityReport` — virtual JSON field, not localized, computed on afterRead.
It opts out of list reads via the hook's `findMany` flag, so a 25-row list
view issues no per-event queries; `defaultPopulate` keeps it out of
relationship hydration too. Its two reads (all-locale titles, all-locale
auto-title templates) are promise-memoized on req.context, and the titles
read carries a narrow `select` so it can't recurse back into this hook.
- `qualityOpenCount` / `qualityCheckVersion` — stamped by a collection-level
beforeChange from `{ ...originalDoc, ...data }`. Collection-level because a
field hook computing off sibling data NULLs the column on every unrelated
write (the computeLastDate trap in .claude/rules/collections.md).
- EventQualityPanel replaces the raw JSON rendering: findings grouped by tier,
per-locale ones tagged with their language, passing ones behind a
Collapsible, and the skip reason rendered as its own explanation. Reuses
StatusIcon / ProgressBar / summaryTone from ReadinessField and Banner /
Pill / Collapsible from @payloadcms/ui. No refresh button — the report is
computed on read, so a control to recompute it would write on read.
Refs #609
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Adds quality_open_count (indexed) and quality_check_version to events and _events_v. The generated migration was trimmed: its diff base is the newest-by-filename snapshot, which was authored on a branch predating schedule_last_date, so it re-emitted that column's DDL for app_cards/events and both version tables. Replaying it would fail on ADD COLUMN and abort the in-process boot migration. The .json snapshot is left as generated — it holds the full current schema and heals the chain for the next migrate:create. scripts/backfill-event-quality.ts restamps rows written before the columns shipped (NULL sorts as "no open items", burying the worst listings) and rows an older check definition wrote. Dry run by default, re-runnable, and it passes skipVerifyHook so a backfill can't reset every event's verification cycle. Refs #609 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Everything the pure unit lane can't reach: the skip states as they arrive from real hooks, the all-locale title read, the stored columns after a partial write, and the read cost. The two cost assertions were mutation-checked — removing `defaultPopulate` and the `findMany` guard each makes its test fail, so neither passes vacuously. Two fixture notes worth keeping: - verifyOnSave resets verificationStage on every save, so a terminal stage passed to create never survives; the skip cases set it with skipVerifyHook. - The all-locale test localizes while the event is still a draft, then publishes. A locale-scoped title update on an already-published event silently doesn't persist — reproducible on main with none of this feature's hooks attached, and not the case for a published Page. Pre-existing and Events-specific; flagged in the PR, not fixed here. Refs #609 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
- Compute the description plain text and the address phrases once per report and pass them on the check context. Eight checks read them, and each read walked the whole Lexical tree / re-parsed the address group. - Replace the `check.tier !== 'title'` filter with a `requiresHandWrittenTitle` property on the check itself. Grouping metadata was carrying evaluation logic, so a check couldn't state its own precondition. - Extract the request-scoped promise memoization both Events hooks now need into @/lib/utilities/requestMemo; eventTitle.ts had the only copy. - Drop three exports nothing imports (EVENT_QUALITY_CHECKS_BY_KEY, containsWeekday, CheckContext). Skipped: consolidating the three lexical plain-text extractors (mine deliberately emits block newlines; retrofitting the other two would change unrelated behaviour — worth its own ticket), lazy WEEKDAY_NAMES (a few ms once per boot), and parallelising the backfill's writes (the sibling backfill-schedule-last-date is sequential for the same connection-pool reason). Refs #609 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Code review flagged that backfillEventQuality relies on
`payload.update({ data: {} })` running stampEventQuality — untested, and a
no-op there would have the script report success while every column stayed
NULL.
It does persist. The test corrupts a row through the adapter (the only way to
get a stale value, since the hook stamps every write), then asserts the dry run
leaves it alone and the applied run restores the computed count and version. A
second pass is a no-op.
Refs #609
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
`defaultPopulate` only covers relationship hydration — a list read is a plain find, so an expensive afterRead still runs per row. The `findMany` flag is the guard, and it wasn't written down anywhere. Adds it beside the defaultPopulate section, with the paired "cheap stored column for what the list sorts on" pattern, and lists eventTitle/ + eventQuality/ among src/lib's domain folders. Refs #609 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
🚅 Deployed to the SahajCloud-pr-615 environment in sahajcloud
|
railway-app
Bot
temporarily deployed
to
sahajcloud / SahajCloud-pr-615
August 4, 2026 01:11
Destroyed
…ecks # Conflicts: # src/collections/Events/Events.ts # src/migrations/index.ts
…chain Merging main brought in 20260803_221051_registrations_full_flag, whose snapshot is now the newest by filename. The previous migration's own snapshot predated it, so the next migrate:create would have re-emitted registrations_full — the same out-of-order trap this branch had already worked around once, just handed to the next author. Regenerated so the committed .json is the full merged schema; a follow-up migrate:create now finds nothing, so the chain is healed rather than deferred. The generated .ts needed the same trim, and a wider one: main's snapshot predates four merged changes, so the diff re-emitted contact_email, address_venue_name, sy_atlas_translations.event_title and a destructive drop/recreate of enum_regions_level. Only this branch's two columns are kept — the file comment names each one and the migration that already ships it. Refs #609 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
railway-app
Bot
temporarily deployed
to
sahajcloud / SahajCloud-pr-615
August 4, 2026 01:26
Destroyed
…ecks # Conflicts: # src/migrations/index.ts
…request The report's afterRead runs during a published update, and its two nested reads were handed the caller's own `req`. Payload's createLocalReq assigns straight onto that object (`req.locale = localeCandidate`, plus `fallbackLocale`), so `locale: 'all'` didn't scope to the nested read — it repointed the whole in-flight request. Every later step of that write then ran under `all`, and a locale-scoped title write was silently dropped: saving a German title on a published event reported success and persisted nothing. Both nested reads now get a shallow copy (@/lib/utilities/localeIsolatedReq). `context`, `transactionID`, `user` and `payload` still carry over by reference, so memoization, the transaction and access control are unchanged — only locale/fallbackLocale become the copy's own. I previously mis-diagnosed this as a pre-existing Events bug: the earlier bisection disabled both new hooks but never the new *field*, so the afterRead still ran. Running main's Events.ts against the same probe is what settled it. The int spec's draft-then-publish workaround is gone — it now writes the localized title directly on a published event, plus a dedicated regression test. Both fail if the copy is removed. Refs #609 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
- The afterRead's cheap-exit called buildEventQualityReport just to read its skip flag, walking the description tree and running every document check before throwing the result away. It calls shouldSkipQualityChecks directly. - Trim the two localeIsolatedReq call-site comments; the helper's own doc comment is authoritative and repeating it invites drift. - Document the locale-isolation constraint in .claude/rules/collections.md so the next nested cross-locale read doesn't reintroduce the bug. Skipped: refactoring src/collections/Pages/appConfigCache.ts to use the new memoizeOnRequest — a real duplication, but in a file this branch doesn't otherwise touch. Refs #609 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
project-structure.md enumerates that folder's contents, so requestMemo and localeIsolatedReq have to appear there or the list reads as complete while being wrong. Refs #609 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
railway-app
Bot
temporarily deployed
to
sahajcloud / SahajCloud-pr-615
August 4, 2026 18:49
Destroyed
#617 made the shell environment win over .env files and pinned the convention with tests/unit/env-file-precedence.spec.ts. This script was written against the older two-call form (`.env` then `.env.local` with override: true), which the new spec rejects — it turned CI red on the merge commit. Refs #609 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
railway-app
Bot
temporarily deployed
to
sahajcloud / SahajCloud-pr-615
August 4, 2026 19:00
Destroyed
…s own rows Production has no events yet and is seeded from the Atlas import, so there are no pre-existing rows to repair — the backfill had nothing to do. Every event reaches the database through `upsert`, which goes through the Local API, so `stampEventQuality` writes both columns on the way in. Removes scripts/backfill-event-quality.ts and src/lib/eventQuality/backfill.ts, and puts the guarantee where the rows are made: the batch that finishes the events collection calls verifyEventQualityStamps() and warns if any row lacks a stamp. Scoped past the excluded duplicates and trashed rows — this import refuses to touch those by design, so it can never stamp them and their absence says nothing about the hook. Verified against the local database: 509 events, all stamped NULL beforehand, 490 stamped after `pnpm seed atlas --update`. The 19 left are exactly the 17 excluded duplicates plus 2 trashed rows. The check's own query returns 0 now and 490 before, so it isn't silent by construction. Values are a real distribution (99 events clean, 170 with three open items), not a column of zeros. Refs #609 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Six changes from review of the panel in use:
- Show a percentage, not a ratio. "79%" reads as progress; "11/14" made a
manager do arithmetic to find out how they were doing.
- Give every check a separate passing wording. A tick beside "The description
repeats the address" read as an endorsement of repeating it — the opposite of
the point. Checks now carry `label` (the imperative recommendation) and
`passedLabel` (the state already reached), and a test refuses a check where
the two are the same string.
- Print the one-sentence reason under each open recommendation instead of
hiding it in a hover title. A manager shouldn't have to discover why they're
being asked for something. Passing rows stay one line, folded away by default.
- Rewrite "Say a little more" as "Say more about what to expect", and say what
to write: who comes, what happens, whether it suits a beginner, what to bring.
- Fold the language into the sentence in bold ("Add a title in **German**")
rather than a pill that never said what it qualified — and only when the event
is judged in more than one language, which is the rare case. Phrased "in
%{language}" so vowel-initial names don't render "a English title"; a test
guards the article.
- Drop `website.missing`. A website is optional and a listing that says
everything in place is better than one that sends a seeker elsewhere. A
website still counts toward `contact.none`.
QUALITY_CHECK_VERSION → 2, since the document-scope set changed and stored
counts from v1 aren't comparable. Existing rows restamp on their next save.
Refs #609
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Thirteen checks meant a thin listing showed six near-identical rows about its description. Six checks that *name* what they found say more in less space: - description presence and length are one finding, `description.insufficient`, whose detail distinguishes "nothing here yet" from "too short to tell a seeker much"; - everything redundant in the description is one finding, `description.redundant`, naming what it found — "Take out the address, which appears above with a map, and the day and time, which the schedule keeps right on its own"; - everything wrong with a hand-written title is one finding, `title.unhelpful`, and the recommendation is to clear the field: an empty title fills in from the venue and translates itself, which is better than any of the wordings it was flagging. Checks can now carry a `detail(ctx)` alongside `evaluate`, called only on failure; the panel shows it in place of the static blurb. **Fixes the translation check**, which was wrong: a blank title is composed per locale from that locale's own template, so it is never untranslated. It now fires only when the default locale carries a title a manager typed — which is the only way another language ends up showing English. Adds `maxLength: 100` to the title, matching the address fields. The longest Atlas title is 94 characters and none exceed 100, so it binds new writing without locking anyone out of a listing they already have. It's Payload validation, not a column width — verified that migrate:create emits nothing. Also restores two things a careless earlier edit to Events.ts dropped without any check noticing: `required: true` on the title, and `contactName`'s place in the contact row. An int test now pins that shape. QUALITY_CHECK_VERSION → 3. Refs #609 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Replaces the previous set with exactly five, in the wording given:
1. description.missing — absent or under 60 characters
2. description.quality — repeats the address, day/time, contact, a link or
a past date; the subtext names which
3. title.quality — same, for a title a manager wrote; skipped when
the field is blank, since there is nothing of
theirs to judge
4. images.insufficient — fewer than three photos
5. translations.missing — the event runs in several languages and the title
exists in some but not all; the subtext names them
Drops the contact check, which wasn't in the specified set.
Two design points the tests forced out, both worth keeping:
- `translations.missing` is document-scope (one finding naming every language)
but reads localized data, which a write hook cannot see. It's therefore
excluded from the stored `qualityOpenCount` via `dependsOnLocales` — counting
it would make the column disagree with the report on every multilingual
event.
- It also has to ignore a language ticked in the save currently in flight, or
choosing German reports a missing German translation in the same breath.
Panel: the tier headings are gone — five checks don't warrant them — so the
model returns one flat ordered list instead of groups.
Title: rejects a link, composed with Payload's own text validator rather than
replacing it (`sanitize.js` installs the default only when a field has none, so
a hand-rolled validator would have silently dropped `maxLength: 100`).
Refs #609
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The Atlas widget translates client-side, so a per-locale title column bought nothing and cost a great deal: the report needed an all-locale read per event, a pending-locale handshake between the write hook and the read hook, and a translation check whose semantics we got wrong twice. `title` is now one plain column and all of that machinery is gone — the report is a flat list of checks with no locale dimension at all. - The translation check is removed, as is `perLocale` from the report, the language-bolding in the panel, and the all-locale `findByID` the afterRead used to make. The auto-fill now composes from the default locale rather than `req.locale`, so the one stored value doesn't depend on which locale the manager happened to be editing in. - `description.quality` is skipped outright while `description.missing` fails, via a `skipWhenFailed` precondition. Two rows about one empty field is one too many, and a skipped check is not a passing one — it doesn't pad the tally. - Passing checks now sit in the same list below the open ones, faded with a green tick, instead of behind a collapsible. - All wording moves to `src/lib/eventQuality/copy.ts`, which is the only file to edit to change what a manager reads. `checks.ts` keeps the logic and spreads the copy in. The migration is NOT in this commit — the repo blocks hand-editing generated migrations, and the generated one is lossy (it drops events_locales before adding events.title, so every title would vanish). Handed to the user with the corrected statement order. QUALITY_CHECK_VERSION → 5. Refs #609 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Sweeping for what the title's de-localization made untrue: - The Atlas importer's own comment promised a "localized auto-fill". Its code needed no change — it already writes `title` with no locale, so the value lands in the single column — but the comment did. - seeds/atlas/AGENTS.md said the auto-fill "translates per locale". It doesn't; the widget translates the composed title client-side. - The `sy-atlas-translations` `event.title` description promised the templates localize. Only the default locale's set is read now; the description says so. Confirmed with migrate:create that a description-only edit needs no migration. - The Events live-preview comment said `locale` was there so the localized title previews. Also replaces a vacuous test of my own. `expect(field.localized).toBeFalsy()` proves nothing — Payload strips `localized` during sanitization, so it passes either way. It now writes the title in Czech and reads it back in English with the fallback off, which only holds for a single shared column (same approach as the `website` case in events.int.spec.ts). Refs #609 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…able rows 326 errors on every `atlas --update` run, 320 of them two bugs: **The question contract was invented, not observed.** EVENT_REGISTRATION_QUESTIONS held five placeholder questions nobody had ever collected an answer to, and its `additionalProperties: false` schema rejected every real answer in the dump — 310 of 886 registrations, which stored answers under `questions`, `experience`, `aspirations` and `referral`. It is now those four, named with the dump's own keys so the importer needs no translation layer. The `experience` and `referral` labels carry over unchanged; the other two are the questions Atlas actually asked. That also fixes a quieter loss: `mapRegistrationQuestions` only knew how to map two of the four flags and *warned away* the rest, silently dropping the `questions` toggle on 435 events and `aspirations` on 78. It is now a pass-through, and warns only on a flag the contract doesn't define. **29 users held junk where an email should be** — "jbk", "dfsjdhflskdhf", someone typing into a form. Unimportable by definition, so they're skipped by name instead of erroring. The remaining 6: an inactive event whose only contact is a Meetup page now passes, because the rule demanding a *phone* has been relaxed to demand a contact — any of phone, email, website or online URL, which is what its own comment always claimed it meant. `contactName` is required only alongside a phone now, since an event reachable by email has no one to name. Also names the failing row in seed errors. `Upsert registrations: invalid` × 291 told an operator nothing about which rows to look at; it now carries the identifier the reporter already had in hand. The dead placeholder questions are removed from the Atlas translations schema (they live in a JSON blob, so no migration). Refs #609 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Drops the five placeholder question toggles and adds the four Atlas ones. Generated in the drop/add form rather than as renames — signed off as acceptable: production has no events yet, so there are no toggles to carry across. On a database that does hold them, `prior_experience` → `experience` and `referral_source` → `referral` would need to be renames instead. Refs #609 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
With the rows now named in the report, the stragglers were diagnosable: - **Two archived events failed on every run** with `Not Found`. Payload appends `deletedAt exists: false` to every read on a trash-enabled collection, so the importer's find-then-update couldn't see a trashed row — the trap in .claude/rules/collections.md, which `preloadCollection` was already fixed for but `upsert` was not. Both now pass `trash: true` (a no-op where trash is off). - **A dormant event lost its only phone number.** The importer paired name and number — `!!name && !!phone` — so a number with no name against it was thrown away, leaving the listing with no contact route and failing validation. `contactName` is no longer `required` either: it's a nicety, and refusing a real number for want of one helps nobody. - **The admin account collided with Atlas manager #45.** Same email, no `legacyId`, so upserting on `legacyId` tried to create a second manager and hit the unique constraint. Upserting on email instead would have overwritten the account — resetting its password and `type` from the dump. It now adopts the existing row: events owned by that manager still resolve, and the account is left alone. `atlas --update` now reports 4 errors, down from 326, and all four are the same external flake: Mapbox failing to geocode a region (Alberta, Saskatchewan, Basilicata, East), which leaves it on manual location where coordinates are required. The count moved between runs on identical data — 1, then 4 — so it's rate-limiting, not the dump. Refs #609 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The last two verification failures weren't missing data — the constants were unreachable. `users: 755` counted the 29 rows holding typed-in junk instead of an email as importable; they never could be, so every run failed on a target that could not be hit. The real ceiling is 717 unique addresses, which is exactly what the database holds. `registrations: 886` likewise counted the 27 rows belonging to those registrants; 859 is the importable figure, and again exactly what is there. Both now carry the derivation, and a unit test recomputes them from the dump — the same guard the region count already had, and for the same reason: a constant that drifts above what can be imported fails every run, and one that drifts below quietly stops checking anything. Refs #609 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The previous commit patched only the fallback find-then-update. `upsert` takes the preload path whenever the collection was preloaded, which is the normal case — and `preloadCollection` deliberately includes trashed rows, so the id it hands back can be one. The update then refused it with `Not Found`, which is why the two archived Atlas events survived the first fix. Refs #609 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Asserts both halves: an update targeting a trashed event throws without `trash: true` and succeeds with it. That asymmetry is the whole bug behind the two archived Atlas events failing every seed run, and nothing in the suite covered it. Refs #609 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
- Close the remaining `trash: true` gaps in BaseImporter. The two archived events exposed the bug on `upsert`'s two paths; the same latent one sat in the slug-collision recovery finds (a trashed row still occupies its slug), in `findByNaturalKey` (an existence check blind to trashed rows reports "absent", and the caller creates a duplicate on the key the trashed row holds), and in the per-locale translation update. All no-ops where trash is disabled. - Batch the manager adoption lookup. It was one `find` per manager — 327 round trips for what is one small read of the accounts Atlas didn't create. - Drop four heuristics helpers from the eventQuality barrel that nothing outside the module imports. Skipped: memoizing `redundantParts` between `evaluate` and `detail`. It's two extra regex passes over one description, only for a check that already failed, and only on an edit-view read — the review justified it by a 25-row list view, but list reads skip the report entirely via the `findMany` guard. Refs #609 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
It still said `title` is localized and "computes per save-locale". The code was already right — it composes in the default locale — but the comment described the behaviour this branch removed. Refs #609 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
… copy lives The trash rule covered the existence-check form of the bug — a find that misses a trashed row and creates a duplicate. It didn't cover the write form, which is what cost this branch two seed runs to find: an update addressing a trashed row by id throws `Not Found` without the flag, even when the id came from a query that passed it. Fixing the read is not enough. Also points `src/lib/eventQuality/` at `copy.ts` as the single file to edit for what a manager reads. Refs #609 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
railway-app
Bot
temporarily deployed
to
sahajcloud / SahajCloud-pr-615
August 5, 2026 22:33
Destroyed
The field's description says "Leave blank to fill in from the venue", and the server does exactly that — `eventTitleBeforeChange` composes the title and Payload validates afterwards (hooks at line 58 of `fields/hooks/beforeChange/promise.js`, `validate` at 86). But **no hook runs in the browser**, so the admin's own validation refused the blank `required` field before the request was ever sent. The workflow was only reachable through the API. `eventTitleValidate` now permits a blank title when there is an address to compose one from, and keeps demanding one when there isn't — an online event has no venue to name it, so the guarantee that every event carries a title still holds. `required: true` is untouched. Moves the validator next to the hook it is paired with: the two are one behaviour (the hook fills, the validator permits blank *because* the hook will fill), and splitting them across files is what let them drift apart. Covered both ways: a unit spec drives the validator directly, which is the browser's path, and the integration spec pins that a blank title with an address saves as "Evening Meditation at Sunrise Hall" while one without an address is still refused. Refs #609 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
An online event has no address, so `addressPlaceName` returned nothing and both halves of the title behaviour bailed: the hook handed the blank value back, and the validator refused it. The importer papered over this with a hardcoded "Online Sahaj Yoga Meditation" for every online listing in the dump. `region` is required on every event, so there is always a place to name a listing after. `resolveTitlePlace` prefers the venue (or street) and falls back to the region's name — "Evening Meditation at Dublin". The read is memoized per request like the templates, and passes a narrow select because it forwards the caller's request through the client-query gate. The validator mirrors it, permitting a blank title when a region is selected; the browser only holds the region's id, so it trusts the name to resolve — `name` is required on every region. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
`isAutoFilledTitle` detects the auto-fill by rebuilding it from the event's
address, so an online event — auto-titled from its region — looked
hand-written and `title.quality` judged it. Benign on today's data ("Evening
Meditation at Dublin" passes), but it credits a manager for a title we wrote,
and a region whose name carries a weekday would draw the self-contradictory
"leave it blank and one will be written for you".
Fall back to matching the template's shape around `%{place}` when, and only
when, there is no address to recompose from. An event with a venue keeps the
exact comparison, so prose in the auto-fill's shape is still judged as prose.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
`eventTitleValidate` has to permit a blank title — the browser runs no hooks, so `required` would refuse the "leave it blank" workflow before the request was ever sent. But supplying `validate` replaces the default that enforces `required`, so permitting the blank also disarmed it server-side: if the region read failed (a trashed region, a DB blip) the hook handed back the blank value and nothing stopped it being saved. Move the guarantee to the one place that knows whether the auto-fill had anything to work from — the hook now throws a ValidationError against `title` when it comes up empty. The validator keeps only the cheap question it can actually answer in the browser: is a place plausible. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The conditional-validation rule says never return true for an empty value. The Events title field has to, and the compensating design (the hook throws, the validator only gates the round trip) is the part worth writing down — along with the two Payload facts behind it: no field hook runs in the browser, and a custom validate replaces the default that enforces `required`. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
railway-app
Bot
temporarily deployed
to
sahajcloud / SahajCloud-pr-615
August 6, 2026 00:22
Destroyed
The hook's new throw stood in for `required`, but not the way `required` actually behaves: Payload skips it entirely for a draft, so an incomplete draft is legal by design. Throwing unconditionally broke that — caught by atlas-collections.int.spec.ts, which drafts an online event with no address. Skip the throw on a draft save. The guarantee is that every *published* event carries a title, which is the one that was ever enforced. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
railway-app
Bot
temporarily deployed
to
sahajcloud / SahajCloud-pr-615
August 6, 2026 00:44
Destroyed
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
title(one column, composed in the default locale — the Atlas widget translates client-side), and auto-fills it from the venue, or from the event's region when there is no address.trash: trueon every read/write path — 326 import errors → 1 (a Mapbox geocoding flake).Changes
src/lib/eventQuality/— the check registry (4 checks), report builder, and skip rules. All manager-facing wording lives incopy.ts— it is the only file to edit to change what a manager reads.src/components/admin/EventQualityPanel/— the sidebar panel;model.tsholds the pure view model so it is unit-testable.src/collections/Events/hooks/eventTitle.ts— auto-fill + the field'svalidate, colocated. The hook resolves the place (venue → street → region name) and throws when it has nothing; the validator only decides whether the browser bothers to ask the server.src/lib/eventTitle/compose.ts—composeEventTitleFromPlace, so the hook can compose from a place it resolved itself.src/lib/registrations/questions.ts— the four questions Sahaj Atlas actually asked, verbatim, so the dump's 310 legacy answers import as they stand.src/lib/utilities/localeIsolatedReq.ts,requestMemo.ts— a copiedreqfor nested cross-locale reads, and per-request in-flight promise memoization.seeds/atlas/import.ts,seeds/lib/BaseImporter.ts— question pass-through, junk-user skip, batched manager adoption, andtrash: trueon all nine read/write paths.Migration
20260804_012138_add_event_quality_columns— addsevents.quality_open_count+quality_check_version. Reversible.20260805_015327_drop_event_title_localization— collapses the localizedtitleto one column. Lossy, accepted by the author: non-default-locale titles are dropped.20260805_184012_replace_registration_questions— replaces the registration-question columns. Lossy, accepted by the author; the Atlas reseed restores the real answers.Test Results
src): ✓ · Typecheck (tests): ✓Verified against the real local Atlas data, not only fixtures: clearing a live online event's title returned
Evening Meditation at Dublin, and its report then omittedtitle.quality(correctly treating it as auto-filled rather than crediting the manager for it).Notes for reviewer
Two places where the design is deliberately unusual, both documented in
.claude/rules/collections.md:titleisrequired: truebut itsvalidatepermits a blank. No field hook runs in the browser, sorequiredwould refuse the "leave it blank and we'll write it for you" workflow before the request was ever sent. Because supplyingvalidatereplaces the default that enforcesrequired, permitting the blank disarms it — so the guarantee is enforced in the hook, which throws when the auto-fill has nothing to work from (and, likerequired, skips a draft: the guarantee is that every published event has a title).tests/unit/event-title-cache.spec.tspins both halves; the throw was mutation-checked — removing it fails the test.isAutoFilledTitleshape-matches the template when an event has no address. A region-derived auto-title cannot be recomposed (the quality module holds the region's id, not its name). Events with a venue keep the exact comparison, so prose in the auto-fill's shape is still judged as prose.Follow-ups deliberately not in scope, tickets pending your approval:
req-forwarding call sites with the same cross-locale hazard (Frames/hooks/cascadeFrameNodeChange.ts,WeMeditateAppStatus/sections/appCards.ts,lib/translations/emailStrings.ts).region:East) varies run to run on identical input.sy-atlas-translationsevent.titletemplates are still a localized field, but only the default locale's set is read now."Evening Meditation at Dublin" reads slightly oddly for a city — the templates are admin-editable in the
sy-atlas-translationsglobal if you want online events phrased differently.Closes #609
🤖 Generated with Claude Code