Repository navigation
fix(driver-sql): an upgraded MySQL 8 database retires the narrower key beside the functional package-less guard - #33514
Conversation
…ening arm's partial guard Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cw787kMeaX7oyz7DDC
…cs, the pending note and the guard's docblock; add the changeset Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cw787kMeaX7oyz7DDC
📓 Docs Drift CheckThis PR changes 2 package(s): 1 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
What this run could not see
Coarse fallback — 23 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 1fa940632925d9f181fe7a4f6f97fab360908465 && git checkout 1fa940632925d9f181fe7a4f6f97fab360908465
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin e40cd1e28dd79e60e7f4be0db06f071f3f962574 d0f178767ffcb2bb92ca0671c478992405dee602 && git checkout -B drift-repro e40cd1e28dd79e60e7f4be0db06f071f3f962574 && git merge --no-ff d0f178767ffcb2bb92ca0671c478992405dee602
node scripts/docs-audit/affected-docs.mjs --json e40cd1e28dd79e60e7f4be0db06f071f3f962574
|
|
Contract-review-claim: session_016WV4cxDxAYxdtDhtR1kQQe · head d0f1787 · 2026-11-14T23:54:35Z |
Review: PASSreview#2 (server area pilot) · area A4 · Fixes #33201 (p2) · head CI on this head: 38 success, 17 skipped. The only red is What was checked (read-only: the diff, the card, the PR body, and the three guard builders in
Semver: DELIBERATE CORRECTION, confirmed sentence by sentence (the at-tier record that
I searched for any other statement of the old limit in the pending Nits: none. Final round. Per Generated by Claude Code |
|
domain:server#5 · os-elon-musk · session_016WV4cw787kMeaX7oyz7DDC ACCEPT · area A4 · head d0f1787 · 2026-11-14T23:57Z
|
Requested by Elon · project thread
Fixes #33201
Clause-②: no
Metadata-protocol: none
维护者速读
driver-sql的扩键迁移现在能认出 MySQL 8 上平台自建的「无包守卫」(函数式键部件 + 驱动自己的哈希摘要),把它当作部分唯一索引,于是升级过的 MySQL 库会像 PostgreSQL 一样把旧的窄唯一键安全替换掉。packages/drivers/driver-sql/src/schema-drift.ts(parseFunctionalRowScopedGuard与hasPartialUniqueGuard新分支,风险最高);packages/drivers/driver-sql/src/sql-driver-column-creation.ts(摘要构造器抽出,须逐字节不变);packages/drivers/driver-sql/src/sql-driver-widened-declared-unique.test.ts(严格性反例)。pnpm --filter @objectstack/driver-sql exec vitest run src/sql-driver-widened-declared-unique.test.ts,预期纯函数段「a functional row-scoped digest (MySQL 8 package-less guard)」全绿;CI 的Temporal Conformance (live PG + MySQL)中三个 MySQL 单元为 replace。.changeset/31699-connection-key-package.md的 DELIBERATE CORRECTION 确认)。What changes
driver-sql(schema-drift.ts): new pureparseFunctionalRowScopedGuard(expression)reads MySQL 8's stored spelling ofmetadata-protocol's package-less guard,(case when (SCOPE is null) then DIGEST end), as a partial unique on the digest's columns scoped by SCOPE.hasPartialUniqueGuardaccepts such an index (only key part, unique, no WHERE, no shadow carrier) when its columns are exactly the narrower key's, in key order, and its scope is the one nullable column the wider key gained. So the widening arm plans the same safereplace_unique_indexit plans on PostgreSQL.hashShadowDigestSql(columns)builds. That builder is the onecreateHashShadowUniqueIndexalready used (extracted, byte-identical output), and it is the digest the three migrations key ("the driver's own hash-shadow digest"). Another function, hash, width, separator, scope, anELSE, a NULL-safe part, a scope that is a key column or not the gained column, a second key part, a non-unique index, or two nullable gained columns: not a guard, the narrower key stays kept.sql-driver-widened-connection-key.test.tsflips from the declared limit to the replace (same assertions as the PG cell);sql-driver-widened-declared-unique.test.ts(activation ledger) andsql-driver-widened-grant-key.test.ts(grant) gain pure pins over the measured MySQL expression plus a live MySQL 8 cell each (MariaDB skips them; the MariaDB cell is untouched).content/docs/deployment/cli.mdx("Runtime-owned indexes apply builds") drops the MySQL limit; the guard docblock inmetadata-protocol'sconnector-connection-packageless-index.tssays the driver reads the form (comment only).driver-sqlpatch, FROM kept TO retired.DELIBERATE CORRECTION
.changeset/31699-connection-key-package.mdis a pending (unreleased) note whose MySQL 8 bullet this PR makes false. Corrected sentence (the rest of the note unchanged):check-empty-changesetis red on this file by design; the dispatching seat confirms by its record.Tests
Live MySQL 8.0.46 (local server; CI's
Temporal Conformance (live PG + MySQL)uses the officialmysql:8.0image), at headd0f178767f(merge of origin/main overb3e78bb48a):OS_TEST_MYSQL_URLset:Test Files 3 passed (3),Tests 60 passed | 2 skipped (62). The two skips are the PostgreSQL cell of the connection-key suite (no PG URL locally) and the MariaDB cell of the activation-ledger suite (the server is MySQL). All three MySQL cells ran and passed: connection key (flipped from the declared limit), grant key and activation ledger (new). Each live cell also asserts the storedSTATISTICS.EXPRESSIONtext the pure pins read.pnpm --filter @objectstack/driver-sql typecheck: exit 0 (lock VERDICT command-exit 0).pnpm --filter @objectstack/driver-sql testwith live MySQL, atb3e78bb48a:Tests 3 failed | 5332 passed | 141 skipped. All failures are live-MySQL environment cells outside this diff: four temporal / window cells need the skewed process zone CI sets (re-run withTZ=America/New_York: green), andsql-driver-11565-row-byte-budget(an InnoDB page-limit refusal on CREATE TABLE) does not fire on the locally packaged server. None reads index introspection or the widening arm. CI's live job is the reading of record for those cells.--no-inline-config) on the six changed source files: exit 0.Ablation (one-shot, restored; readings only)
All via
scripts/ablation-replace.mjson committedb01a23c36f(tests importsrc, so no build leg; the tool restored each time, blob == HEAD,git diff HEADempty):functionalRowScopedGuardOf(p)replaced bynull): 5 red across the three suites, the 2 pure "counts as the guard" pins and all 3 live MySQL cells (the plan is no longer the replace). This is also the premise re-measure: without the recognition, the upgraded MySQL database keeps the old key.Acceptance notes
packages/metadata-protocol/src/migrations/connector-connection-packageless-index.tsand the pending changeset correction above; both are sentences this diff made false.(case when (+ backquoted scope +is null) then unhex(sha2(concat(+ backquoted columns joined by,0x1f,+),256)) end)for all three tables; the live cells assert the stored text.Temporal Conformance (live PG + MySQL)job runs the wholedriver-sqlsuite against live PG and MySQL 8.0, but only on push tomainand on schedule, not onpull_requestormerge_group. On PR heads the live MySQL and PG cells are measured only by the local runs above.Verification
Derived gate families (dispatch-gates --commands, --ran reconciled)
At
b3e78bb48a: 98 derived, 95 run, 3 NOT MEASURED (check:dual-build-cjs-loads,check:lean-entry-closure,check:type-check-debt: exit 3, PREREQUISITE NOT MET, they need the whole workspace built; CI'sLint & Repo Gatesruns them). Red:check-empty-changeset --base origin/mainexit 1, the DELIBERATE CORRECTION above, red by design. Four doc gates first exited 3 and were re-run green after building@objectstack/lintand@objectstack/client-react. All other families exit 0. Re-derived and re-run ond0f178767f: see the os-dev-report comment on the card.Post-merge scoped re-check (packages/spec moved upstream):
@objectstack/spec check:generatedreportedcheck:test-typecheckred with "tsc failed without diagnostics" under the default heap;check:test-typecheckre-run underNODE_OPTIONS=--max-old-space-size=4096exit 0 (this diff does not touchpackages/spec).🤖 Generated with Claude Code
https://claude.ai/code/session_016WV4cw787kMeaX7oyz7DDC