Repository navigation
chore(translations): drop the unused event.display.time_in_place atlas key - #1059
Conversation
…s key
The widget no longer renders it: its faded host-clock line sits directly
under "Hosted from %{city}", so the `in %{city}` clause repeated the city
above it, and sydevs/SahajAtlasWeb#351 renders the bare clock instead. The
key was copy in ten locales nothing displayed, and translators were asked
to keep it filled for nothing.
`event.display.hosted_from` stays — it is the only place the widget names
the host city now.
Three assertions in atlas-translations-schema.spec.ts move with the key,
and each fails without this edit: the widget-facing key count, and the
German and Dutch English-value allowlists, where `%{time} in %{city}` was
claimed as a real translation.
Refs #1057
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjZSh9ZSyni4Spnp6Lc
…atlas copy Removing the key from the schema does not remove it from the `event_display` JSON column that held it, and `event.display` declares `additionalProperties: false`. Payload merges a stored value into a field the write never mentions and validates it, so the schema edit alone leaves every save of `sy-atlas-translations` that does not itself replace `event.display` refused — with "The following field is invalid: Event > Display", reported against a tab the editor was not touching. Production stores the key in all ten locales, so the first editor to save any other tab after this deploys would have hit it. The versions table is swept with the main one: a global's update loads the document it is about to change from the `latest: true` version row, so a key left there returns on the next save. Data only, so the `.json` is the prior snapshot re-stamped. `down` restores nothing: rolling the code back puts the key back in the schema, where a locale that does not store it reads as untranslated, and writing values back would mean carrying ten translations this deliberately deleted. `tests/int/atlas-drop-time-in-place.int.spec.ts` asserts the defect first and the sweep second. Emptying `up` was watched to fail the second case with the first's error. Refs #1057 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjZSh9ZSyni4Spnp6Lc
…r review The review pass found three things worth acting on. The `? 'time_in_place'` guard reads as an optimization over twenty rows, and is not one: `jsonb - text` raises `cannot delete from scalar` on a column holding a non-object, which would abort the boot migration. Confirmed against Postgres, and now stated, as 20260909_161353 states the same hazard for its own guard. The spec hand-wrote a structural type for `payload.db`. `drizzle` and `schemaName` are both declared on the augmented `DatabaseAdapter` (@payloadcms/db-postgres types.d.ts), so the cast bought nothing and discarded `transaction`'s real signature. Dropping it also retires the mutable suite-scope `inSchema`, the re-cast of its callback argument, and the hand-quoted schema identifier, which is `sql.identifier`. `up` is called with a named type rather than `as never`, so a future read of `req` fails typecheck instead of at runtime. The seed interpolated its value into a SQL string literal, which an apostrophe in the retired string would have broken inside `beforeAll`. Two statements instead of one carry it as a bound parameter. Rejected: moving the raw seed to `payload.db.updateGlobal`, which takes no locale and reads a localized JSON column's own keys as locale codes — measured, it inserts one row per key and fails on the `_locales` enum. Refs #1057 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjZSh9ZSyni4Spnp6Lc
The guide gave the mirror-image rule for ADDING a key — a `required` one strands a locale that predates it — and said nothing about removing one, so this ticket followed a rule that did not exist. Deleting a key leaves every stored value holding it against an `additionalProperties: false` group, and the global then refuses every save that does not replace that group. Recorded only in the sweep migration's own header, that hazard would have sat in a folder `src/migrations/AGENTS.md` says gets squashed, under a filename naming one key. It is general: `stringsSchema` takes `additionalProperties` from the group, and every leaf group in all three translations globals declares it false. So the rule names both tables to sweep, the guard the delete needs, and the local recovery — a re-seed, since `push: !isProduction` means no local database ever replays the chain and `pnpm db:migrate` on an empty `payload_migrations` replays the whole of it. Also corrects "Versions: max 3" to 10, which is what all three globals have declared since #705. Anyone sizing the versions table reasoned from the wrong number. Refs #1057 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjZSh9ZSyni4Spnp6Lc
|
🚅 Deployed to the SahajCloud-pr-1059 environment in sahajcloud
1 service not affected by this PR
|
sydevs-bot
left a comment
There was a problem hiding this comment.
🧐 Adversarial review
The diff matches #1057 and is honest about widening past it — the sweep serves the same acceptance criterion, not a second change. Within this approach it is the smallest correct version: two guarded UPDATEs folded into their one caller, nothing bespoke extracted.
What the Notes never ask is whether the approach is needed. additionalProperties: false on a jsonb column that holds history makes every future key retirement a migration, across three globals — and this repo already rejected that trade once, in writing. That is the finding worth an answer.
Findings
- should-fix — a per-key migration where relaxing the group would do.
20261101_191500_atlas_drop_time_in_place.ts:32 - should-fix — "deleted in its sync PR" names a PR that will not carry it.
contractSyncfor SahajAtlasWeb syncspayload-types.tsonly, sosrc/config/translations.en.json:127andRETIRING_KEYSattranslations.test.ts:234are nobody's. Name the real follow-up. - consider — comment volume: one story told three times.
20261101_191500_atlas_drop_time_in_place.ts:3 - Manual verification step 2 cannot fail: the body says the preview is unseeded, so no stored key is there to refuse that save.
What was checked
Read whole: the migration, the new spec, translationsField.ts, the schema spec, both AGENTS.md. Ladder: no existing helper for the sweep, and withSchema is justified — region-canonical-url and meditation-duration qualify the table name, which up's unqualified SQL cannot.
Queried: those two tables are the only ones with the column; max: 10 is right; the .json matches its predecessor apart from id/prevId, as two prior data-only pairs do; no time_in_place survives on the branch. Consumer side read in SahajAtlasWeb. Preview answers 200, not signed into — no PREVIEW_ADMIN_EMAIL here.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
The hazard behind the time_in_place sweep was told three times: the migration header, the spec header and the src/globals/AGENTS.md block all carried why additionalProperties: false refuses a later save, why the versions table is swept, and which save escapes it. AGENTS.md is the durable home — the next retirement is found there, not in this migration. So the migration keeps only the load-bearing `?` guard and points at the rule, and the spec keeps only what nothing else owns: its schema isolation, and why it imports a migration's `up`. Comment lines: 32 of 47 in the migration, now 19 of 34. No behaviour change; both cases of atlas-drop-time-in-place.int still pass. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjWnxDCZwKuMFfxJnoD
|
Pushed Adopted — comment volume. One owner each: Rebutted — a per-key migration where relaxing the group would do. A client read returns Body fixed — "'deleted in its sync PR' names a PR that will not carry it": correct. Body fixed — "Manual verification step 2 cannot fail": correct. Step 2 now points at the int spec that reproduces the refusal. Green: lean gate and 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
One conflict: `src/migrations/index.ts`, where #1059 and this branch each added an import. Both kept, in timestamp order. The merge leaves this branch's `20261030_203909_registration_refusals` behind #1059's newer `20261101_191500_atlas_drop_time_in_place`, so the newest snapshot no longer carries the collection and `migrate:create` re-emits every statement of it. `20261102_012821_merge_1052_main_snapshot` keeps that snapshot with no DDL, which heals the chain: replaying the two `task_slug` enum values would abort the boot migration. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjXjBYEEvGDHNLg5Zan
One conflict: `src/migrations/index.ts`, where #1059 and this branch each added an import. Both kept, in timestamp order. The merge leaves this branch's `20261030_203909_registration_refusals` behind #1059's newer `20261101_191500_atlas_drop_time_in_place`, so the newest snapshot no longer carries the collection and `migrate:create` re-emits every statement of it. `20261102_012821_merge_1052_main_snapshot` keeps that snapshot with no DDL, which heals the chain: replaying the two `task_slug` enum values would abort the boot migration. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjXjBYEEvGDHNLg5Zan
Summary
event.display.time_in_placefrom the atlas translations schema, all ten seeds and the generated types.src/globals/AGENTS.mdgains the key-retirement rule — the single home for it, which the migration and the spec now point at rather than restate — and its stale "Versions: max 3" becomes 10.Change outline
The key itself, and everything that named it.
Contract — one key leaves
event.displaysy-atlas-translations › Event › Display src/globals/SahajAtlasTranslations/translationsSchema.json hosted_from "Hosted from %{city}" # unchanged: the only host-city string left - time_in_place "%{time} in %{city}" # nothing has rendered it since SahajAtlasWeb#351 distance_away … SyAtlasTranslationsEventDisplayStrings src/payload-types.ts (generated) - time_in_place?: string seeds/sy-atlas-translations/data.<10 locales>.json - event.display.time_in_placeFlow — why the schema edit alone leaves the global unsaveable
The group declares
additionalProperties: false, and removing a key from the schema does not remove it from thejsonbcolumn that stored it.updateGlobal sy-atlas-translations { countries: { title } } # a write that never mentions event.display merge the stored value into every field the write omits validate event_display against SyAtlasTranslationsEventDisplayStrings - → ValidationError: The following field is invalid: Event > Display + → ok, once the sweep has run # a write that REPLACES event.display validates only what it carries, # which is why the retired key's own tab is the one place that looks fine 20261101_191500_atlas_drop_time_in_place.up src/migrations/ + sy_atlas_translations_locales.event_display - 'time_in_place' + _sy_atlas_translations_v_locales.version_event_display - 'time_in_place' # an update reads latest:true + both guarded by `? 'time_in_place'` # jsonb - text raises on a scalarPreview
The global's field list renders from the config, not from stored content, so this link shows the change on an unseeded preview.
previewUrl.seedis unset for this repo, so nothing was seeded.Contract impact
src/payload-types.tschanged, socontractSyncconsumers re-sync after this merges: sydevs/WeMeditateWeb (server/payload-types.ts) and sydevs/SahajAtlasWeb (src/types/payload/payload-types.ts). The dispatcher opens that bot PR; no issue needed.SahajAtlasWeb also carries this key's English copy in
src/config/translations.en.jsonand aRETIRING_KEYSentry naming #1057 insrc/config/translations.test.ts. ThatcontractSyncPR does not carry either — it regenerates types only. The real follow-up is sydevs/SahajAtlasWeb#354, filed in review here and blocked on #1057 until this deploys, sincepnpm sync:translationsreads the live global. #1057's own Notes say "the sync PR" and name the wrong one.Migration
src/migrations/20261101_191500_atlas_drop_time_in_place.tssy_atlas_translations_locales.event_displayand_sy_atlas_translations_v_locales.version_event_display. Every other key in those columns is preserved; NULL and already-clean rows are skipped. Data only, no DDL, so the.jsonis the prior snapshot re-stamped persrc/migrations/AGENTS.md.downis deliberately empty. Rolling the code back restores the key to the schema, where a locale that does not store it reads as untranslated, which is the state every other unfilled key is already in. Writing values back would mean carrying ten translations this deletes.Test results
.claude/skills/pr-prep/check.sh— lint, format, typecheck, typecheck:tests, 2992 unit tests in 234 filesatlas-drop-time-in-place.int(2, new),translations-globals.int,translations-field.int,globals-client-reads.intThree existing assertions in
tests/unit/atlas-translations-schema.spec.tsmove with the key and each was watched to fail first: the widget-facing key count (259 → 258), and the German and Dutch English-value allowlists, where%{time} in %{city}was claimed as a real translation.Manual verification
Hosted Fromand noTime In Place.tests/int/atlas-drop-time-in-place.int.spec.tsis where it is reproduced against a real Postgres: its first case asserts the refusal, its second the sweep. On a seeded database — a local checkout, or production — saving any other tab of the global (Countries will do) is the write the sweep exists for.pnpm db:migrate. Noted insrc/globals/AGENTS.md.Notes for reviewer
time_in_placefield, in any locale") rather than a follow-up. The title is still the ticket's.stringsSchemasetsadditionalPropertiesfrom the group, and every leaf group in all three translations globals declares itfalse— andcollectLeafLookupsalready yields the declared key set a generic reconciler would need. It is not built here: a prune-on-save would silently delete copy an editor typed, which is exactly what feat(translations): rewrite the Sahaj Atlas schema by widget view, seed all ten locales, and gate availableLocales on them #706's migration went to length to avoid, andemailsandevent.titlehold the only real editor copy in these globals. Each future retirement costs one.ts/.jsonpair, and the rule is now written down.additionalProperties: trueonevent.displaywould make the stored key saveable, but a client read serves the column verbatim —mergeEnglishonly fills gaps, it never strips — so the widget would keep receivingtime_in_placein ten locales, which is the criterion chore(translations): drop the unused event.display.time_in_place atlas key #1057 names. It is also per-group, not per-key (translationsField.ts:305), and nothing pins stored content:atlas-translations-schema.spec.ts:221pins the seeds. feat(translations): rewrite the Sahaj Atlas schema by widget view, seed all ten locales, and gate availableLocales on them #706's20260909_161353_atlas_translations_by_viewswept these same two tables for this same reason.up. The established shape is the opposite:region-breadcrumb-url-backfillandschedule-last-date-backfillexercise a routine kept insrc/lib/. Two unqualified SQL statements have no such routine to extract.upruns verbatim inside one transaction withSET LOCAL search_path, because this lane gives each suite its own Postgres schema; the spec's header carries that reasoning._meta.schema_versionin the ten seeds was left atpost-#1023. Both facts it states — 13 tabs, 43 leaf groups — are still true, so bumping it across ten files would be churn for a label.payload.db.updateGlobal. Measured — it takes no locale and reads a localized JSON column's own keys as locale codes, inserting one row per key until the_localesenum rejects it.schemaNamefromcreateTestEnvironmentto retire the samepayload.dbcast in three other specs. A real cleanup, but it touches specs this ticket does not, and the cast turned out to be unnecessary here anyway —drizzleandschemaNameare already on the augmentedDatabaseAdapter.Detail
How the defect was established, rather than inferred.
src/globals/AGENTS.mdsays Payload validates a stored column on every save of its document, which suggested the hazard. It was then reproduced three ways: the emitted schema refuses{hosted_from, time_in_place}withdata must NOT have additional properties; the twoUPDATEs were run against a real Postgres with NULL, clean and affected rows, preservinghosted_fromin all three; and the integration spec reproduces the end-to-endValidationErroron a realupdateGlobal.The first version of that spec asserted the wrong save. A write that replaces
event.displayvalidates only what it carries, so it passed with the key still stored. Saving another tab is the shape that fails, and the spec says so where a later reader will trip on it.Emptying
upwas watched to fail, twice — once before and once after the spec was rewritten — each time withValidationError: The following field is invalid: Event > Display > Display, the same error the first case asserts.jsonb - texton a scalar raisescannot delete from scalar, confirmed against Postgres directly. That makes the? '<key>'guard load-bearing rather than an optimization over twenty rows: without it, one locale holding a non-objectevent_displaywould abort the boot migration and crash-loop the deploy. The migration's header says so, because the obvious simplification is to delete the guard.Row counts. 19 configured locales and
versions.max: 10, so the sweep touches at most ~19 live rows and ~190 version rows. Two sequential scans, row locks only, no DDL.Not reached, deliberately. A client read of this global is edge-cached for 600s and purged on write; raw SQL purges nothing, so a cached payload can carry the retired key for up to ten minutes after the deploy. Consumers ignore unknown keys, and #706 behaved identically.
Where the hazard's story lives, after review. One owner each:
src/globals/AGENTS.mdcarries the rule a future retirement needs, the migration keeps only its load-bearing?guard, and the spec keeps only its Postgres-schema isolation and why it importsup. The migration was 32 comment lines of 47, now 19 of 34.Closes #1057
Generated by Claude Code