Skip to content

Commit 5a321e3

Browse files
committed
test(driver-sql): main's organization-less fixtures (7a-1 read-back, 7b-3 lean counter) model a pre-18 store
Claude-Session: https://claude.ai/code/session_018EszgtA3V2KXBX5tf59Hi4 Co-authored-by: Claude <noreply@anthropic.com>
1 parent f56c207 commit 5a321e3

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

‎packages/drivers/driver-sql/src/sql-driver-21227-create-answers-stored-row.test.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747

4848
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
4949
import { SqlDriver, type SqlDriverConfig } from '../src/index.js';
50+
import { asPre18TenantColumn } from './pre-18-tenant-column.testkit.js';
5051
import { DIALECT_CELLS, declareDialectCell, type DialectCell } from './live-dialect-matrix.testkit.js';
5152

5253
const TABLE = 'os21227_stored_row';
@@ -207,6 +208,9 @@ function suite(face: Face) {
207208
// own union (`IN ('org_b')`) would miss the unstamped row this call just
208209
// wrote. The read is scoped by that union only when every row carries a
209210
// tenant; here the call's own options (none) decide, and the ids bound it.
211+
// The unstamped row lands only on a table built before 18.x (ADR-0131 D1
212+
// makes a fresh tenant column NOT NULL): this table is that store's.
213+
await asPre18TenantColumn(driver, TABLE);
210214
const batch = await driver.bulkCreate(TABLE, [
211215
{ id: 't-m1', title: 'named', organization_id: 'org_b' },
212216
{ id: 't-m2', title: 'unstamped' },

‎packages/drivers/driver-sql/src/sql-driver-organizationless-counter-refusal.test.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import { afterEach, describe, expect, it } from 'vitest';
2020
import { SqlDriver } from './index.js';
21+
import { asPre18TenantColumn } from './pre-18-tenant-column.testkit.js';
2122
import {
2223
ORGANIZATIONLESS_COUNTER_REFUSAL_CODE,
2324
ORGANIZATIONLESS_COUNTER_REFUSAL_STATUS,
@@ -121,6 +122,11 @@ describe('[ADR-0131 D9, 8d] the counter refuses an organization-less row on a te
121122

122123
it('a composition with no organization object (a lean embedding) keeps `__global__` on a tenant table', async () => {
123124
const driver = await bootDriver([CASE_OBJECT]);
125+
// The organization-less row itself lands only where the tenant column is
126+
// nullable — a table built before 18.x (ADR-0131 D1 makes a fresh one NOT
127+
// NULL, so a lean embedding's fresh table refuses it at the database). The
128+
// counter's bucket is this case's subject, so the table is that store's.
129+
await asPre18TenantColumn(driver, 'crm_case');
124130

125131
const first = await driver.create('crm_case', { subject: 'lean embedding' });
126132
expect(first.case_number).toBe('CASE-0001');

0 commit comments

Comments
 (0)