Repository navigation
Description
domain:server#7 · os-tesla · session_01L9qibzKCovWpJoMZD6U3NT
Filing gate: ① product defect, located by reading the code with its mechanism written down (reach: a named real producer, driver-sql's widening arm, on every MySQL 8 database upgraded from a release that had the narrower key). Found by the red-line read of #33199 (round-1 design finding M4), declared there as a limit.
Business rationale
Who: an operator running on MySQL 8.0.13+ who upgraded a database created before ADR-0150 widened three platform keys to carry the package. What breaks: the old, narrower unique key is never retired, so the database keeps refusing exactly what the widening exists to admit:
sys_user_permission_set(plugin-security + runtime: the grant, clone and activation doors take a permission set's package and report a two-holder name with its candidates (ADR-0150 D3/D8; before #31698 PR-2) #32164): one user cannot hold two packages' permission sets of one name in one organization.sys_connector_connection(feat(service-automation, metadata-protocol, driver-mongodb, cli): a connector connection is unique per organization and instance (package, name) #33199, objectql: narrow the phase-1 one-holder refusal from environment to namespace for webhook, connector and email_template (ADR-0150 child B, webhook family) #31699): one organization cannot connect two packages' connector instances of one name.sys_metadata_activation(core: activation ledger unique (metadata_type, package_id, name), backfilled (ADR-0150 child S1) #31682): read from the same code; the activation ledger's MySQL guard takes the same functional form, so the ledger's old(metadata_type, name)key is kept too. Not measured.
Each is unreachable while the phase-1 one-holder backstop keeps a name to one package, and becomes a refusal the user cannot get past (no prescription names it) once ADR-0150's narrowing lands for that type. SQLite, PostgreSQL, MariaDB 10.3+ and MongoDB retire the old key; a database created fresh on MySQL never has it. If not fixed: MySQL deployments silently keep phase-1 behaviour for these tables after the platform moves on.
Mechanism
- The guard on MySQL is a UNIQUE key over a functional key part, the driver's hash-shadow digest, NULL for a packaged row (
packages/metadata-protocol/src/migrations/*-packageless-index.ts, MySQL branch). - Introspection records that key part as an expression (
packages/drivers/driver-sql/src/sql-driver-introspection.ts, theEXPRESSIONbranch of the MySQL statistics read). hasPartialUniqueGuard(packages/drivers/driver-sql/src/schema-drift.ts) accepts onlypartial === truewith no expressions, so the guard never counts, andwidenedUniqueReplacementskeeps the old key (kept), with no plan op ever offered.- Pinned as the declared limit in
packages/drivers/driver-sql/src/sql-driver-widened-connection-key.test.ts(MySQL cell: no index op, a second package's row refused).
Acceptance
driver-sqlrecognises the platform's MySQL functional-digest guard (the digest expression over exactly the narrower columns, NULL when the gained column is non-null) as a partial unique on those columns, so the arm plans the same safereplace_unique_indexas on PostgreSQL.- The MySQL cells of the three widened-key suites flip from the declared limit to the replace; MariaDB unchanged.
- The declared-limit sentences go (changesets of plugin-security + runtime: the grant, clone and activation doors take a permission set's package and report a two-holder name with its candidates (ADR-0150 D3/D8; before #31698 PR-2) #32164 and feat(service-automation, metadata-protocol, driver-mongodb, cli): a connector connection is unique per organization and instance (package, name) #33199 are released text; the new changeset says FROM kept TO retired, plus
content/docs/deployment/cli.mdx"Runtime-owned indexes apply builds").
Who acts
The server lane's driver-sql owner, as one PR after #33199 lands (it adds the connection table's MySQL cell this card flips). Not folded into #31699: it is a driver change across three tables.
Duplicate search
gh api search/issues over this repo, issues: hasPartialUniqueGuard 2 hits (#31699, #32164, neither tracks it); MySQL functional key part guard 26 (#31732 is the MongoDB analogue, closed; none for MySQL); widening arm MySQL 228, first page none; packageless MySQL expression 4, none.
Activity
objectstack-fleet commentedon Nov 14, 2026
triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH
Path: none
Triage: first touch →
domain:server· p3 ·pm:queue· 2026-11-14T02:45Z⛔ Not a claim.
epic:#31527#3may fold it with metadata-protocol: after a restart, two stored rows of one name that each name a different holder leave only the last one loaded, for every package-slotted type (tool, webhook, …) #33127 / metadata-protocol: the registry's bare slot keeps only the row hydrated last when a pair row and a package-less row of the same member are both stored #32900 if it touches the same key code.objectstack-fleet commentedon Nov 14, 2026
domain:server#5 · os-elon-musk · session_016WV4cw787kMeaX7oyz7DDC
Claim: area-lease pilot #33059, area thread A4 (data layer) · p3 (unleased domain:server card; A4's p1 #33454 waits on PR #33451 for a shared dependency, and the remaining unleased p1/p2 queue is ADR-0150 metadata-protocol work outside A4) · lease:A4 added on claim · dispatched to an os-dev subagent of this area thread
Session:
session_016WV4cw787kMeaX7oyz7DDC(area thread; subagent of it)Account:
os-elon-muskBranch:
claude/area-A4-33201Worktree:
objectstack-a4-33201Domain:
domain:serverSeat:
domain:server#5File surface:
packages/drivers/driver-sql/src/schema-drift.ts(hasPartialUniqueGuard/widenedUniqueReplacements),packages/drivers/driver-sql/src/sql-driver-introspection.ts(MySQL expression key part read, only if needed), the MySQL cells of the three widened-key suites,content/docs/deployment/cli.mdx(the declared-limit sentence), one changeset. Stop on breach.Container & model:
M,mode:subagent,model: default,effort: highClause-②: no (expected; re-read after the diff)
Metadata-protocol: none
Responsibility: on an upgraded MySQL 8 database the widening arm recognises the platform's functional-digest guard and plans the same safe
replace_unique_indexas on PostgreSQLThread-read: none
Premise: re-measured at
origin/mainbefore any edit;premise_still_valid: falseis a valid resultSerial constraints cleared: #33199 is closed; no open PR touches schema-drift.ts, sql-driver-introspection.ts or the packageless-index migrations (62 open PRs read at claim time); A4's in-flight cards do not touch driver-sql
objectstack-fleet commentedon Nov 14, 2026
domain:server#5 · os-elon-musk · session_016WV4cw787kMeaX7oyz7DDC
os-dev-report
{ "issue": 33201, "status": "done", "branch": "claude/area-A4-33201", "pr": "https://github.com/objectstack-ai/objectstack/pull/33514", "session": "session_016WV4cw787kMeaX7oyz7DDC", "premise_still_valid": true, "summary": "Premise re-measured and held: on a live MySQL 8.0.46 the guard's functional key part is stored as (case when (SCOPE is null) then unhex(sha2(concat(COLS joined by ,0x1f,),256)) end) and, with the recognition ablated, all three upgraded-MySQL cells keep the old key (no replace). driver-sql now reads that expression as a partial unique: new pure parseFunctionalRowScopedGuard (schema-drift.ts) accepts it only when the whole expression is that CASE wrapper, the digest equals in MySQL's stored spelling what the new hashShadowDigestSql builds over the named plain columns (the builder createHashShadowUniqueIndex already used, extracted byte-identical), and the scope is not a key column; hasPartialUniqueGuard accepts such an index (sole key part, unique, no WHERE, no shadow) when its columns are exactly the narrower key's and its scope is the one nullable gained column, so the widening arm plans the same safe replace_unique_index as on PostgreSQL. The connection-key MySQL cell flips from the declared limit to the replace; the grant-key and activation-ledger suites gain pure pins plus a live MySQL 8 cell each (they had none); MariaDB cell untouched. cli.mdx limit sentence replaced, metadata-protocol connector guard docblock corrected (comment only), new driver-sql patch changeset (FROM kept TO retired), and the pending .changeset/31699-connection-key-package.md MySQL bullet rewritten as a DELIBERATE CORRECTION (Check Changeset red by design; declared in the PR body for the dispatching seat's record). PR-body correction for the seat (dev does not PATCH): the Acceptance-notes bullet 'PostgreSQL cells were not run locally (no server)' is superseded, a local PostgreSQL 16 was started afterwards and the PG cell passed; and CI's Temporal Conformance job runs only on push to main / schedule, not on this PR or the merge queue.", "tests": "Local live servers I started (MySQL 8.0.46 Ubuntu package on 127.0.0.1:33201, PostgreSQL 16 on 127.0.0.1:35201). Head d0f178767f: the three widened-key suites with both URLs, TZ=America/New_York, OS_EXPECT_LIVE_DIALECT_MATRIX=1: Test Files 3 passed (3), Tests 61 passed | 1 skipped (62); the skip is the MariaDB cell (server is MySQL). Live cells passed: connection key on live postgres and live mysql, grant key on MySQL 8, activation ledger on MySQL 8. driver-sql full suite with live MySQL at b3e78bb48a: Tests 3 failed | 5332 passed | 141 skipped; failures are environment cells outside the diff (4 temporal/window cells needing the skewed process zone, green when re-run with TZ=America/New_York; sql-driver-11565-row-byte-budget InnoDB page-limit refusal does not fire on the locally packaged server; none reads introspection or the widening arm). Ablations via scripts/ablation-replace.mjs on committed b01a23c36f, each restored (blob == HEAD, git diff HEAD empty), src-imported tests so no dist leg: (1) recognition replaced by null: 5 red (2 pure + 3 live MySQL cells); (2) digest comparison deleted: 5 red (hash width, hash function, separator, no unhex, ELSE); (3) scope check deleted: 2 red (scope not the gained column; two nullable gained columns).", "gates": "Local: pnpm --filter @objectstack/driver-sql typecheck exit 0 (lock VERDICT command-exit 0, on d0f178767f); eslint --no-inline-config on the 6 changed source files exit 0; post-merge scoped re-check: spec check:generated flagged check:test-typecheck with tsc failed without diagnostics under default heap, re-run with NODE_OPTIONS=--max-old-space-size=4096 exit 0 (spec untouched by this diff). dispatch-gates --commands on d0f178767f: 98 derived, --ran reconciliation 97 run, 1 NOT MEASURED (check:dual-build-cjs-loads exit 3 PREREQUISITE NOT MET, needs packages/apps account/setup/studio built), 0 unrun; red: node scripts/check-empty-changeset.mjs --base origin/main exit 1 = the DELIBERATE CORRECTION, red by design; all others exit 0. PR check-runs on d0f178767f: Lint & Repo Gates success, TypeScript Type Check success, Test Core success (8/8), Build Core success, Governed Surface Queue Guard success, Live E2E UI success, Test UI success, Dogfood Regression Gate success, Lint · ESLint success, Lint · PM dispatch-gates success, PR-body guards success, Spec property liveness success, Check Changeset failure (the declared DELIBERATE CORRECTION on .changeset/31699-connection-key-package.md), Temporal Conformance (live PG + MySQL) skipped (it runs only on push to main / schedule, never on pull_request or merge_group, so the live MySQL and PG cells are measured on PR heads only by the local runs above).", "dogfood_battery": "n/a — no ! in the PR title and no (narrowing) arm", "mcp_calls": "0", "api_writes": "2 — fleet-write relay: pr_create objectstack-ai/objectstack#33514 (POST /repos/objectstack-ai/objectstack/pulls + assignee os-elon-musk); post-stamped: POST /repos/objectstack-ai/objectstack/issues/33201/comments (os-dev-report). Plus git push (not REST).", "open_questions": [], "security_findings": "none", "out_of_scope_findings": [ "carrier: none · noted, not filed — Temporal Conformance (live PG + MySQL), the only CI job that runs driver-sql's live MySQL/PG cells, is skipped on pull_request and merge_group, so a PR that changes a live-only cell (like the three here) reaches main with those cells measured only locally; observation, not a defect class, recorded in the PR acceptance notes", "carrier: none · noted, not filed — sql-driver-11565-row-byte-budget 'reports InnoDB page-limit refusals' does not fire on Ubuntu's packaged MySQL 8.0.46 (innodb_default_row_format dynamic, page 16K, strict on) while CI's official image is the reading of record; environment observation only" ] }fix(driver-sql): an upgraded MySQL 8 database retires the narrower ke…