Skip to content

refactor(migrations): settle one home for the English-key backfill SQL - #1245

Merged
sydevs-bot merged 12 commits into
mainfrom
claude/refactor-1242-english-key-backfill
Nov 22, 2026
Merged

sydevs-bot merged 12 commits into
mainfrom
claude/refactor-1242-english-key-backfill

Conversation

@sydevs-bot

@sydevs-bot sydevs-bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • addEnglishKey / dropEnglishKey move to src/lib/migrations/englishKeyBackfill.ts, parameterised by the global's table base so all three translations globals can use them.
  • From review: src/lib/migrations/ is a new folder, and the one a file in src/migrations/ may import from. The one-consumer rule gains a third exemption for it, which retires the lib-boundary trap this body used to flag.
  • Both guards are jsonb_typeof(col) = 'object', which is what two of the three copies already do. 20261118_231500 is the one that drifted to ? '<key>' alone, and src/globals/AGENTS.md told that story too — the doc is corrected here, the frozen migration is not.
  • Joined: withSchema returns its body's value, so a case can read results back through the seam it writes through. It had no caller at all before this.
  • Joined, from review: the two int specs that hand-rolled their own schema qualifier now go through withSchema, and tests/AGENTS.md names it as the lane's one seam for raw SQL.
  • From review (option A): group is one column name, and the module derives version_<group> beside the versions table it already derives. A mis-paired group is no longer expressible.
  • origin/main merged in. refactor(translations): no global declares a screen-reader-only string #1246 deletes every a11y leaf group from wm-web-translations, which the spec seeded, so the spec moves to common.general.

Change outline

The one rule the three hand copies each spell for themselves, now spelled once. table is the global's table base and group is the main locales table's column; the three table names and the versions column come off them.

Files

 src/lib/migrations/                                  # new folder — the only one src/migrations/ imports from
+└── englishKeyBackfill.ts   # addEnglishKey / dropEnglishKey: the jsonb writes, for any of the three globals
 src/lib/translations/                                # unchanged — five runtime readers of the same globals
 ├── clientEnglishFallback.ts
 └── schemaWalker.ts
 src/migrations/
 ├── 20261118_210000_wm_web_new_tab_one_key.ts        # unchanged — carries both guards
 ├── 20261118_231500_wm_web_a11y_landmark_keys.ts     # unchanged — the drifted copy, `?` alone
 ├── 20261118_233000_wm_web_menu_key.ts               # unchanged — carries both guards
~└── AGENTS.md                                        # what a migration may import
~src/AGENTS.md                                        # the folder, and the third exemption
 tests/
 ├── int/english-key-backfill.int.spec.ts             # new — both guards, both tables
~├── int/event-calendar-feed.int.spec.ts              # drops its own `"<schema>"."events"` + sql.raw
~├── int/region-canonical-url.int.spec.ts             # drops its `payload.db as unknown as { pool }` cast
~├── unit/lib-boundary.spec.ts                        # the third exemption
~├── utils/withSchema.ts                              # returns the body's value
~└── AGENTS.md                                        # the raw-SQL seam, named

Behaviour — the two guards, and what each refuses

Byte-identical SQL to 20261118_210000 and 20261118_233000, which carry jsonb_typeof on both paths already. What changes is that one statement now covers every global. The - line below is 20261118_231500 alone.

 addEnglishKey(db, { table, group, key, en })
   for each of <base>_locales.<group> (every row) and _<base>_v_locales.version_<group> (latest only)
     UPDATE … SET col = coalesce(col,'{}') || jsonb_build_object(key, en)
       WHERE _locale = 'en'
         AND jsonb_typeof(coalesce(col,'{}')) = 'object'   # `||` on a scalar builds an array
         AND NOT coalesce(col,'{}') ? key                  # never overwrite a chosen word

 dropEnglishKey(db, { table, group, key })
   for each of the same two columns (every locale, every version)
     UPDATE … SET col = col - key
-      WHERE col ? key                                     # 20261118_231500's guard, and it is wrong
+      WHERE jsonb_typeof(col) = 'object'                  # `-` on a scalar raises; on an array it edits
         AND col ? key                                     # the rows to rewrite, not the whole table

Contract — the paragraph the next copy is read from

src/globals/AGENTS.md, "Retiring a key needs a data migration". It was the only doc stating the guard, and it stated the one that does not work.

-Guard the delete with `? '<key>'`: `jsonb - text` raises `cannot delete from scalar`.
+Guard the delete with `jsonb_typeof(<col>) = 'object'`: `-` raises on a scalar, and edits an array.
+`? '<key>'` does not stand in for it — true for a string scalar equal to the key, true for an array holding one.
+`20261118_231500`'s `dropKey` guards on `?` alone, so a `migrate:down` through it can abort.
+Copy the helper, not the nearest predecessor.

Preview

No preview surface — the diff touches none of fixture.surfacePaths.

Test results

  • Lean gate: ✓ .claude/skills/pr-prep/check.sh — lint, format, typecheck (src), typecheck (tests), 3852 unit tests in 286 files, 134 s on the final tree
  • Targeted specs: 54 passed — english-key-backfill (7), event-calendar-feed (22), region-canonical-url (25)
  • tests/unit/lib-boundary.spec.ts: ✓, with no KNOWN_SINGLE_CONSUMER entry. The new exemption was watched in all three directions — it passes with a lone src/migrations/ consumer, the rule still fails without it, and a lone consumer elsewhere still fails
  • Contract step: timeout 300 pnpm db:migrations:create probe --skip-empty < /dev/null → exit 0, no files written. Nothing here changes the schema
  • Build: N/A (Railway builds the preview)

Each guard was removed in turn and watched fail, before the fix was restored. First on common.a11y, then again on common.general after the merge moved the fixture:

Guard removed What the spec saw
write path the group became an array, both shapes — 2 cases
delete path cannot delete from scalar on the string scalar; [] on the array, silently — 2 cases
version_ prefix all 7 cases

Each adopted spec's raw write was neutralised the same way, because a setup that silently does nothing leaves its case asserting nothing:

Write neutralised What failed
make_interval(days => 0) both a class taken down cases — the 90-day window and the republish
WHERE id = <nobody> refuses a verified host that is not a bare host

Fixture: the spec uses common.general on wm-web-translations, which stores as common_general / version_common_general, and the declared keys loading and show_more — so its seed is a write additionalProperties: false accepts. It started on common.a11y, which #1246 deletes; the three table names and the versions column are spelled out rather than re-derived, so the spec pins what the module's derivation has to produce.

Manual verification

Nothing. The module has no caller yet, so no running surface changes.

Notes for reviewer

  • The folder is the signal, and the exemption is what makes it one. src/lib/migrations/ on its own would be a naming convention; lib-boundary exempting it is what the next migration's import line actually buys. Without it that PR would need a KNOWN_SINGLE_CONSUMER entry — a list the spec says should only shrink.
  • The latestOnly fragment is built for both targets, and dropEnglishKey interpolates neither. Same shape as the latestOnly: true field it replaced, so no new trap, but worth a look.
  • The question thread is answered A, built in 881c4a7. Criterion 1 on refactor(migrations): settle one home for the English-key backfill SQL #1242 is updated to the derived form.
Detail — review findings dismissed, and what was left out

Four /simplify lenses plus /code-review high, then the adversarial review. pr-review-toolkit is not available to a routine. Security review skipped: no securityReview.triggerPattern path in the diff. comment-lint.mjs: clean.

Dismissed:

  • Share Executor with the identical unexported type in src/lib/atomicWrites/appendLogEntry.ts. Sharing means either exporting a two-line type out of a folder its own guide closes ("no barrel"), or a new src/lib folder for two lines. This one is Pick<MigrateUpArgs['db'], 'execute'>, derived from Payload's type rather than hand-written, so it tracks a Payload bump; the other does not.
  • Add a shared helper for Payload's table-naming rule. The other derivation (appendLogEntry) is a collection with a version array, not a global with a locales table. Two unlike callers is not a shared rule yet.
  • Land this with its first caller instead of caller-less. That is option B's neighbour, settled on the ticket as A.
  • Collapse the four coalesce(col,'{}') occurrences into a local. All four are load-bearing and it is the one deliberate fidelity to the shipped copies.
  • Drop AND col ? key from dropEnglishKey, since jsonb_typeof already excludes every shape that raises. It is the row filter, not a guard: without it every call rewrites every row of _<base>_v_locales, one new tuple and its WAL each, in a boot migration, growing with version history. Both non-drifted copies carry the pair.

Adopted from the adversarial review: the two specs above (reversing an earlier dismissal of exactly that — the seam is built here, so it is not a follow-up), and two comment streamlines, the module header and the src/globals/AGENTS.md paragraph, each cut to the fact a reader cannot re-derive.

Corrected after review, worth naming because both were mine: the spec's guard comment was inverted for the delete path (col ? key reaches the row only when the value does hold the key, so a non-matching key there would have left jsonb_typeof dead weight — checked both directions); and the doc claimed 20261118_231500 can never run again, when only its up is spent and migrate:down still reaches its dropKey.

Measurements. The version_<main> naming option A holds for every leaf column in all three globals, with no exception in either direction. Counted on the merged base's newest snapshot, 20261121_035100_atlas_drop_a11y_keys.json, over jsonb columns alone: 13 + 43 + 50, each with its version_ pair, none unpaired. #1246 took wm_web_translations from 23 to 13. Counting jsonb excludes version__status, the per-locale publish flag, which is an enum — the earlier 119 counted it as a leaf group. 20261121_035100_atlas_drop_a11y_keys.ts, which arrived with the merge, spells the same derivation as prefix: 'version_'. The spec costs ~6 s, of which ~2 s is createTestEnvironment().

Closes #1242

Three migrations on main carry a byte-for-byte hand copy of this jsonb
machinery, and the copies drifted. One documented `? key` as the clause
that keeps a non-object out of the delete, which is false: measured
against Postgres, `? key` is true for a string scalar equal to the key
and true for an array holding it, so only `jsonb_typeof(col) = 'object'`
excludes both shapes.

The helper parameterises the global's table base as well as the leaf
group, since the carve-out holds for all three translations globals. It
lands with no caller: the migrations already on main hold their
`payload_migrations` row and never re-run, so rewriting them changes
nothing a database will see. The first caller is the next such
migration.

The spec is an integration spec because both guards are Postgres
semantics rather than SQL text. Each guard was removed in turn and
watched fail: without the write guard `||` turns the group into
`["menu", {...}]`, and without the delete guard a scalar raises
`cannot delete from scalar` while an array silently loses its element.

Refs: #1242

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjVzAsZh9fkbzqHumf5
This paragraph is the one doc that states the guard, so it is where the
next hand-written copy is read from — and it stated the clause that does
not work. `? '<key>'` is true for a string scalar equal to the key and
for an array holding one, so it excludes neither shape the delete has to
refuse.

Refs: #1242

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjVzAsZh9fkbzqHumf5
Review pass over the branch.

The boolean that chose between one SQL fragment and an empty one travelled
through a type field, a literal and a four-line helper. Putting the
fragment in the target literal deletes all three and puts both `_<base>_v`
spellings next to each other, where they can no longer disagree.

`withSchema` now returns its body's value, so the spec reads its results
back through the same seam the code under test writes through. That drops a
hand-rolled schema qualifier and a copy of withSchema's own guard message.
The spec also spells the three table names out instead of re-deriving them
from the base: they are what the module's derivation has to produce, so
deriving them twice would let both sides be wrong together.

The `? key` rebuttal now lives once, in `src/globals/AGENTS.md`, with each
function keeping only its own consequence. That paragraph also names
`20261118_231500` as still carrying the wrong guard, because a reader
copying the nearest predecessor arrives from the migration, not the prose.

Refs: #1242

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjVzAsZh9fkbzqHumf5
The spec's guard comment said each case picks a key the stored value does
not equal. That is true of the write path and inverted for the delete one:
`col ? key` reaches the row only when the value DOES hold the key, so a
non-matching key there would leave `jsonb_typeof` dead weight and the case
would pass with the guard removed. Checked both directions.

And `20261118_231500` is not unrunnable, only un-scheduled: its `up` is
applied everywhere it will ever run, but `migrate:down` still reaches its
`dropKey`.

Refs: #1242

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

railway-app Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

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

Service Status Web Updated
SahajCloud 😴 Sleeping (View Logs) Web Nov 22, 2026 at 7:10 pm UTC
1 service not affected by this PR
  • mailpit

@sydevs-bot sydevs-bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 question for the reviewer, one per thread.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@sydevs-bot

sydevs-bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 no session running

recent dispatches
  • 18:36Z address-review · attempt 1 · session · done
  • 18:36Z address-review · attempt 1 · session
  • 18:23Z address-review · attempt 1 · session · done
  • 18:23Z address-review · attempt 1 · session
  • 03:23Z address-review · attempt 1 · session · done

Written by the sydevs dispatcher. Sessions never edit this comment.

@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 21, 2026
@sydevs-bot sydevs-bot moved this from Pending to Working in SYDevelopers Technical Roadmap Nov 21, 2026

@sydevs-bot sydevs-bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧐 Adversarial review

The diff is no bigger than #1242: one 83-line module, its spec, and the doc line criterion 5 names. The three migrations are byte-identical to main, and the SQL matches 20261118_210000 clause for clause on both paths. Landing caller-less is decision A, recorded before you typed implement.

Two for you. src/AGENTS.md rule 3 says src/lib/ holds only code shared across 2+ consumers; this module has zero, and lib-boundary.spec.ts passes it only because its predicate is !== 1. Either the rule gains a line or the spec a KNOWN entry. Second, the ## Change outline shows jsonb_typeof on the delete path as an addition, but two of the three copies already carry it — only the drifted 231500 does not. Outline-first, that reads as a tightened guard rather than the majority copy adopted.

Findings

  • should-fix — tests/utils/withSchema.ts:18 — this diff makes it the int lane's raw-SQL seam; two specs still hand-roll it.
  • should-fix — src/globals/AGENTS.md:314 — five new doc lines narrate one frozen file the sentence below already covers.
  • should-fix — src/lib/translations/englishKeyBackfill.ts:81 — Streamline: AND col ? key guards nothing past jsonb_typeof.
  • consider — src/lib/translations/englishKeyBackfill.ts:7 — Streamline: the header re-derives src/migrations/AGENTS.md's fact.

What was checked

Ticket #1242 and its comments; the whole diff; englishKeyBackfill.ts, withSchema.ts, the spec, lib-boundary.spec.ts, src/AGENTS.md and the three migrations read whole. Every path the body names exists on the branch. No ## Preview link, and fixture.surfacePaths is untouched. No contractSync source in the diff. version_<main> holds for 119 leaf columns in the snapshot, not the 116 the thread says. Streamliner: 6 pieces, 6 kept, 2 findings, 1 sketch dropped.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

Comment thread tests/utils/withSchema.ts Resolved
Comment thread src/globals/AGENTS.md Resolved
@sydevs-bot sydevs-bot added bot:working Lock: a cloud session is running on this item. Removed when it ends. and removed bot:working Lock: a cloud session is running on this item. Removed when it ends. labels Nov 21, 2026
The ⚠ re-derived why a named migration never re-runs, which
`src/migrations/AGENTS.md` § "The failure this design prevents" already owns. A
second home for that fact is a second thing to keep true. The instruction, the
⚠ and the #1242 breadcrumb stay.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjZAgjYYrBqVPHXsmsU
Five lines narrated why 20261118_231500 is left as it deployed. That its `up`
is spent belongs to `src/migrations/AGENTS.md`, and the instruction below
already says to copy the helper rather than any predecessor. What a reader
cannot re-derive is that its `down` guards on `?` alone, so a `migrate:down`
through it can abort. That stays.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjZAgjYYrBqVPHXsmsU
Both specs qualified a table themselves, one by building `"<schema>"."events"`
for `sql.raw` with the interval and the id interpolated, the other by casting
`payload.db` to reach `pool.query`. The seam that answers both is now generic,
so neither needs its own copy of the search_path rule, and both statements
become parameterised.

Each write was neutralised in turn and watched fail — the 0-day interval
dropped both `a class taken down` cases, and an id nobody holds dropped the
non-bare-host refusal. Neither case passes with its setup gone.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjZAgjYYrBqVPHXsmsU
Three specs reach it now and no guide mentioned it, so the next spec writing
raw SQL would hand-roll a qualifier again — which is what both specs adopted in
this branch had done. The gotcha a reader cannot derive is that getting it
wrong is silent: the statement reads `public`, finds no tables, and the case
passes having changed nothing.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjZAgjYYrBqVPHXsmsU
@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-1245 November 21, 2026 03:33 Destroyed
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

Three threads adopted, one rebutted. One still waits on you.

Adopted

Rebutted

  • drop AND col ? key — it is the row filter, not a guard. Without it every dropEnglishKey rewrites every row of _<base>_v_locales, growing with version history.

From the review body. The ## Change outline is corrected: 20261118_210000 and 20261118_233000 already carry jsonb_typeof on both paths, and only the drifted 231500 does not.

The question thread is unchanged, B built.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@sydevs-bot sydevs-bot removed the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 21, 2026
@sydevs-bot sydevs-bot moved this from Working to Pending in SYDevelopers Technical Roadmap Nov 21, 2026
@sydevs-bot
sydevs-bot marked this pull request as ready for review November 21, 2026 03:50
@sydevs-bot
sydevs-bot requested a review from Ardnived November 21, 2026 03:50
@sydevs-bot
sydevs-bot enabled auto-merge November 21, 2026 03:50
@sydevs-bot sydevs-bot moved this from Pending to Awaiting in SYDevelopers Technical Roadmap Nov 21, 2026
@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 22, 2026
@sydevs-bot sydevs-bot moved this from Awaiting to Working in SYDevelopers Technical Roadmap Nov 22, 2026
Merging origin/main brought #1246, which deletes every a11y leaf group from
wm-web-translations. The spec seeded common.a11y, so its three table reads
hit a column that no longer exists and all seven cases failed on the merged
tree. common.general is the live sibling, and loading / show_more are both
declared, so the seed stays a write additionalProperties: false accepts.

Both guards were neutralised again on the new group and watched fail: the
write path lost two cases, the delete path two.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjWSq14etEawvvxGuCV
Option A, answered on the question thread. `group` is one column name, and
`targets` builds `version_${group}` beside the `_${table}_v_locales` it
already derives, so a mis-paired group stops being expressible: a copy-paste
from another group previously wrote the key into a different leaf group,
Postgres raised nothing, and the stored undeclared key then refused every
later save of the global.

The rule holds for every leaf column in all three globals on the merged base
— 13 + 43 + 50 jsonb columns, each with its version_ pair, none unpaired in
either direction. 20261121_035100_atlas_drop_a11y_keys, which arrived with
the merge, spells the same derivation as `prefix: 'version_'`.

Dropping the prefix from the derivation fails all seven spec cases.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjWSq14etEawvvxGuCV
@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-1245 November 22, 2026 18:32 Destroyed
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

Option A built. One thread, now resolved.

Adopted

  • the LeafGroup question thread — 881c4a7. group is one column name, and targets derives version_${group}. Dropping the prefix fails all seven spec cases.

Criterion 1 on #1242 now reads the derived form, marked (review, Ardnived, 2026-11-22).

Base merged clean, with one consequence. #1246 deletes every a11y leaf group from wm-web-translations, which this spec seeded, so all seven cases failed on the merged tree. 553e86a repoints them at common.general, keys loading and show_more. Both guards were neutralised again there and watched fail.

Re-measured on the merged base: version_<main> holds for every leaf jsonb column in all three globals, 13 + 43 + 50, none unpaired. The migration the merge brought spells the same rule as prefix: 'version_'.

Lean gate ✓, 3852 unit tests. Int specs 7 + 22 + 25. Contract step exit 0, no files.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@sydevs-bot sydevs-bot added bot:working Lock: a cloud session is running on this item. Removed when it ends. and removed bot:working Lock: a cloud session is running on this item. Removed when it ends. labels Nov 22, 2026
`src/lib/translations/` held the English-key backfill SQL next to five
runtime readers of the same globals, so nothing in the tree said which
code a hand-written data migration may reach. `src/lib/migrations/` is
that signal, and it is the only folder a file in `src/migrations/`
imports from.

The one-consumer rule gains a third exemption for it. A migration is
frozen the moment it merges, so "move it beside its consumer" has no
answer here: the consumer is do-not-augment generated output, and the
second consumer is a migration nobody has written yet. That retires the
`lib-boundary` trap this PR's notes flagged for whichever PR adds the
first caller.

Verified in all three directions: the exemption passes with a lone
`src/migrations/` consumer, the rule still fails without it, and a lone
consumer outside `src/migrations/` still fails.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjZe5FjS67YwRqMvS6A
@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-1245 November 22, 2026 18:45 Destroyed
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

One thread adopted, now resolved.

Adopted

src/migrations/helpers/ was the other candidate. .claude/workflow.json marks every src/migrations/*.ts do-not-augment generated output, so a helper there inherits the wrong rule.

lib-boundary gains a third exemption, for a src/lib/migrations/ module whose only consumer is a migration. A migration is frozen on merge, so "move it beside its consumer" has no answer and the count only grows. That retires the trap this PR flagged for the first caller — no KNOWN_SINGLE_CONSUMER entry.

Watched in all three directions: the exemption passes with a lone src/migrations/ consumer, the rule still fails without it, and a lone consumer elsewhere still fails.

Base already current. Lean gate ✓, 3852 unit tests. Int spec 7.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@sydevs-bot sydevs-bot removed the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 22, 2026
@sydevs-bot sydevs-bot moved this from Working to Awaiting in SYDevelopers Technical Roadmap Nov 22, 2026
@sydevs-bot
sydevs-bot added this pull request to the merge queue Nov 22, 2026
@sydevs-bot sydevs-bot moved this from Awaiting to Pending in SYDevelopers Technical Roadmap Nov 22, 2026
Merged via the queue into main with commit acecb9e Nov 22, 2026
38 of 39 checks passed
@sydevs-bot
sydevs-bot deleted the claude/refactor-1242-english-key-backfill branch November 22, 2026 20:32
@sydevs-bot sydevs-bot moved this from Pending to Done in SYDevelopers Technical Roadmap Nov 22, 2026
sydevs-bot pushed a commit that referenced this pull request Nov 23, 2026
`down` guarded each delete on `? key` alone. That is true for a string scalar
equal to the key and for an array holding one, so neither shape is excluded —
and `-` on a scalar raises `cannot delete from scalar`, which aborts the boot
migration rather than failing one statement. The file's own comment claimed the
opposite.

#1245 settled one home for this SQL, with both guards, and
`tests/int/english-key-backfill.int.spec.ts` exercises them against Postgres
rather than against the generated statement. This migration is unmerged, so it
can be that module's first caller instead of a fourth hand copy; the ones
already on `main` keep theirs, since a name with a `payload_migrations` row
never runs again.

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

This branch was successfully deployed

No deployments
sahajcloud / SahajCloud-pr-1245 — 8306b2c0 Deployed Nov 22, 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

Development

Successfully merging this pull request may close these issues.

refactor(migrations): settle one home for the English-key backfill SQL

3 participants