Skip to content

Commit 8ec0646

Browse files
committed
test(rest): clear two CI ratchets the new OWD gate suite tripped (#7674)
Both are ratchets on the new integration test's own surface, not on the fix. Neither is remedied by raising a number, and neither was raised. 1. `query-options-erasure` — the test surface grew 242 -> 243. The new site was `engine.find('sys_metadata', { … } as any)` in the suite's persistence probe. The input is not off-contract, so the remedy is the first one the rule's message prescribes: drop the assertion and let it infer against `EngineQueryOptions`, keeping `tsc` as the enforcing channel for those keys (#4674). No `as unknown as EngineQueryOptions` escape is warranted here, and the baseline is unchanged — measured back at 242, the ceiling. 2. `TypeScript Type Check` TEST_DEBT — `@objectstack/rest` measured 159 against a recorded 155, which since #6939 carries no margin. All four were in the new file: one TS2835 (a relative import without its `.js` extension — the trap AGENTS.md names, and the class that is already 124 of this entry's debt) and three TS2554 from hand-rolled `registerObject` calls missing the required `packageId`. The import gains its extension; the three platform-object registrations move onto `registerApp` under `com.objectstack.metadata-objects`, which is the seam `assembleMetadataProtocol` itself uses — so the harness got more faithful rather than merely quieter. Re-measured at exactly 155; the ledger is untouched and no other entry was lowered. Neither ratchet is evaluated by a package's own `test`/`typecheck` scripts — rest's tsconfig excludes its own tests while the TEST_DEBT ratchet measures raw `tsc --noEmit` including them — which is why a green local run said nothing about either.
1 parent b82488c commit 8ec0646

1 file changed

Lines changed: 28 additions & 9 deletions

File tree

‎packages/rest/src/meta-object-owd-gate.test.ts‎

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ import {
7373
// of the verdict. A local copy of the gate would make this suite a test of the
7474
// copy, which is the failure mode the file exists to close.
7575
import { registerObjectPostureGate } from '@objectstack/plugin-security';
76-
import { RestServer } from './rest-server';
76+
import { RestServer } from './rest-server.js';
7777

7878
const META_ITEM = '/api/v1/meta/:type/:name';
7979

@@ -184,12 +184,21 @@ async function boot(opts: { channel?: MetadataAuthoringChannel; envWritableObjec
184184
liveEngines.push(engine);
185185
engine.registerDriver(makeSqliteDriver(), true);
186186
await engine.init();
187-
engine.registry.registerObject(SysMetadata as any);
188-
engine.registry.registerObject(SysMetadataHistoryObject as any);
189-
// The ADR-0029 save-audit sink. Registered so a permitted write's audit row
190-
// lands rather than degrading into a logged best-effort failure — the noise
191-
// would otherwise read like a defect in a suite about refusals.
192-
engine.registry.registerObject(SysMetadataAuditObject as any);
187+
// The metadata-storage platform objects, registered through the SAME seam
188+
// `assembleMetadataProtocol` uses — one `registerApp` manifest under
189+
// `com.objectstack.metadata-objects`, not three hand-rolled
190+
// `registerObject` calls. The audit sink is in the list so a permitted
191+
// write's audit row lands rather than degrading into a logged best-effort
192+
// failure, which would otherwise read like a defect in a suite about
193+
// refusals.
194+
engine.registerApp({
195+
id: 'com.objectstack.metadata-objects',
196+
name: 'Metadata Platform Objects',
197+
version: '1.0.0',
198+
type: 'plugin',
199+
scope: 'system',
200+
objects: [SysMetadata, SysMetadataHistoryObject, SysMetadataAuditObject],
201+
});
193202
engine.registry.registerObject(PACKAGED_ACCOUNT as any, 'demo_pkg');
194203
await engine.syncSchemas();
195204

@@ -228,9 +237,19 @@ async function boot(opts: { channel?: MetadataAuthoringChannel; envWritableObjec
228237
return res;
229238
};
230239

231-
/** Overlay rows actually in `sys_metadata` for a name — the persistence half. */
240+
/**
241+
* Overlay rows actually in `sys_metadata` for a name — the persistence half.
242+
*
243+
* The options bag is TYPED, not erased. `ObjectQL.find`'s second parameter
244+
* is already `EngineQueryOptions`, so the literal infers against it and
245+
* `tsc` stays the enforcing channel for these keys — the #4674 lesson the
246+
* `query-options/no-any-erasure` rule exists for (an unknown key here is
247+
* silently DROPPED, never rejected, because the options schemas are not
248+
* `.strict()`). Nothing about this query is off-contract, so it needs no
249+
* `as unknown as EngineQueryOptions` escape either.
250+
*/
232251
const storedRows = async (name: string) =>
233-
engine.find('sys_metadata', { where: { type: 'object', name } } as any);
252+
engine.find('sys_metadata', { where: { type: 'object', name } });
234253

235254
return { engine, protocol, put, storedRows };
236255
}

0 commit comments

Comments
 (0)