Skip to content

Commit 514d90f

Browse files
committed
test(runtime): reshape the expected-refusal noise pins to the engine's refusal
An unregistered organization object (and a view's unregistered probe object) is no longer read through the driver: the engine refuses the name first, so the declared refusal no longer occurs. The capture stays declared and each pin now asserts nothing was withheld, so a returning read turns it red. The channel-asymmetry pin registers its probe object (unprovisioned) so it still measures a real driver refusal. Claude-Session: https://claude.ai/code/session_01DDZNkDVwPQnevTFcYE47H3 Co-authored-by: Claude <noreply@anthropic.com>
1 parent 672a348 commit 514d90f

18 files changed

Lines changed: 127 additions & 40 deletions

‎packages/runtime/src/app-plugin.job-data-reach.test.ts‎

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,6 @@ const live: Array<{
108108
driver?: SqlDriver;
109109
dir?: string;
110110
noise?: ExpectedReadRefusalCapture;
111-
/** The channels this test's path MUST have provoked — see `harness()`. */
112-
requiredChannels?: readonly string[];
113111
}> = [];
114112

115113
/**
@@ -119,6 +117,8 @@ const live: Array<{
119117
* construction, but the driver and the engine each log the fault on the way out.
120118
* Withheld and ASSERTED rather than muted — see `expected-read-refusal-noise.ts`.
121119
*/
120+
// [#21516] The engine now refuses a name its registry does not hold before any driver, so
121+
// this read no longer reaches the driver and nothing above is logged; the pin asserts that.
122122
const ABSENT_TENANCY_TABLE = 'sys_organization';
123123

124124
afterEach(async () => {
@@ -127,13 +127,14 @@ afterEach(async () => {
127127
try { await entry.engine?.destroy(); } catch { /* noop */ }
128128
try { await entry.driver?.disconnect(); } catch { /* noop */ }
129129
if (entry.dir) rmSync(entry.dir, { recursive: true, force: true });
130-
// A capture nobody asserts is a mute. The probe is memoised behind the
131-
// FIRST data operation, so only the paths that actually touch the store
132-
// provoke it — `silentChannels(required)` is the API's own answer to a
133-
// table read on some of a file's paths and not others. The withholding
134-
// is unconditional either way; only the must-have-fired set narrows.
130+
// A capture nobody asserts is a mute. [#21516] Quiet by construction
131+
// now, on every path: the engine refuses a name its registry does not
132+
// hold before any driver, so the probe asks the registry and never reads
133+
// the unregistered organization object. The capture stays declared (a
134+
// returning read is still withheld and counted) and this asserts that
135+
// nothing was.
135136
if (entry.noise) {
136-
expect(entry.noise.silentChannels(entry.requiredChannels ?? [ABSENT_TENANCY_TABLE])).toEqual([]);
137+
expect(entry.noise.tablesSeen()).toEqual([]);
137138
}
138139
}
139140
});
@@ -161,19 +162,10 @@ async function bootEngine(): Promise<{ engine: ObjectQL; driver: SqlDriver; nois
161162
return { engine, driver, noise };
162163
}
163164

164-
/**
165-
* @param opts.touchesStore whether this test's path performs a data operation.
166-
* `true` (the default) requires the tenancy probe to have fired and been
167-
* withheld; a context-shape test that never reads or writes passes `false`,
168-
* which keeps the withholding and drops only the must-have-fired requirement.
169-
*/
170-
async function harness(opts: { touchesStore?: boolean } = {}): Promise<Harness> {
165+
async function harness(): Promise<Harness> {
171166
const { engine, driver, noise } = await bootEngine();
172167
const adapter = new CronJobAdapter();
173-
live.push({
174-
engine, adapter, driver, noise,
175-
requiredChannels: opts.touchesStore === false ? [] : [ABSENT_TENANCY_TABLE],
176-
});
168+
live.push({ engine, adapter, driver, noise });
177169

178170
const readyHooks: Array<() => Promise<void>> = [];
179171
const ctx = {
@@ -254,7 +246,7 @@ describe('#14094 — a declarative job handler has data reach (TS-config path)',
254246

255247
it('the context is the pre-#14094 set PLUS exactly `ql` and `logger`', async () => {
256248
// Reads nothing and writes nothing — this one is about the shape.
257-
const h = await harness({ touchesStore: false });
249+
const h = await harness();
258250
const seen: Array<Record<string, unknown>> = [];
259251

260252
const plugin = new AppPlugin({
@@ -282,7 +274,7 @@ describe('#14094 — a declarative job handler has data reach (TS-config path)',
282274
});
283275

284276
it('`data` from a manual trigger still reaches the handler beside the new members', async () => {
285-
const h = await harness({ touchesStore: false });
277+
const h = await harness();
286278
const seen: Array<Record<string, unknown>> = [];
287279
const plugin = new AppPlugin({
288280
id: 'com.test.job-reach',
@@ -391,7 +383,7 @@ export const meta = { builtAt: '2026-09-01T00:00:00.000Z' };
391383

392384
describe('#14094 — additivity (Zone 1.1)', () => {
393385
it('a handler written against the PRE-#14094 context runs unchanged, byte for byte', async () => {
394-
const h = await harness({ touchesStore: false });
386+
const h = await harness();
395387
const calls: Array<{ jobId: string; data?: unknown }> = [];
396388

397389
// Verbatim the shape `IJobService`'s `JobHandler` declares — the type an

‎packages/runtime/src/batch-row-driver-text-real-driver.integration.test.ts‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ const NOTE = {
8585
* Withheld and asserted rather than muted; `expected-read-refusal-noise.ts`
8686
* says why.
8787
*/
88+
// [#21516] The engine now refuses a name its registry does not hold before any driver, so
89+
// this read no longer reaches the driver and nothing above is logged; the pin asserts that.
8890
const ABSENT_TENANCY_TABLE = 'sys_organization';
8991

9092
/**
@@ -115,7 +117,10 @@ describe('[#8502] a REAL driver fault is withheld from every batch row', () => {
115117
// a failure here can never leave the engine running. Every test in this
116118
// file rigs and writes, so the probe fires for each of them: this holds
117119
// for a single `-t` run as well as for the whole file.
118-
expect(noise?.silentChannels() ?? ['no capture was installed']).toEqual([]);
120+
// [#21516] Quiet by construction now: the engine refuses a name its registry does not
121+
// hold before any driver, so the declared refusal no longer occurs. The capture stays
122+
// declared (a returning read is still withheld and counted) and this asserts nothing was.
123+
expect(noise?.tablesSeen() ?? ['no capture was installed']).toEqual([]);
119124
noise = null;
120125
});
121126

‎packages/runtime/src/batch-row-http-status-real-driver.integration.test.ts‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,16 @@ const CHILD = {
8686
* make that test red for a reason that has nothing to do with it.
8787
* `expected-read-refusal-noise.ts` says why this withholds instead of muting.
8888
*/
89+
// [#21516] The engine now refuses a name its registry does not hold before any driver, so
90+
// this read no longer reaches the driver and nothing above is logged; the pin asserts that.
8991
const ABSENT_TENANCY_TABLE = 'sys_organization';
9092

9193
/** [commit 13a6cb4ad] The capture is a PIN, not a mute — this is the assertion half. */
9294
const expectExpectedNoiseWithheld = (noise: ExpectedReadRefusalCapture | null): void => {
93-
expect(noise?.silentChannels() ?? ['no capture was installed']).toEqual([]);
95+
// [#21516] Quiet by construction now: the engine refuses a name its registry does not
96+
// hold before any driver, so the declared refusal no longer occurs. The capture stays
97+
// declared (a returning read is still withheld and counted) and this asserts nothing was.
98+
expect(noise?.tablesSeen() ?? ['no capture was installed']).toEqual([]);
9499
};
95100

96101
describe('[#8570] a batch row carries the status its producer DECLARED — real driver', () => {

‎packages/runtime/src/bulk-write-real-driver.integration.test.ts‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ function metadataFor(objects: any[]) {
106106
* Withheld and asserted rather than muted; `expected-read-refusal-noise.ts`
107107
* says why.
108108
*/
109+
// [#21516] The engine now refuses a name its registry does not hold before any driver, so
110+
// this read no longer reaches the driver and nothing above is logged; the pin asserts that.
109111
const ABSENT_TENANCY_TABLE = 'sys_organization';
110112

111113
describe('bulk-write hardening on a REAL SqlDriver (framework#3147–#3152, #3172, #3173)', () => {
@@ -122,7 +124,10 @@ describe('bulk-write hardening on a REAL SqlDriver (framework#3147–#3152, #317
122124
// failure here can never leave the engine running. Every test in this file
123125
// boots and writes, so the probe fires for each of them: this holds for a
124126
// single `-t` run as well as for the whole file.
125-
expect(noise?.silentChannels() ?? ['no capture was installed']).toEqual([]);
127+
// [#21516] Quiet by construction now: the engine refuses a name its registry does not
128+
// hold before any driver, so the declared refusal no longer occurs. The capture stays
129+
// declared (a returning read is still withheld and counted) and this asserts nothing was.
130+
expect(noise?.tablesSeen() ?? ['no capture was installed']).toEqual([]);
126131
noise = null;
127132
});
128133

‎packages/runtime/src/cascade-delete-multivalue-lookup-real-driver.integration.test.ts‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,8 @@ const OWNER_PACKAGE = 'com.objectstack.test.9362';
172172
* Withheld and asserted rather than muted; `expected-read-refusal-noise.ts`
173173
* says why.
174174
*/
175+
// [#21516] The engine now refuses a name its registry does not hold before any driver, so
176+
// this read no longer reaches the driver and nothing above is logged; the pin asserts that.
175177
const ABSENT_TENANCY_TABLE = 'sys_organization';
176178

177179
// ── [#18617] The driver axis (ADR-0053 D-A3: "Postgres at minimum") ──────────
@@ -382,7 +384,10 @@ function declareCascadeDeleteCell(cell: DialectCell): void {
382384
// a failure here can never leave the engine running. Every test in this
383385
// file rigs and writes, so the probe fires for each of them: this holds
384386
// for a single `-t` run as well as for the whole file.
385-
expect(noise?.silentChannels() ?? ['no capture was installed']).toEqual([]);
387+
// [#21516] Quiet by construction now: the engine refuses a name its registry does not
388+
// hold before any driver, so the declared refusal no longer occurs. The capture stays
389+
// declared (a returning read is still withheld and counted) and this asserts nothing was.
390+
expect(noise?.tablesSeen() ?? ['no capture was installed']).toEqual([]);
386391
noise = null;
387392
});
388393

‎packages/runtime/src/default-datasource-plugin.test.ts‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ const ENV = 'OS_ALLOW_DRIVER_CONNECT_FAILURE';
3434
* each log the fault on the way out. Withheld and asserted in that one case
3535
* rather than muted; `expected-read-refusal-noise.ts` says why.
3636
*/
37+
// [#21516] The engine now refuses a name its registry does not hold before any driver, so
38+
// this read no longer reaches the driver and nothing above is logged; the pin asserts that.
3739
const ABSENT_TENANCY_TABLE = 'sys_organization';
3840

3941
async function assemble(opts: {
@@ -197,7 +199,10 @@ describe('DefaultDatasourcePlugin — the default datasource as a declaration (#
197199
// [commit 13a6cb4ad] The capture is a PIN, not a mute: the probe's two log lines
198200
// are withheld from the shared shard log and asserted here instead, so
199201
// a probe that stopped running goes red rather than merely quiet.
200-
expect(noise.silentChannels()).toEqual([]);
202+
// [#21516] Quiet by construction now: the engine refuses a name its registry does not
203+
// hold before any driver, so the declared refusal no longer occurs. The capture stays
204+
// declared (a returning read is still withheld and counted) and this asserts nothing was.
205+
expect(noise.tablesSeen()).toEqual([]);
201206
} finally {
202207
try { await (kernel as any)?.stop?.(); } catch { /* noop */ }
203208
}

‎packages/runtime/src/expand-nested-fields-join-key.integration.test.ts‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ const TASK = {
8585
* but the driver and the engine each log the fault on the way out. Withheld and
8686
* asserted rather than muted; `expected-read-refusal-noise.ts` says why.
8787
*/
88+
// [#21516] The engine now refuses a name its registry does not hold before any driver, so
89+
// this read no longer reaches the driver and nothing above is logged; the pin asserts that.
8890
const ABSENT_TENANCY_TABLE = 'sys_organization';
8991

9092
describe('#7537 expand with a nested `fields` that omits the join key (REAL SqlDriver)', () => {
@@ -101,7 +103,10 @@ describe('#7537 expand with a nested `fields` that omits the join key (REAL SqlD
101103
// failure here can never leave the engine running. Every test in this file
102104
// boots and writes, so the probe fires for each of them: this holds for a
103105
// single `-t` run as well as for the whole file.
104-
expect(noise?.silentChannels() ?? ['no capture was installed']).toEqual([]);
106+
// [#21516] Quiet by construction now: the engine refuses a name its registry does not
107+
// hold before any driver, so the declared refusal no longer occurs. The capture stays
108+
// declared (a returning read is still withheld and counted) and this asserts nothing was.
109+
expect(noise?.tablesSeen() ?? ['no capture was installed']).toEqual([]);
105110
noise = null;
106111
});
107112

‎packages/runtime/src/expected-read-refusal-noise.channel-asymmetry.test.ts‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,15 @@ async function probeRead(
158158
await kernel.use(new ObjectQLPlugin());
159159
await kernel.bootstrap();
160160
capture.captureEngine(kernel.getService<unknown>('objectql'));
161+
// [#21516] The engine refuses a name its registry does not hold before any
162+
// driver, so the probe object is REGISTERED — after boot, so no schema sync
163+
// provisions it. The read then reaches the driver and the table is absent:
164+
// the real refusal whose two channels this file measures.
165+
kernel.getService<{ registry: { registerObject(o: unknown): void } }>('objectql').registry.registerObject({
166+
name: table,
167+
label: table,
168+
fields: { title: { name: 'title', type: 'text' } },
169+
});
161170

162171
const data = kernel.getService<{ find(o: string): Promise<unknown[]> }>('data');
163172
try {

‎packages/runtime/src/package-list-commits-org-scope.integration.test.ts‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ const OTHER_ORG = 'org_other';
106106
* each log the read on the way out. Withheld and asserted rather than muted;
107107
* `expected-read-refusal-noise.ts` says why.
108108
*/
109+
// [#21516] The engine now refuses a name its registry does not hold before any driver, so
110+
// this read no longer reaches the driver and nothing above is logged; the pin asserts that.
109111
const UNBOUND_PROBE_OBJECT = 'anything';
110112

111113
let cleanup: Array<() => void> = [];
@@ -119,7 +121,10 @@ afterEach(() => {
119121
// failure here can never leave an engine running. Every test in this file publishes at
120122
// least once, so the probe fires for each of them: this holds for a single
121123
// `-t` run as well as for the whole file.
122-
expect(noise?.silentChannels() ?? ['no capture was installed']).toEqual([]);
124+
// [#21516] Quiet by construction now: the engine refuses a name its registry does not
125+
// hold before any driver, so the declared refusal no longer occurs. The capture stays
126+
// declared (a returning read is still withheld and counted) and this asserts nothing was.
127+
expect(noise?.tablesSeen() ?? ['no capture was installed']).toEqual([]);
123128
noise = null;
124129
});
125130

‎packages/runtime/src/package-revert-commit-attribution-org-scope.integration.test.ts‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ const OTHER_ORG = 'org_other';
9797
* each log the read on the way out. Withheld and asserted rather than muted;
9898
* `expected-read-refusal-noise.ts` says why.
9999
*/
100+
// [#21516] The engine now refuses a name its registry does not hold before any driver, so
101+
// this read no longer reaches the driver and nothing above is logged; the pin asserts that.
100102
const UNBOUND_PROBE_OBJECT = 'anything';
101103

102104
let cleanup: Array<() => void> = [];
@@ -110,7 +112,10 @@ afterEach(() => {
110112
// failure here can never leave an engine running. Every test in this file publishes at
111113
// least once, so the probe fires for each of them: this holds for a single
112114
// `-t` run as well as for the whole file.
113-
expect(noise?.silentChannels() ?? ['no capture was installed']).toEqual([]);
115+
// [#21516] Quiet by construction now: the engine refuses a name its registry does not
116+
// hold before any driver, so the declared refusal no longer occurs. The capture stays
117+
// declared (a returning read is still withheld and counted) and this asserts nothing was.
118+
expect(noise?.tablesSeen() ?? ['no capture was installed']).toEqual([]);
114119
noise = null;
115120
});
116121

0 commit comments

Comments
 (0)