Skip to content

Commit 0cf309f

Browse files
test(metadata-protocol): the live-MySQL sys_setting probe expects the plain organization_id column (#25152)
Refs #25131 Clause-②: no (test expectation only: no response, status, error, outcome or export moves) Metadata-protocol: none Round 2 of claim 6327765912, under the seat's re-declaration 6329308116. Round 1 (#25142, merged as `4c7dcb4519`) greened step 12 of `Temporal Conformance (live PG + MySQL)`. That let step 16, "Run the metadata-protocol migration statements against live MySQL and PostgreSQL", run for the first time since `fccbd9d0d5`, and it fails one test. This PR changes that test's expected row and one stale docblock example. No production statement moves, and nothing is skipped, narrowed or deleted. ## What is red - `packages/metadata-protocol/src/migrations/sys-setting-identity-index.live-mysql.test.ts`, test "the MySQL-spelled statement PARSES, and lists exactly the duplicate group". - It expected `organization_id_key: 'org_jia'` and received `organization_id: 'org_jia'`. The rest of the row is identical: namespace, key, scope, `user_id_key: ''` and `duplicate_rows: 2`. - **Cause:** #24893 (`d5d8146012`, 7b-1 + 7b-2) re-keyed the `sys_setting` row-identity duplicate probe to the plain `organization_id` on purpose (`WHERE organization_id IS NOT NULL … GROUP BY organization_id, …`; `COALESCE(user_id, '')` stays). It updated the unit test `sys-setting-identity-index.test.ts` to pin that statement. This live-only file runs only in the full battery, so it was missed. ## Is the received shape what #24893 intended? Yes, measured - The live fixture seeds two `tenant` rows for one `(org_jia, lifecycle, retention_overrides)` with a NULL `user_id`, plus one `user` row. It has **no NULL-organization row**. - So the plain probe's `WHERE organization_id IS NOT NULL` excludes nothing here, and the live answer is still exactly the one duplicate group, `duplicate_rows: 2`. No group the probe should list is missed. - The received row is the statement #24893 ships, run on a live MySQL 8.0. ## The change - `sys-setting-identity-index.live-mysql.test.ts`: the expected row's key `organization_id_key` becomes `organization_id`. The test still asserts the whole row and the one group. No other line moves. - `runtime-index-preflight.ts`, the `RuntimeIndexDuplicateGroup.key` docblock (about line 152): its example, `organization_id_key = '__global__'`, named the alias #24893 retired. - Measured: none of the three indexes this pre-flight covers projects an organization sentinel any more. `sys_setting` projects `user_id_key`, and the two overlay indexes project `package_id_key` and `bundle_member_key`. - The example now reads `user_id_key = ''` ("user_id IS NULL"). Comment only. ## Census Step 16 runs four `live-*` test files in `packages/metadata-protocol`: - `sys-setting-identity-index.live-mysql.test.ts` - `seed-tenancy-backfill.live-mysql.test.ts` - `seed-tenancy-backfill.live-postgres.test.ts` - `live-mysql-database.isolation.test.ts` Only the first pinned `organization_id_key` or `COALESCE(organization_id, …)`. The `seed-tenancy-backfill` pair is about the `__global__` autonumber counter, 7b-3's ground, which #24893 left untouched. Both pass live. ## Verification Live MySQL 8.0 (`mirror.gcr.io/library/mysql:8.0`, `SET GLOBAL time_zone = '+08:00'`) and PostgreSQL 16 (`mirror.gcr.io/library/postgres:16`, timezone `Asia/Shanghai`), both in local containers. Step 16's own command and env: `OS_TEST_MYSQL_URL`, `OS_TEST_POSTGRES_URL` and `OS_EXPECT_LIVE_DIALECT_MATRIX=1`. The build was step 16's `turbo run build --filter=@objectstack/metadata-protocol...` (13/13). | Run | Head | Result | |---|---|---| | `pnpm --filter @objectstack/metadata-protocol exec vitest run live-mysql live-postgres`, before the edit | `4c7dcb4519` | `Test Files 1 failed / 3 passed (4)`, `Tests 1 failed / 27 passed (28)`: the one test above, with the same diff as CI | | Same command, after the edit | `d7144693b` | `Test Files 4 passed (4)`, `Tests 28 passed (28)`. The `[#9434] live MySQL … sql_mode=…` line is printed, so the cell ran. | | `pnpm --filter @objectstack/metadata-protocol test`, default (no live servers) | `d7144693b` | `Test Files 252 passed / 3 skipped (255)`, `Tests 20837 passed / 19 skipped`, exit 0 | | `pnpm --filter @objectstack/metadata-protocol typecheck` | `d7144693b`, and again after merging `origin/main` at `0f372a1ff` | exit 0, both times. `tsc --listFiles` lists both edited files. | **Gates.** `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack` derives 54 families (2 paths, +3/−3). On `d7144693b`, after a full `pnpm exec turbo run build --concurrency=2` (77/77), all 54 exited 0. `--ran` reconciliation: "54 derived, 54 run, 0 NOT-MEASURED, 0 UNRUN", a DERIVED zero. `origin/main` was then merged (`459afea1f`, `packages/lint` only, disjoint). The derivation at `0f372a1ff` is the identical 54, re-run there: all 54 exited 0, and `--ran` again gives "54 derived, 54 run, 0 NOT-MEASURED, 0 UNRUN", a DERIVED zero. **Changeset.** `skip-changeset`: a test expectation plus one comment line. The comment is a docblock on an exported interface, so it rides into the `.d.ts`, but no symbol, type or runtime byte moves. **The hourly run.** Step 16 runs only on push, schedule and dispatch, never on a PR or in the queue. The local live run above is its proof here, and the next push or hourly full run on `main` is the proof there. ## Acceptance notes - #25132 remains open and is not addressed here. The `__global__` autonumber counter (7b-3) is untouched. --- _Generated by [Claude Code](https://claude.ai/code/session_018gewcgUaNUX9hMkxeP2HE2)_ Co-authored-by: Claude <noreply@anthropic.com>
1 parent 331613c commit 0cf309f

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

‎packages/metadata-protocol/src/migrations/runtime-index-preflight.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,8 @@ export interface RuntimeIndexDuplicateGroup {
148148
/**
149149
* The key, exactly as the migration's query projects it: a bare column
150150
* name, or `<column>_key` for a column whose NULLs the index folds into a
151-
* sentinel bucket. Neither sentinel can occur in real data, so
152-
* `organization_id_key = '__global__'` reads as "organization_id IS NULL".
151+
* sentinel bucket. No sentinel can occur in real data, so
152+
* `user_id_key = ''` reads as "user_id IS NULL".
153153
*/
154154
key: Record<string, string | null>;
155155
/** How many rows hold it. */

‎packages/metadata-protocol/src/migrations/sys-setting-identity-index.live-mysql.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ describe.skipIf(!MYSQL_URL)('#9434 the sys_setting duplicate probe on a LIVE MyS
175175
const [rows] = await conn.query(buildSysSettingDuplicateProbeSqlMysql());
176176
expect(rows).toEqual([
177177
{
178-
organization_id_key: 'org_jia',
178+
organization_id: 'org_jia',
179179
namespace: 'lifecycle',
180180
key: 'retention_overrides',
181181
scope: 'tenant',

0 commit comments

Comments
 (0)