Repository navigation
feat(api): atlas submission intake — proposal location, opt-in list owners, submission copy - #1027
Conversation
A `submit` tab for the add-a-class and suggest-a-correction panel (entry points, the five steps, the review bar, the confirmation and its refusals), and `registration.form.subscribe` for the mailing-list opt-in. Closes #1023 Co-Authored-By: Claude Opus 5.5 <[email protected]>
A registration opt-in now joins the list of the client that owns the class's region, else the nearest owner above it, else the canonical fallback client's (We Meditate). The Events `offersMailingList` virtual field answers from the same resolver, so the widget shows the box only where a list exists. Closes #1022 Co-Authored-By: Claude Opus 5.5 <[email protected]>
A client may now send `location` (the Mapbox ids of the address or city the visitor picked). Intake matches them against `regions.mapboxId` into `region` and `regionHint`, and delivery emails the nearest manager above that region instead of the system contact. Closes #1021 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Share one memoized read of the fallback client between canonical ownership and the mailing-list fallback, and ask the fallback only on a miss. - Require a complete list (provider, list id, key) to count as one. - `offersMailingList` resolves on single-event reads only, like `qualityReport`; the select-deps hook is now a table (`ensureVirtualFieldDeps`). - `regionHint` is closed now that intake is its only writer; routing reads it through `submissionRoutingRegionId` beside `submissionRegionId`. - Skip `manual-` ids when matching a location; trim comments to their why. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- An authored form's client still wins over the event's region owner. - A hard-deleted event refuses the opt-in rather than falling back. - A non-string location id is left to the schema's 400, and a location matching nothing leaves a trusted writer's regionHint alone. - A blank list id or key no longer counts as a list. - Region and needsForm docs describe intake resolution, not screening. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…on input Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
@sydevs-bot review |
sydevs-bot
left a comment
There was a problem hiding this comment.
🧐 Adversarial review
Three tickets, three commits, and the diff tracks them: 61 translation keys (#1023), a region match at intake (#1021), list ownership resolved from the class's region (#1022). Nothing here is scope the tickets did not ask for, and the migration is additive and reversible.
Two shape questions, both about layers that already exist. src/lib/atlas/mailingListOwners.ts copies regionOwners.ts's loader, memo and eligibility structure rather than parameterising it, after this PR generified the pure half. And location.mapboxId arrives beside proposed.address.mapboxId, which the same POST already carries.
⚠ The three Preview links will not open — Railway refused to deploy this PR (its own comment above), so Manual verification 1-3 are unperformed.
Findings
should-fixmailingListOwners.ts:48— the loader triplet is cloned, not shared.should-fixfields.ts:663—location.mapboxIdduplicatesproposed.address.mapboxId; #1021's online-city key is unanswered.considerregionOwners.ts:208—reqforwarded from a nested global read a virtual afterRead reaches.
What was checked
#1021, #1022, #1023 against the diff. Read whole: fields.ts, resolveProposalRegion.ts, mailingListOwners.ts, regionOwners.ts, deliverProposal.ts, deliverSubscribe.ts, Events.ts, ensureVirtualFieldDeps.ts, validateProposal.ts. regions.level is country/region/city/venue, so the venue-then-city anchor order is right. Events.region is required, so the null-region fallback is unreachable. Search Box mapbox_id is base64url, so MAPBOX_FEATURE_ID refuses no real id. skipVerifyHook matches qualityReport's own guard. Consumer side: SahajAtlasWeb#147 sends location and reads offersMailingList, so no widget change gates this merge. Preview not reachable.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
`location` now carries only the layers the address group cannot: the city, state and country ids. An online class names its city as `location.placeId`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Review addressed — all three adversarial findings adopted, lean gate green, pushed.
PR body refreshed for the new 🤖 Written by the sydevs autonomous loop — see what this is |
#1027 landed `20261024_005319_submission_location` on `main`, which conflicted with this branch's two migrations in `src/migrations/index.ts`. Both sides are additive, so all three are registered in timestamp order. That merge re-armed the out-of-order snapshot trap. #1027's snapshot is now newest by timestamp but was generated on `main`, where `task_slug` still names `cleanupJobs`, `purgeSubmissions` and `sweepEventImports` — so `migrate:create` re-emitted both enum rebuilds that `20261021_152406_retention_registry` already ships. The re-emission omits that migration's `DELETE` of the rows naming the dropped slugs, so replaying it would abort the boot migration on the first legacy row. Healed the documented way: `20261024_161437_merge_1027_main_snapshot` keeps its `.json`, generated on the merged tree, with empty `up` and `down`. `src/plugins/formBuilder/index.ts` merged cleanly and carries both sides — this branch's `custom.retention` and #1027's `resolveProposalRegion` hook. #1027 adds no submission type, so `DURABLE_TYPES` is unchanged, and the purge windows select on `type`, `status` and `createdAt`, none of which it touches. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SPqGrb2pbaKRL5f1PFAyT8
Clean merge, no conflicts — the first on this branch that needed no numbers argument. Main's three commits since the last merge (#959, #1027, #1028) touch the atlas SEO resolver, the submission intake and escapeRegExp's home, none of which this branch reads. src/plugins/access is untouched on main this time, so there was no semantic call to make. tests/PERF.md's counts stand: main added one int spec and edited two unit specs without adding a unit file, and perf-figures-pinned counts files, not cases. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Tj9vmW1FyGMJBwBFWybcWq
Summary
Change outline
Contract —
user-submissionsandeventsA client gains one write and one read;
region/regionHintstay system fields.Flow — placing a new-event proposal (#1021)
Flow — which list an opt-in joins (#1022)
Files
Preview
⚠ Railway did not deploy this PR: the author's account is not in the Railway workspace (its comment above). These links resolve once a preview exists.
offersMailingListin the sidebarContract impact
Generated Payload types change (
location, closedregionHint,offersMailingList, thesubmittranslations). Consumer: sydevs/SahajAtlasWeb — #147 runspnpm types:cmsandpnpm sync:translationsafter this merges, sendslocationon a proposal, and readsoffersMailingListon its single-event read. No widget change is needed for this to ship.Migration
src/migrations/20261024_005319_submission_location.tsuser_submissions.location(jsonb) and ninesubmit_*jsonb columns onsy_atlas_translations_localesand its versions table. Additive only.downdrops the added columns.Test results
atlas-submission-routing14 passed;atlas-sitemap23,atlas-seo53;user-submissions-create41,user-submissions-review-lifecycle37,translations-globals36,events11,event-verification36,region-canonical-url24 — all passedManual verification
offersMailingListis ticked, and unticked for an event elsewhere (with no fallback list).sy-atlas-config→ canonical fallback client to one with a list; confirm the unticked event now reads true.location.placeId= a city region'smapboxId(orproposed.address.mapboxId= a venue's); confirm Region is filled and the review email goes to that city's (or the nearest parent's) manager.Notes for reviewer
8e17dc8,9769b48,ce624f4).regionHintis now closed. Nothing in production writes it today, so no stored row holds other keys.Detail
Review passes:
/simplify(4 lenses) and/code-review high, both triaged and fixed;/security-reviewfound nothing at confidence ≥ 8.pr-review-toolkitis not installed here.Dismissed findings:
locationshould be an open schema for forward compatibility. Closed on purpose: it is client-written, and strictness is what keeps free text (and links) out of a reviewer's view. The producer-first ship order means a new widget key lands after the CMS accepts it.regionHint.anchorRegionrecords what the location matched after a reviewer changesregion.Fixture pre-mortem:
createRegionNodestoresmapboxIdas<prefix>-<slug>, checked againstMAPBOX_FEATURE_ID(src/collections/UserSubmissions/fields.ts); list ownership fields checked insrc/collections/Clients/Clients.ts; the save-time provider probe (validateMailingList) is mocked at@/lib/mailingList/providers.Closes #1021
Closes #1022
Closes #1023
🤖 Generated with Claude Code