Skip to content

feat(regions): country slug = ISO alpha-2 code - #566

Merged
Ardnived merged 6 commits into
mainfrom
feat/country-slug-iso-code
Jul 12, 2026
Merged

Ardnived merged 6 commits into
mainfrom
feat/country-slug-iso-code

Conversation

@Ardnived

@Ardnived Ardnived commented Jul 12, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Country regions now slug as their ISO alpha-2 code (belgium → be), so the Sahaj Atlas derives each country's code (flags, localized names) from the slug instead of the deprecated legacyData.countryCode.
  • webPath/webUrl are virtual (resolved from current slugs per read), so country + descendant + event paths follow the new slugs with no stored-path backfill.
  • Fixes a pre-existing bug where select[webPath]=true without webUrl always returned null on events (publish-gate dep was stripped from the select).

Changes

  • seeds/atlas/import.ts — buildRegionSlugs() assigns countries their lowercased countryCode (countries walk first, so they always claim the two-letter slugs; missing/malformed codes fall back to the name-based slug).
  • src/collections/Events/hooks/ensureWebPathDeps.ts — inject _status whenever webPath or webUrl is selected; both fields are publish-gated.
  • src/migrations/ — also removes a duplicate migration (20260711_225910) that migrate:create re-emitted: it picks its diff-base snapshot by filename timestamp, and 20260705_161112 (bcp47, from a parallel branch) sorts after 20260705_160029 (views) but predates its schema change. Replaying those ADD/DROP COLUMNs would abort the boot migration on deploy. The new migration's freshly generated snapshot is now latest-by-timestamp, so future migrate:create runs diff against a correct base.
  • src/migrations/index.ts — the regenerated index also swaps 160029/161112 into timestamp order. Safe: applied migrations are tracked by name (array position irrelevant on existing DBs), and the two touch disjoint tables/enums, so fresh installs work in either order.

Migration

  • New migration: src/migrations/20260711_230013.ts (data-only)
  • Impact: regions — rewrites slug to lower(legacy_data->>'countryCode') for level='country' rows. Guards: alpha-2-shaped codes only; skips a country if another region already holds the target slug (a unique violation would abort the in-process boot migration). Dry-run against seeded data: 29/29 countries rewrite cleanly, zero skips/collisions.
  • Reversible: no — documented no-op down(). The old name-based slugs (with collision suffixes) aren't recoverable in SQL, and no deployed Atlas links to them.

Test Results

  • Integration tests (targeted): regions 15 ✓, events-geojson 14 ✓, event-verification 14 ✓
  • Unit lane: 688 ✓ · Lint: ✓ · Typecheck: ✓
  • Full suite + smoke: CI on this PR

Notes for reviewer

  • Known follow-up (pre-existing, out of scope here): Pages has the same select-dependency gap this PR fixes on Events — its webPath reads slug/tags/_status, so select[webPath]=true on /api/pages returns null. The deeper fix is declaring read-deps in the publicUrlFields factory (emitting the beforeOperation hook) instead of per-collection hooks. Flagged by review; worth its own ticket.

  • URL shape change: the first segment of every country/region/event webPath changes (/belgium/flanders/… → /be/flanders/…). No redirects needed — this Atlas version isn't deployed yet (per feat(regions): country slug = ISO alpha-2 code (drop legacyData) #556).

  • To apply locally: pnpm seed atlas --update (app-layer path), or let the migration run.

  • legacyData remains in place (dropping it is a separate cleanup per legacyMigrationFields).

Closes #556

🤖 Generated with Claude Code

Ardnived and others added 5 commits July 11, 2026 23:45
Countries claim their lowercased legacy countryCode as slug (belgium ->
be) so the Atlas widget can derive the code from the slug instead of the
deprecated legacyData.countryCode. Countries sort first in
buildRegionSlugs, so the two-letter slugs are always theirs; a missing or
malformed code falls back to the name-based slug.

Refs #556

Co-Authored-By: Claude Fable 5 <[email protected]>
ensureWebPathDeps only injected _status into an include-mode select when
webUrl was requested, but webPath is publish-gated too — so
select[webPath]=true alone stripped _status before the afterRead hook
and the path always read null. Inject both deps whenever either path
field is selected.

Refs #556

Co-Authored-By: Claude Fable 5 <[email protected]>
Pin the #556 contract: a country slugged with its ISO alpha-2 code
routes the code as the first webPath segment for itself and every
descendant, and a geojson feature under a country-rooted chain carries
it (selecting webPath alone — the ensureWebPathDeps regression path).

Refs #556

Co-Authored-By: Claude Fable 5 <[email protected]>
migrate:create re-emitted the #539 views delta (already applied via
20260705_160029) because it picks its diff-base snapshot by filename
timestamp and 20260705_161112 (bcp47, from a parallel branch) sorts
later but predates the views change. Replaying the ADD/DROP COLUMNs
would abort the in-process boot migration on deploy. 20260711_230013's
freshly generated snapshot reflects the full current schema, so future
migrate:create runs diff against a correct base.

Refs #556

Co-Authored-By: Claude Fable 5 <[email protected]>
@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-566 July 12, 2026 08:18 Destroyed
@railway-app

railway-app Bot commented Jul 12, 2026

Copy link
Copy Markdown

🚅 Deployed to the SahajCloud-pr-566 environment in sahajcloud

Service Status Web Updated (UTC)
SahajCloud ✅ Success (View Logs) Web Jul 12, 2026 at 8:20 am

migrate:create diffs against the newest-by-filename-timestamp snapshot,
not the last index.ts entry, so parallel-branch migrations merged out of
timestamp order leave a stale diff base and the next run re-emits
already-applied DDL (a replay aborts the boot migration). Caught in #566.

Co-Authored-By: Claude Fable 5 <[email protected]>
@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-566 July 12, 2026 09:14 Destroyed
@Ardnived
Ardnived merged commit b331c37 into main Jul 12, 2026
1 of 2 checks passed
@Ardnived
Ardnived deleted the feat/country-slug-iso-code branch July 12, 2026 09:14
Ardnived added a commit that referenced this pull request Aug 4, 2026
The origin/main merge regenerated the registrations_full migration as
20260803 (replacing the pre-merge 20260722, so the snapshot chain stays
cumulative on top of schedule_last_date). The PR-601 Railway preview DB
persists across deploys and had already applied the old 20260722 migration,
so a plain `ADD COLUMN` re-add threw "column already exists" and aborted the
in-process boot migration → deploy 502 → all smoke specs down.

Guard the DDL with IF NOT EXISTS / IF EXISTS: a no-op where the column is
already present (identical boolean DEFAULT false), a clean add on a fresh
prod DB. The out-of-order snapshot trap in .claude/rules/migrations.md (#566).

Refs #599

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Ardnived added a commit that referenced this pull request Aug 4, 2026
* refactor(schedule): extract shouldFinish into a shared module

Move `shouldFinish` + `FinishCheckInput` out of the ExpireEvents job into
`src/lib/schedule/scheduleStatus.ts` so the registration endpoint can reuse
the same "schedule has run out" check without cross-importing a job's
internals. Behaviour is unchanged; the unit cases move alongside it.

Refs #599

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* feat(events): denormalized registrationsFull fullness signal

Add a stored `registrationsFull` boolean on Events so `sahaj-atlas-client`
can read an event's "Full" state on by-id/list reads and the geojson feed
without a per-event COUNT (feed stays O(1)) and without exposing raw
registration numbers. True only for `sahaj-atlas` mode with a set limit the
count has reached; false for external mode or a blank (unlimited) limit.

Maintained by the Registrations create/delete hooks (recompute + write only
on a real flip, so version churn stays negligible) and recomputed on an
Events save when registrationMode / registrationLimit changes. `isEventFull`
is the single shared definition of "full", reused by the registration gate.

Refs #599

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* chore(migrations): add events.registrations_full column

Adds the denormalized `registrations_full` boolean (and its `_events_v`
version companion), nullable with default false — existing rows read false
until a registration change or capacity edit recomputes them.

Refs #599

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* feat(events): gate registration by schedule state + capacity

POST /api/events/:id/register now refuses a registration the event's state
won't accept — external mode, an ended schedule (reuses shouldFinish), a
started limited-run course, or a full event — with a stable machine-readable
`code` (external_registration / event_ended / registration_closed /
event_full, all 409) the Atlas widget maps to its registration-state UI.

The capacity check is enforced against a live count (authoritative); the
published/visible 404 and the open-event 201 path are unchanged. The gate is
a pure, unit-tested helper; the error-code union is typed in the cross-repo
responseTypes contract.

Refs #599

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* docs(openapi): document register 409 rejection codes

Add the `409` response and its four machine-readable `errors[0].code`
values to the hand-authored register-endpoint shim, and guard them in the
custom-endpoints spec so the Atlas contract stays in lockstep.

Refs #599

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* docs(events): pin the finished-event read contract

Document the contract the Atlas widget relies on: a schedule-elapsed event is
marked finished + `_status: 'draft'` by ExpireEvents, so `sahaj-atlas-client`
reads a 404 (finished ⇒ 404, not an readable "Ended" doc). The pre-job window
— past but still published — stays readable so the widget derives "Ended"
client-side, and the register gate closes the matching registration hole.

Stated in the Events collection JSDoc + finishEvent, with an Atlas
read/registration summary in the architecture doc.

Refs #599

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* test(events): gating + fullness integration specs

Cover each registration rejection (external / ended / started course / full)
plus the boundary (an open-ended recurring class never closes) and the
preserved 404, and the fullness signal (flip at the limit, free on delete,
never-full for blank/external, capacity-edit recompute, client by-id + geojson
selectability with no raw count).

Elevate the fullness recompute's event write with asTrustedReq so the nested
region filterOptions validation isn't rejected by the client query gate.

Refs #599

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* refactor: simplify per /simplify pass

- Parallelize the independent event read + registration count in
  syncEventRegistrationsFull (write-path latency).
- Drop redundant .getTime() in the started-course instant comparison.

Refs #599

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* docs(events): note the capacity gate is a soft cap under concurrency

Per code review: the count→create window isn't transactional, so concurrent
registrations can overshoot registrationLimit by a few. Acceptable for a
meditation class (not ticketed inventory); documented rather than adding a
row lock / DB constraint. Behaviour unchanged.

Refs #599

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* fix(migrations): idempotent registrations_full add for the merged chain

The origin/main merge regenerated the registrations_full migration as
20260803 (replacing the pre-merge 20260722, so the snapshot chain stays
cumulative on top of schedule_last_date). The PR-601 Railway preview DB
persists across deploys and had already applied the old 20260722 migration,
so a plain `ADD COLUMN` re-add threw "column already exists" and aborted the
in-process boot migration → deploy 502 → all smoke specs down.

Guard the DDL with IF NOT EXISTS / IF EXISTS: a no-op where the column is
already present (identical boolean DEFAULT false), a clean add on a fresh
prod DB. The out-of-order snapshot trap in .claude/rules/migrations.md (#566).

Refs #599

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* test(events): typecheck the int specs under the widened test config

origin/main #613 (#606 Phase 2) widened tsconfig.test.json to tests/int/**,
and CI type-checks this PR merged with latest main — surfacing two dormant
errors in my additions:

- createGatingEvent omitted the required `schedule`, so the create fell to the
  draft overload. Wrap it in main's `createData<'events'>` helper and give it a
  default `schedule` (every gating case overrides it).
- registrations-fullness FUTURE_ONE_OFF had `firstDate_tz: string`; make it a
  `SupportedTimezones` literal (`as const`) and wrap the create in `createData`.

Refs #599

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
sydevs-bot pushed a commit that referenced this pull request Sep 12, 2026
Resolves the conflicts #750 (the Sahaj Atlas schema rewrite, #706) created.
Both branches rewrote a translations global, so the overlap is the one
importer, the migration index, and the specs that read both schemas.

Four conflicts, each resolved to keep both behaviours:

- `src/migrations/index.ts` — all three migrations, in timestamp order:
  #750's atlas reshape first, then this branch's drop and add.
- `seeds/translations/import.ts` — `seedWmWeb` (real English copy, published)
  beside `seedAtlas` (ten locales, each published). `writeGlobal` takes
  main's `locale` parameter, so wm-web passes `DEFAULT_LOCALE` explicitly.
- `tests/int/translations-globals.int.spec.ts` — main's atlas field set,
  this branch's wm-web set, one merged docblock.
- `seeds/AGENTS.md` — one section covering both globals' real copy and both
  publishes.

`generateExampleData` is deleted, not merged. Each side replaced one of its
two callers with real copy, and this branch's own comment said to delete it
once #706 took the last one. The plural-expansion fix this branch made to
that generator goes with it — `pnpm seed translations` no longer generates
data for any global, so the break it repaired cannot recur here.

Also repairs the out-of-order snapshot trap (`src/migrations/AGENTS.md`).
The two migration snapshots on this branch were generated before #750
merged, so the newest-by-timestamp snapshot described the pre-#750 atlas
columns. The next `migrate:create` would have re-emitted #750's DDL and
crash-looped the boot migration (#566). Both snapshots now carry #750's
atlas tables, and `pnpm db:migrations:create --skip-empty` emits nothing.

Verified: lean gate green (lint, typecheck, typecheck:tests, 1778 unit
tests); `translations-globals` (23), `wm-web-translations-seed` (7) and
`translations-field` (22) integration specs green; `pnpm generate:types`
leaves `src/payload-types.ts` byte-identical, so the merged types already
match the merged config.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01T8bW17CGRLHDEzMz9pTk4m
sydevs-bot pushed a commit that referenced this pull request Sep 12, 2026
…-seo-root

#750 rewrote the atlas translations schema by widget view while this branch
added a `seo` group to the same global. Four files conflicted; two more
needed adapting because main renamed a key this branch reads.

- `src/migrations/index.ts` — both migrations kept, in timestamp order, so
  `20260909_..._atlas_translations_by_view` runs before
  `20260912_..._atlas_translations_seo_group`. The `seo` column name collides
  with nothing #750 adds or drops, so the DDL is unchanged.
- `20260912_..._atlas_translations_seo_group.json` — rebased onto #750's
  snapshot plus the two `seo` columns. It is the highest-timestamp snapshot,
  so left describing the pre-#750 schema it would have made the next
  `migrate:create` re-emit all of #750's DDL and crash-loop the boot
  migration (#566, `src/migrations/AGENTS.md`). Regenerating it under a new
  timestamp is unsafe — this branch has already deployed to its preview — and
  `migrate:create` cannot answer its own rename-vs-create prompt unattended.
  Verified: `migrate:create` now finds no schema change and no longer prompts,
  where against the stale snapshot it prompted on `common_chrome`.
- `common.free_meditation_classes` became `common.chrome.widget_label` in
  #750 — same string in all ten locales. The root title's in-locale fallback
  now reads the new path, and the select descends into `common` rather than
  taking all seven of its columns.
- `src/globals/AGENTS.md`, `tests/int/translations-globals.int.spec.ts`,
  `tests/unit/atlas-translations-schema.spec.ts` — `Seo` joins `Emails` as the
  second group no widget view reads, so #750's "one tab per widget view" rule
  and its three key counts now name both exceptions.
- `src/payload-types.ts` — regenerated; carries both `SyAtlasTranslationsSeoStrings`
  and `SyAtlasTranslationsCommonChromeStrings`.

Gate: lint, `tsc` over src and tests, 1804 unit tests. Targeted specs
`atlas-seo` + `translations-globals` — 72 passed.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MoEHvcg8TondFU4WSguGcK
sydevs-bot pushed a commit that referenced this pull request Sep 12, 2026
`main` moved again with #747 — `wm-app-translations` gains per-locale
`_status` and `wm-app-config` gains `availableLocales`. Both sides'
behaviour is kept.

- `src/globals/AGENTS.md`: kept this branch's #707 Web-tabs section and its
  two key conventions, and took `main`'s framing sentence. All three
  translations globals now carry per-locale status, so "three things
  distinguish the two web globals from wm-app" is no longer true.
- `tests/COVERAGE.md`: took `main`'s two rewritten rows and kept this
  branch's two wm-web rows, which `main` has no counterpart for.
- `src/migrations/index.ts`, `src/payload-types.ts` and the four `main`-only
  specs merged cleanly, in timestamp order.

**Both snapshots repaired a second time.** #747's migration is
`20260909_161243`, older by timestamp than this branch's `161848` and
`162104`, so after the merge the newest-by-timestamp snapshot still described
the pre-#747 `wm_app` schema — the out-of-order snapshot trap in
`src/migrations/AGENTS.md`. Verified before the repair: `db:migrations:create
--skip-empty` re-emitted #747's DDL byte for byte, and replaying it aborts
the boot migration on deploy (#566). Both snapshots now carry #747's
`wm_app` schema, and the same command emits nothing.

**Two comments the merge falsified, corrected without changing behaviour.**
`seeds/translations/import.ts` and `tests/int/wm-web-translations-seed.int.spec.ts`
both said `wm-app-translations` holds one `_status` for every locale. It has
per-locale status since #709. The seed still leaves it unpublished — an
operator republishes each locale after the deploy — and the assertion, read
at `locale: 'en'`, still holds.

Gate: lint, both typechecks, 1778 unit tests, and the three integration
specs covering the conflicted files (49 tests) all pass.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0146WwB8svzTLxZMfRraYati
sydevs-bot added a commit that referenced this pull request Sep 14, 2026
20260914_175014 was generated against the pre-merge snapshot, so its 142
statements were all re-emissions of DDL this chain already applies. Checked
one by one against every other migration: zero were new. They come from
20260705_160029, 20260705_161112, 20260909_161243, 20260909_161353,
20260909_161848, 20260909_162104, 20260911_235823, 20260912_031449 and
20260913_212558 — every one of them ahead of it in index.ts.

Replaying that aborts the boot migration on its first statement, CREATE TYPE
enum_wm_app_config_available_locales already exists, and the drops further
down would take the translation columns with them. This is #566, the
out-of-order snapshot trap the PR body warned was still open.

The .json half is the fix, not the problem: it was generated on the merged
tree, so it carries both user_submissions and main's 20260909-20260913
schema. Keeping it as the highest-timestamp snapshot with no DDL beneath it
heals the chain. Verified: db:migrations:create --skip-empty now writes no
files, so the snapshot and the config agree exactly.

Nothing rolls back here. The migration failed on statement one, so it
committed no schema and left no payload_migrations row.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LYKfe6EDGUTFV7rDmi8a7w
Ardnived added a commit that referenced this pull request Sep 15, 2026
…754)

* feat(api)!: unify public intakes on a `user-submissions` collection (phase 1)

Phase 1 of #695, per #723: the form-builder plugin's submissions collection
is renamed `user-submissions` and given the typed columns every public write
needs, beside the three collections it will eventually replace. Nothing is
deleted here — `registrations`, `user-messages` and `event-submissions` keep
working until Phase 3.

- `formSubmissionOverrides.slug` + a `fields` override adds `type`, `uuid`,
  `status`, `senderEmail`, `user`, `client`, `subject`, `screeningResult`,
  `activityLog`, `event`, `startingAt`, `unsubscribedAt`, `eventFeedback`,
  `followUpSentAt` and `proposed`. `submissionData` keeps only the flat
  free-form remainder, since it is client-writable as one blob and nothing
  queryable, unique, relational or system-gated can be protected inside it.
- `prepareUserSubmission` (beforeValidate) enforces per-type allowed keys and
  lengths on that blob, issues the `uuid`, composes `subject`, upserts the
  sender into `users`, and stamps provenance from the authenticated key.
- The plugin's unconditional `form` requirement becomes per-type: required for
  `contact` and `subscribe`, refused for the two that name an `event`. The
  plugin's own existence check is composed with, not replaced.
- Forms gain `actionType` with conditional `recipient` / `client`, save-time
  validation of the authored field list, and lose `emails` — a structural
  disable of the plugin's pre-screening `sendEmail`, not a suppression.
- Every `type: 'json'` column declares a `jsonSchema`, `logField`'s included.
  Its entries stay open (`additionalProperties: true`) because machine data is
  each writer's own; `LogDisplayCells` declares the matching index signature.
- `user-submissions` joins RESTRICTED_COLLECTIONS and leaves the wemeditate-web
  project. Clients get create-only; a manager's read is narrowed per row to
  contact rows addressed to them plus proposals.
- The `registrations: ['update']` client grant, its uuid-scoped access branch
  and `restrictClientRegistrationUpdate` are removed. The vote's only writer is
  the CMS-hosted feedback page, which writes with `overrideAccess` — that grant
  was an open write path nothing used.
- `Users` shows one `submissions` join in place of `registrations` and
  `submittedEvents`.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01QYXZbMFo1WvADtgEwSxHXP

* test(api): cover the unified intake's create path, access matrix and form actions

Four spec files, plus the two the change re-points.

Each caught a defect while being written, which is the reason for the shape
they take:

- `user-submissions-access.int.spec.ts` reads rows back through
  `overrideAccess: false` rather than asserting grants, and found that the
  form-builder plugin's own `access` block outranks the whole RBAC layer
  (`accessPlugin` composes `{ ...rbac, ...collection.access }`). Its
  `read: !!user` would have granted every API client read of every stranger's
  message, with `RESTRICTED_COLLECTIONS` looking like it applied. The plugin's
  `access` is now cleared for this collection.
- `user-submissions-create.int.spec.ts` found the Turnstile stub succeeding for
  any argument, so the "no token" case passed for the wrong reason; found the
  offending key missing from a `ValidationError`'s message, which is the one
  thing the acceptance criterion asks for; and found the plugin's `sendEmail`
  throwing once per form-less submission.
- `forms-action-type.int.spec.ts` pins the save-time rules and that `emails` is
  absent from the sanitized config.
- `submission-data.spec.ts` holds the per-type key matrix in the unit lane, and
  the URL-scan exemption that keeps a crash report from reading as spam.

The access, form-action and submission-data specs were each re-run with the
rule they cover disabled, and each went red.

`event-feedback.int.spec.ts` is re-pointed at the real writer: the feedback
page's server action, which votes with `overrideAccess`. Its client-vote block
becomes the assertion that no client write path exists.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01QYXZbMFo1WvADtgEwSxHXP

* fix(api): gate the proposed patch, and loosen the activity-log schema

Two corrections found reviewing the branch against `src/collections/AGENTS.md`.

`proposed` reaches `user-submissions` from a public POST and is a patch of real
Events fields, so Phase 3's accept path would apply it to an Event with a
manager's authority behind it — a submitter setting `verificationStage` mints a
verified listing, and `registrationNotificationEmail` forwards registrants'
answers to an inbox of their choosing. `validateProposal` is `event-submissions`'
own gate and derives its allowlist from the live Events config, so it is reused
rather than re-derived. It moves to a shared home in Phase 3, when that
collection is deleted.

`activityLog`'s schema now declares no `required` keys. Payload runs a JSON
validator on every save of the document, including one that never touches the
column — and this column predates the `logField` factory: it was Registrations'
`reminderLog`, whose entries were reminders with no `cells`. A `required` list
would have made any row holding one permanently unsaveable, which no test here
could see because no test holds a pre-#626 row. Type checks on the properties
that are present still apply.

The verification spec's hand-built log fixture is rebuilt with the real entry
builders either way: the entries it spelled out omitted `type` and `cells`,
which nothing that writes the column omits, so the crash it simulates was a
state the app cannot reach.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01QYXZbMFo1WvADtgEwSxHXP

* docs(api): describe the unified intake's client contract and access rules

The new refusal codes, the URL-scan exemption, and the create-only grant are
things an integrator observes, so they belong beside the Turnstile contract
rather than only in the code that raises them. Also corrects a cross-reference
in EventSubmissions to the Users join that replaced `submittedEvents`.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01QYXZbMFo1WvADtgEwSxHXP

* fix(api): close the defects an adversarial review found in the intake

Nine findings from a security pass and a code-quality pass over the branch.
Five would have shipped a defect; each now has a test that fails without the
fix.

- **An unrecognised `type` crashed the public POST with a 500.** This hook runs
  before Payload validates the select's options, so the cast reached
  `TYPE_SUBMISSION_KEYS[type]` and spread `undefined`. Checked now, with the
  same 400 the neighbouring refusals use.
- **`type` was never reconciled with the form's `actionType`**, and
  `enforceSubscribeReach` keys on `type` — so a restricted client could post
  against another client's subscribe form while calling the row a `contact`,
  and the reach check never ran. The form is the authority; a disagreement is
  refused rather than silently corrected.
- **`activityLog` was client-writable.** `logField`'s docblock promised it was
  never writable through the API and stated that nowhere the server reads, which
  did not matter while the column sat on collections no client could write. The
  admin renders it as system-written history. Denied to clients — deliberately
  not a flat `update: () => false`, because the admin verify action writes that
  log with `overrideAccess: false` so the manager's own permissions gate it, and
  a blanket deny silently dropped the record of who verified a listing.
- **`validateFormAction` merged with `??`.** Payload normalises a cleared
  relationship to `null` and hands the hook data already merged with the stored
  document, so clearing a subscribe form's client read as the old client and
  passed the one rule the hook exists for. It now reads the merged value, and
  judges a save only when it changes the field list, the action or the client —
  which is also what stops a legacy form, back-filled to `contact` and lacking a
  message field, becoming unsaveable on an unrelated edit.
- **`subject` echoed the title of any event id a client named**, drafts and
  trashed rows included, routing around the published-only narrowing a client's
  own reads get.

Three test cases could not fail for their own rule: a form fixture that also
broke a second rule, a `?? []` join assertion that could not tell "filtered to
nothing" from "never populated", and an "admins read everything" case reading
with `overrideAccess: true`. All three assert the property they name now.

Also: the entry cap short-circuits instead of emitting one message per row;
`activityLog` gained `maxItems`; a `.catch(() => null)` that turned a transient
database error into a 400 blaming the integrator is gone; the dead
`urlScanFields: ['subject']` entry is removed with a note saying why field
access had already emptied it; and the docs' claim that both new refusals are
400 is corrected — `subscribe_target_forbidden` is 403.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01QYXZbMFo1WvADtgEwSxHXP

* build(deps): patch drizzle-kit so migrate:create survives a table rename

`pnpm payload migrate:create` died with "Cannot read properties of
undefined (reading 'columns')" on this branch, before writing any file.

drizzle-kit's `applyPgSnapshotsDiff` rewrites the old snapshot as it
resolves each rename, but hands `preparePgAlterColumns` the raw `json1`
instead of the rename-patched copy. So a renamed table that also has
altered columns — `form_submissions` -> `user_submissions`, which is every
collection rename — is looked up in the pre-rename snapshot under its new
name, comes back undefined, and the diff throws.

The patch passes the rename-patched `tables` while keeping the original
`enums`: the same function reads `json1.enums` by *old* enum name, so
substituting the fully patched snapshot would break enum-rename detection.

Still unfixed upstream through 0.31.10, and @payloadcms/db-postgres pins
drizzle-kit to exactly 0.31.7, so patch rather than bump. `payload` and
`@payloadcms/db-postgres` drop their carets for the same reason — a float
onto a release carrying a different drizzle-kit would leave the patch
matching nothing.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* feat(db): add the user-submissions migration

The schema change landed in 537da0c with no migration, so every Railway
preview boot ran this branch's code against an unmigrated database and
`GET /api/forms` 500'd on the missing `forms.action_type`.

Renames rather than rebuilds, so existing submissions survive:
`form_submissions` -> `user_submissions`, its `submission_data` child
table, and `payload_locked_documents_rels.form_submissions_id`. Then the
intake columns (`type`, `status`, `sender_email`, `uuid`, the event and
client relations, the jsonb `proposed`/`screening_result`/`activity_log`),
`forms.action_type`/`recipient_id`/`client_id`, and the drop of
`forms_emails` + `forms_emails_locales`, which `action_type` and
`recipient_id` replace. `user_submissions.form_id` loses NOT NULL — a
submission need no longer come from a form.

`down` reverses all of it, including recreating both dropped tables.
Validator: 4 pass, 0 fail; the four warnings are the expected DROP TABLE /
DROP COLUMN / RENAME notices. No DDL here repeats anything in the applied
chain.

Generating it needed the drizzle-kit patch in the previous commit.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* docs(migrations): record the drizzle-kit rename patch

The patch and its exact-version pins landed in b001669 undocumented, so the
next person to hit "Cannot read properties of undefined (reading 'columns')"
would re-derive the whole diagnosis. States what the patch fixes, why the
versions lost their carets, and that the rename prompt still needs an
attended run.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MtUegBuq8Kg6aqp797zxPL

* Create migration

* fix(db): empty the duplicate resync migration

20260914_175014 was generated against the pre-merge snapshot, so its 142
statements were all re-emissions of DDL this chain already applies. Checked
one by one against every other migration: zero were new. They come from
20260705_160029, 20260705_161112, 20260909_161243, 20260909_161353,
20260909_161848, 20260909_162104, 20260911_235823, 20260912_031449 and
20260913_212558 — every one of them ahead of it in index.ts.

Replaying that aborts the boot migration on its first statement, CREATE TYPE
enum_wm_app_config_available_locales already exists, and the drops further
down would take the translation columns with them. This is #566, the
out-of-order snapshot trap the PR body warned was still open.

The .json half is the fix, not the problem: it was generated on the merged
tree, so it carries both user_submissions and main's 20260909-20260913
schema. Keeping it as the highest-timestamp snapshot with no DDL beneath it
heals the chain. Verified: db:migrations:create --skip-empty now writes no
files, so the snapshot and the config agree exactly.

Nothing rolls back here. The migration failed on statement one, so it
committed no schema and left no payload_migrations row.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LYKfe6EDGUTFV7rDmi8a7w

* docs(migrations): record how to heal a stale snapshot

The trap section said the chain heals once a fresh snapshot lands, but not
what to do with the unusable .ts that arrives beside it. Names the shape —
keep the snapshot, empty the DDL, keep the timestamp — and the probe that
proves it worked.

Also states what cost this a second round: push: !isProduction means no test
lane ever replays the chain, so CI is silent about a migration that cannot
apply. Only a Railway boot runs prodMigrations.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LYKfe6EDGUTFV7rDmi8a7w

* fix(users): keep the registration and proposal joins until Phase 3

The `submissions` join was added in place of `registrations` and
`submittedEvents`, but nothing writes `user-submissions` yet — Phase 1 adds
the schema only. `registerForEvent` still creates `registrations`, and
`event-submissions` still takes proposals. So the new join showed nothing
while the two it replaced were the admin's only window onto a registrant's
live history.

#723 is explicit that the old collections' behaviour does not change this
phase. All three joins now sit side by side; the two legacy ones go in Phase
3, with the collections they read. The comment says why they are still there,
so the next reader does not re-derive it.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01THSsECbMbjXErzVELQSDUH

* fix(deps): pin the whole Payload family, not two of it

`payload` and `@payloadcms/db-postgres` dropped their carets so the
drizzle-kit patch key keeps matching. The other eight family members kept
`^3.86.0`, and Payload does not support a mixed-version family — so one
`pnpm update` could put `@payloadcms/[email protected]` beside a pinned
`[email protected]`, a break with no patch involved.

Every `@payloadcms/*` now pins `3.86.0`, `typescript-plugin` included. No
version moves: only the nine `specifier:` lines change in the lockfile, and
`pnpm install --frozen-lockfile` accepts it unchanged.

`src/migrations/AGENTS.md` says why the pins are there and how to bump them,
beside the patch story that made the first two exact.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01THSsECbMbjXErzVELQSDUH

* fix(forms): one home for the sendEmail removal story

The mechanism was told three times and one telling was wrong.
`Forms/fields.ts` and the first `formBuilder/index.ts` docblock both said
stripping `emails` disables the plugin's `sendEmail` hook, via its
"nothing-to-send" branch. It does not get that far: it loads `data.form` and
spreads `data.submissionData` first, both optional here, so it throws.
Removing the hook is what disables it.

The detailed docblock also sat on `formBuilder` while describing what
`formsPlugin` does. It moves onto `formsPlugin`, which is where the `access`
clear and the hook removal happen, and is now the one statement of both.
`formBuilder` documents the plugin options alone. `Forms/fields.ts` keeps
why `emails` is stripped — it owns that list — and points here for the hook.
`collections/AGENTS.md` points here too rather than restating it.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01THSsECbMbjXErzVELQSDUH

* fix(submissions): say what subject is actually composed from

The docblock said "not client-writable: it is derived". The column is indeed
denied to clients, but `composeSubject` joins a contact form's title with the
sender's own `subject` pair — so unreviewed submitter text does reach the
admin list title, which is the thing the old wording promised it would not.

Wording, not a hole: the pair is URL-scanned, bounded by `checkSubmissionData`
and truncated to 300. The docblock now says both halves, and says to treat the
value as untrusted at any new render site.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01THSsECbMbjXErzVELQSDUH

* fix(submissions): fold the proposal schema into its field

`proposal.ts` was 38 lines for one constant with one consumer, 29 of them
comment. The rationale reads better beside the field it governs, and there is
nothing left to share: the Phase 2 job and admin component that would have
made it a leaf module do not exist yet.

`screening.ts` stays. It has two importers — `UserMessages` reads
`screeningResultJsonSchema` too — so folding it here would make one collection
import another's field list.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01THSsECbMbjXErzVELQSDUH

* fix(forms): inline the one-use block helper

`blockTypes` was a four-line wrapper over `new Set(...)` with one caller, and
its name said what it did rather than why — so a reader met an abstraction
before the rule it serves. The set is now built where it is read, with a line
saying what it is for.

The hook's own purpose is unchanged and stated in its docblock: a subscribe
form with no email field, or a contact form with no message body, collects
nothing usable and fails on every submission thereafter, one visitor at a
time, with the author never present to see it. Refusing the save is the one
moment the person who can fix it is there.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q35b7JXvBHQv1tdYbm4dtY

* fix(submissions): drop the subscribe reach check

Any client role may now subscribe a person to any client's list, as asked in
review. `enforceSubscribeReach`, its `subscribe_target_forbidden` refusal, the
`UNRESTRICTED_SUBSCRIBE_ROLES` exemption and its integration case are gone,
along with the row in `docs/rules/api-clients.md`.

The `type`/`actionType` reconciliation in `prepareUserSubmission` stays. It was
introduced partly to keep this check reachable, but it stands on its own: every
per-type rule downstream keys on `type`, so a row calling itself a `contact`
against a subscribe form is judged by the wrong rules throughout. Its comment
no longer cites the removed hook.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q35b7JXvBHQv1tdYbm4dtY

* fix(submissions): declare the JSON columns in zod

`screeningResult` and `proposed` still hand-built a `JSONSchema4` literal and a
`{ uri, fileMatch, schema }` wrapper. #756 made `jsonField` the one way to
declare a JSON column, with the shape in Zod inline at the field, so both are
now declared that way and the three repeated URI strings are gone.

`screening.ts` keeps `SUBMISSION_VERDICTS` and drops the schema. That module is
a leaf an admin component may import, and a Zod shape there would pull `zod`
and a `toJSONSchema` call into the browser chunk to describe a column only the
server validates — the rule in `src/collections/AGENTS.md`. `z.enum` reads the
verdict list directly, so nothing is spliced.

`pnpm generate:types` regenerates `src/payload-types.ts` byte-identically, which
is the evidence that `SubmissionScreeningResult` and `SubmissionProposal` are
the same shapes as before.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q35b7JXvBHQv1tdYbm4dtY

* fix(fields): declare the activity log in zod

`logField` built its own `{ uri, fileMatch, schema }` wrapper from a
hand-written `JSONSchema4`, which is exactly what `jsonField` exists to stop
(#756) — and it exported `ACTIVITY_LOG_SCHEMA_URI`, the kind of `*_SCHEMA_URI`
constant that refactor deleted everywhere else. Nothing imported any of the
three, so they go rather than being re-exported.

The shape is unchanged: every property stays optional and the entry object
stays open, because Payload runs this validator on every save of the document
and the column predates the factory — a `required` key strands a row holding
an older entry. `z.looseObject` emits `additionalProperties: {}` for that, and
`.max(500)` keeps the cap a single bypassing write would otherwise ignore.

`jsonField` interns one object per distinct shape, so Events, Registrations and
`user-submissions` still share one generated `ActivityLog` interface rather
than getting `ActivityLog1`. `pnpm generate:types` regenerates
`src/payload-types.ts` byte-identically, which is what proves it.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q35b7JXvBHQv1tdYbm4dtY

* fix(submissions): derive the submission unions from payload types

`SubmissionType` and `SubmissionStatus` were `(typeof ARRAY)[number]`, which is
a restatement one hop away from the generated column — the pattern
`src/types/AGENTS.md` refuses, because such a type drifts wider than the CMS and
then compiles values the database rejects.

Both now read off `UserSubmission['type']` and `UserSubmission['status']`. The
const arrays stay: they are the runtime values `fields.ts` builds the two
selects from, so the column is generated from them and deriving the types back
closes the loop. An option added without a `TYPE_LABELS` or
`TYPE_SUBMISSION_KEYS` entry is now a compile error instead of an `undefined`
spread at runtime.

The module stays a leaf — `@/payload-types` is types only, so nothing reaches a
browser chunk that did not before.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q35b7JXvBHQv1tdYbm4dtY

* fix(submissions): fold the verdict list in beside its column

`screening.ts` held one const with one consumer and an alias with none, so
it goes the way `proposal.ts` went in b4c2d8f. `SUBMISSION_VERDICTS` now sits
beside `screeningResultField` in `fields.ts`, which builds the schema's enum
from it, and the module's one substantive paragraph — why the machine verdict
lives in this column and never in `status` — moves onto that field.

`SubmissionVerdict` is deleted rather than re-derived. Nothing imported it, and
the list already generates `SubmissionScreeningResult['verdict']`; an exported
alias would be the second definition `src/types/AGENTS.md` says to delete, not
to point somewhere else. A Phase 2 consumer reads the generated type directly.

`pnpm generate:types` leaves `payload-types.ts` byte-identical, which is the
evidence no shape moved.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01XpWhgSLpDEgsryNu4btTJt

* fix(submissions): read the type unions straight from payload-types

`UserSubmissions/types.ts` is gone. Its two exported aliases were the
re-export chain `src/types/AGENTS.md` prohibits: `SubmissionType` and
`SubmissionStatus` already spelled `UserSubmission['type']` and
`['status']`, and exporting them gave each shape a second home for every
consumer to reach through.

Each consumer now names the generated union at its own call site —
`submissionData.ts` twice, `fields.ts` once, `prepareUserSubmission.ts`
three times — so no file imports a type from another module that is only
forwarding one. With `submissionData.ts` off the module entirely, the
pure-module objection that kept `types.ts` alive last round is gone: it
takes `@/payload-types`, which is types only, and pulls no `zod` or
`logField` into the unit lane.

The runtime halves move to `fields.ts`, beside the selects they build —
the same fold `proposal.ts` and `screening.ts` got. `SUBMISSION_STATUSES`
and `STATUS_LABELS` stop being exported: only `statusField` reads them.

No shape moves. `pnpm generate:types` leaves `src/payload-types.ts`
byte-identical.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Nrgkhg12CwBzFcYKtRbmnu

---------

Co-authored-by: Claude <[email protected]>
Co-authored-by: Devindra <[email protected]>
Co-authored-by: sydevs-bot <[email protected]>
sydevs-bot pushed a commit that referenced this pull request Oct 21, 2026
Both sides appended migrations, so the registry in src/migrations/index.ts
conflicted twice. Kept both sides, interleaved by timestamp, which is the
order migrate:create itself generates: main's five event-import migrations
sit around this branch's two.

That merge left the newest-by-timestamp snapshot stale again. 20261020_185917
was taken before main's `imports` tables existed, so it is newest and missing
them — the #566 out-of-order snapshot trap, armed for whoever generates the
next migration. 20261020_235623_merge_981_main_snapshot is the heal: its
`.json` was generated on the merged tree and carries both branches' schema,
and its DDL is empty because every statement migrate:create emitted is
byte-identical to what main's own snapshot already records as applied.

src/payload-types.ts auto-merged to main's file plus this branch's two lines,
Form.title and Form.redirect.url becoming optional. No product file overlaps.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0153p83du2NKAkyKiayY6UG1
Ardnived added a commit that referenced this pull request Nov 4, 2026
Conflicts, both generated:
- src/migrations/index.ts: main's two migrations and this branch's two,
  listed in timestamp order. They touch disjoint columns, so production and
  the PR preview may apply them in either order.
- src/payload-types.ts: regenerated on the merged tree.

Also needed by the merged tree:
- 20261104_185158_snapshot_resync: routing_region's snapshot predates main,
  so migrate:create re-emitted main's DDL. Kept the merged snapshot, emptied
  the DDL; a second probe writes no files (src/migrations/AGENTS.md, #566).
- block-user.int.spec.ts gave its manager the stored `atlas-manager` role,
  which this branch removes; it now lists them on a region instead.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
sydevs-bot pushed a commit that referenced this pull request Nov 12, 2026
…ne counts

main's `20261111_215539_activity_log_rows` and this branch's data-only
`20261111_230500_atlas_calendar_menu_copy` each landed last in
`src/migrations/index.ts`. Both are kept, in timestamp order.

The copy migration carries no DDL, so its `.json` is a copy of its
predecessor's — and after this merge that predecessor is the activity-log
migration, not `20261111_152439_merge_main_snapshot_7`. Re-stamped from it:
otherwise the newest-by-timestamp snapshot is short three tables and the next
`migrate:create` re-emits DDL that is already applied (#566). Probed with
`db:migrations:create --skip-empty`, which wrote nothing.

The unit lane is 267 files and 3569 tests on the merged tree — measured, not
summed. Both branches edited those counts, which `perf-figures-pinned.spec.ts`
pins across `tests/PERF.md`, `docs/rules/testing-reqs.md`, `tests/AGENTS.md`
and `AGENTS.md`.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjZb9tZKkL8zBXBSqae
sydevs-bot pushed a commit that referenced this pull request Nov 16, 2026
`20261116_171937_storage_prefix.json` was generated before main's
`20261115_184420_payload_3_92` landed, and carries the higher timestamp. So
the next `migrate:create` diffed against it and re-emitted all 32
`CREATE INDEX` statements that migration already ships — the out-of-order
snapshot trap (#566, `src/migrations/AGENTS.md`). Replaying one aborts the
boot migration on a Railway deploy.

The generated file keeps only its `.json`, which was built on the merged
tree. A probe run after emptying the DDL wrote no files.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjZA13k1h23uDZrPtgW
sydevs-bot pushed a commit that referenced this pull request Nov 18, 2026
Both sides added a migration, so `src/migrations/index.ts` conflicted. Both
are kept, in timestamp order — they are independent.

The data-only migration main added re-stamps the previous migration's
snapshot, and after this merge the previous migration is this branch's. Its
`.json` is re-copied from `20261118_181435_add_songs_duration.json` for that
reason. Left as main wrote it, it is the newest snapshot by timestamp and
states no `songs.duration`, so the next `migrate:create` on main re-emits
`ALTER TABLE "songs" ADD COLUMN "duration"` — the replay that aborts a boot
migration (#566). Watched it emit exactly that, then verified a probe writes
nothing against the re-stamped snapshot.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjXaZcpX2oGt8egpGWS
sydevs-bot pushed a commit that referenced this pull request Nov 18, 2026
Both sides appended a migration, so `src/migrations/index.ts` conflicted.
Kept both, in timestamp order.

`20261118_210000_wm_web_new_tab_one_key` is data-only, and its snapshot was a
verbatim re-stamp of the baseline's. The merge puts `20261117_234341_tidy_event_form`
ahead of it, so its snapshot is re-stamped from that one instead. Left as merged,
the newest-by-timestamp snapshot would still have carried `inactive` and the two
notification columns, and the next `migrate:create` would have re-emitted this
branch's DDL against a database that already ran it (#566).

`migrate:create probe_merge --skip-empty` writes no files on the merged tree.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjYGBMKY1JeVtTPhXJx
sydevs-bot pushed a commit that referenced this pull request Nov 19, 2026
Merging main put 20261119_044129_tidy_event_form after this branch's
20261118_235242_wm_web_drop_video_tab, so the newest snapshot by timestamp
still described the four video columns. The next migrate:create diffed against
it and re-emitted their DROP COLUMN statements, which abort the boot migration
on any database that already ran them (#566).

The new pair's .json was generated on the merged tree and is the first snapshot
describing both branches. Its DDL is emptied, because every statement it emitted
already ships in 20261118_235242. A probe run after the edit writes no files.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjY98wJGEvyxCnG2fv1
sydevs-bot pushed a commit that referenced this pull request Nov 20, 2026
main's 20261118_235242_wm_web_drop_video_tab drops four video columns under a
timestamp later than the migration whose snapshot preceded it, so main carries
20261119_223756_merge_snapshot_heal to put a truthful snapshot back on top.
This branch's two live-session migrations carry later timestamps still, and
their snapshots were generated before that drop reached the branch, so the
merge left the newest snapshot on disk describing a schema that still held the
columns.

Measured, not argued: migrate:create on the merged tree re-emitted all four
DROP COLUMN statements, which abort the boot migration on a database that
already ran them (#566). This file is that run, with its DDL emptied and its
snapshot kept — the pattern src/migrations/AGENTS.md documents and main used
hours earlier. A second migrate:create then wrote nothing.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjY1McojPZnXRjDrP2T
sydevs-bot pushed a commit that referenced this pull request Nov 20, 2026
Resolves `src/migrations/index.ts`, and regenerates both of this branch's
migrations on the merged tree.

The snapshot chain forced the regeneration. `main` gained
20261118_235242_wm_web_drop_video_tab, which drops four translations columns,
and 20261119_223756_merge_snapshot_heal, whose whole purpose is to be the first
snapshot describing both branches. This branch's two migrations carried later
timestamps and snapshots generated before either, so the merged tree's newest
snapshot still described the dropped columns — the next migrate:create would
have re-emitted those four DROP COLUMN statements and aborted the boot
migration on a database that already ran them (#566).

So both files move to timestamps after the heal and take a snapshot generated
on the merged tree. The regenerated DDL is byte-identical to the reviewed one,
and nothing else came with it. `migrate:create --skip-empty` now writes no
files, and the whole chain applies to a fresh database.

Co-authored-by: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjXC4WxUHuaGH3iGdYG
sydevs-bot pushed a commit that referenced this pull request Nov 22, 2026
Resolves the one conflict, src/migrations/index.ts, where both sides
registered migrations: main's two 20261121 a11y drops and this branch's
20261120_235118_lecture_date. All three are kept, in timestamp order.

The merge also leaves the snapshot chain stale, which no conflict marker
shows. Both a11y snapshots were generated on a main without
"lectures"."date", and they carry the later timestamps, so the
newest-by-timestamp snapshot described a schema without that column. The
next migrate:create would have re-emitted the same ADD COLUMN and aborted
the boot migration on a database that already ran it (#566). Generating it
here confirmed that: the statement it emitted was byte-identical to
20261120_235118_lecture_date's. So 20261122_182348_merge_snapshot_heal
ships for its snapshot alone, with empty up and down, as
20261119_223756_merge_snapshot_heal did before it.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjYFK1mSwcR8Esw2eXf
sydevs-bot pushed a commit that referenced this pull request Nov 22, 2026
…c-channels

Both sides added migrations, so index.ts keeps all four, ordered by
timestamp. The channel pair runs before main's a11y drops; the tables are
disjoint, so the order is the one the preview already applied.

main's two migrations carry later timestamps than this branch's, so the
newest snapshot on disk described a schema without the channel columns —
the #566 out-of-order snapshot trap, the same one this branch already hit
once. 20261122_182415_merge_snapshot_heal carries the snapshot generated
on the merged tree, with empty bodies: its emitted DDL was byte-identical
to 20261120_231045, which ships it earlier in the chain.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjV857FBzf1DfAuiz3r
sydevs-bot pushed a commit that referenced this pull request Nov 22, 2026
…tdown-directory

main's #1246 withdrew every `a11y` group from the three translations globals, so
the four conflicts are all that collision with this branch's new
`blocks.live_session` group.

- `blocks.a11y` goes, `blocks.live_session` stays, in the schema's type, the
  seed file, the leaf-group spec and `src/payload-types.ts`. `pnpm
  generate:types` on the merged tree reproduces the hand resolution byte for
  byte.
- The collapsible spec takes main's shape — every sub-group opens, since
  SUBGROUP_PRESENTATION is gone — but not its `toBe('General')`: `blocks` now
  carries a second sub-group, which is what the leaf-group set already pins.
- `_meta.schema_version` is re-derived, not merged: 14 leaf groups and 104
  declared keys, as `translations-seed-meta.spec.ts` computes them.
- `src/migrations/index.ts` keeps both branches' migrations in timestamp order.

20261122_182623_merge_snapshot_heal_a11y_live_session heals the snapshot chain
again. main's two a11y drops carry later timestamps than this branch's
live-session migrations and their snapshots predate `blocks_live_session`, so
`migrate:create` on the merged tree re-emitted both of
20261119_230234_wm_web_live_session_keys' ADD COLUMNs — the #566 boot abort. Its
DDL is emptied and its snapshot kept, and a probe run now writes nothing.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjYK2WPg76HitzFZZHH
sydevs-bot pushed a commit that referenced this pull request Nov 25, 2026
…s-inline-strings

Both migrations are wanted, so `src/migrations/index.ts` lists both, in
timestamp order: main's 20261123_185218_pages_parent_index_pages ahead of
this branch's 20261125_152923_atlas_drop_compact_tab.

That order leaves this branch's snapshot newest by timestamp and blind to
main's twelve statements, which is the out-of-order snapshot trap (#566).
20261125_191844_merge_snapshot_heal carries the first snapshot generated on
the merged tree; its own DDL is emptied, because every statement it emitted
was byte-identical to the migration already shipping them. A probe
migrate:create then wrote no files.

`src/payload-types.ts` is generated, and the textual merge dropped main's
field descriptions on WmWebConfig's homePage, indexPages.meditations and
indexPages.lectures. Regenerated, so the file matches the merged config —
it is a contractSync source for WeMeditateWeb and SahajAtlasWeb.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjVyaeoS8cD9RppZyt3
sydevs-bot pushed a commit that referenced this pull request Nov 25, 2026
src/migrations/index.ts was the only conflict: both sides appended a
migration, so both entries stay, in timestamp order.

That merge re-armed #566. 20261123_185218_pages_parent_index_pages came
from main with a timestamp above this branch's heal, and its snapshot
describes no "lectures"."date", so the newest snapshot on disk no longer
covered the merged schema and the next migrate:create re-emitted an
ADD COLUMN that 20261120_235118_lecture_date already ships.
20261125_191905_merge_snapshot_heal carries the merged-tree snapshot with
empty DDL; a probe run afterwards wrote no files.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjX7ThbbXX31Xcg5WXr
sydevs-bot added a commit that referenced this pull request Nov 25, 2026
main's `20261123_185218_pages_parent_index_pages` carries a timestamp between
this branch's own migrations, so the newest snapshot on disk described a schema
holding none of its columns. `migrate:create` diffs against that snapshot, and
re-emitted all twelve statements — which abort the boot migration on a database
that already ran them (#566).

The `.json` was generated on the merged tree, so it is the first snapshot
describing both branches; the `.ts` carries no DDL. Proven by a second
`db:migrations:create probe --skip-empty`, which writes no files.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjV4CwJ8LgcSRLcBTNX
sydevs-bot pushed a commit that referenced this pull request Nov 25, 2026
src/migrations/index.ts was the only conflict: both sides appended
migrations, so every entry stays, in timestamp order. main's
20261125_152923_atlas_drop_compact_tab and 20261125_191844_merge_snapshot_heal
sit before this branch's 20261125_191905_merge_snapshot_heal.

That ordering re-armed #566. This branch's heal carries the later timestamp,
and its snapshot still holds both compact columns, so the newest snapshot on
disk described a schema main had already dropped them from and the next
migrate:create re-emitted the two DROP COLUMN statements
20261125_152923_atlas_drop_compact_tab already ships.
20261125_194946_merge_snapshot_heal carries the merged-tree snapshot with
empty DDL; a probe run afterwards wrote no files.

src/payload-types.ts merged clean and is correct on both sides: Lecture.date
is present and no compact key remains.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjYhrByrtm5q9vVrckx
sydevs-bot pushed a commit that referenced this pull request Nov 25, 2026
One conflict, `src/migrations/index.ts`: both sides added migrations, so all
three are kept, ordered by timestamp — `20261124_042718_import_created_regions`,
then main's `20261125_152923_atlas_drop_compact_tab` and
`20261125_191844_merge_snapshot_heal`.

That order leaves this PR's column outside the newest snapshot, because main's
two migrations were generated on a branch that never saw it. The next
`migrate:create` would re-emit `ALTER TABLE "imports" ADD COLUMN
"created_regions"` and abort the boot migration on a database that already ran
it (#566). `20261125_194859_merge_snapshot_heal` is the generated snapshot of
the merged tree with its DDL emptied, as main's own heal migration did a few
hours earlier. A probe `migrate:create` on the merged tree now writes nothing.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjV8Ni4qzPr9kDTZ95a
sydevs-bot pushed a commit that referenced this pull request Nov 25, 2026
One conflict, `src/migrations/index.ts`: both branches appended migrations, so
both lists are kept, in timestamp order.

The merge then made this branch's snapshot heal stale. Main's
`20261125_152923_atlas_drop_compact_tab` carries a timestamp below this
branch's own, so the newest snapshot on disk still described the two atlas
`compact` columns, and `migrate:create` re-emitted their `DROP` — statements
that abort the boot migration on a database that already ran them (#566). So
`20261125_192705_merge_snapshot_heal.json` is regenerated on the merged tree
rather than a third heal stacked on top of it; it still carries no DDL.

Nothing else overlapped: main's change is the atlas translations global, and
`src/payload-types.ts` and `src/globals/AGENTS.md` merged on their own.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjYSZvdxzj7AQgUWcHk
sydevs-bot pushed a commit that referenced this pull request Nov 26, 2026
src/migrations/index.ts was the only conflict: both sides appended
migrations, so every entry stays, in timestamp order. main's
20261125_213000_atlas_common_copied and
20261125_230000_atlas_drop_captcha_blocked sit after this branch's two
20261125_19* heals.

That ordering re-armed #566 in the other direction. Both of main's new
snapshots predate 20261120_235118_lecture_date, so the newest snapshot on
disk described a schema without "lectures"."date" and the next
migrate:create re-emitted the same ADD COLUMN — confirmed by running it.
20261126_035802_merge_snapshot_heal carries the merged-tree snapshot with
empty DDL; a probe run afterwards wrote no files.

Nothing else overlapped. src/payload-types.ts and the admin importMap
merged clean and hold both sides: Lecture.date is present, as are main's
impersonation components. main's InfoBanner change is an opt-in `inline`
prop, which the branch's durationNotice does not pass.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjWhejbJxXgyFysqZqf
sydevs-bot added a commit that referenced this pull request Nov 26, 2026
One conflict, src/migrations/index.ts: both sides only appended. Kept all
three new entries in timestamp order.

main's 20261125_213000 and 20261125_230000 carry later timestamps than this
branch's own heal, so the newest snapshot on disk no longer described
"imports"."created_regions" (#566). Healed again with
20261126_035749_merge_snapshot_heal: its .json was generated on the merged
tree, and its DDL is emptied because 20261124_042718_import_created_regions
already ships the one statement.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjWK4S8phM2CBbS7jvu
sydevs-bot pushed a commit that referenced this pull request Nov 26, 2026
One conflict, in `src/migrations/index.ts`: both sides appended to the chain.
Kept both, in timestamp order — this branch's `20261125_192705_merge_snapshot_heal`,
then `main`'s `20261125_213000_atlas_common_copied` and
`20261125_230000_atlas_drop_captcha_blocked`.

Those two of `main`'s are data-only, so each re-stamps the snapshot that preceded
it there — a schema holding none of this branch's columns, and newest by timestamp
once merged. `migrate:create` then re-emitted the page-tag enums and tables and the
reminder-page column, statements that abort the boot migration on a database that
already ran them (#566). `20261126_035953_merge_snapshot_heal` carries that run's
`.json` and no DDL; the probe after it writes no files.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjUy5NC46GnkmrLnFw1

This branch was successfully deployed

No deployments
sahajcloud / SahajCloud-pr-566 — 611001ce Deployed Jul 12, 2026 by railway-app[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(regions): country slug = ISO alpha-2 code (drop legacyData)

1 participant