Skip to content

Commit 0990e5d

Browse files
committed
test(objectql): type the request-family pins' function fixtures
The bind fixtures handed `bindHooks` functions returning a string, which its `Record<string, HookHandler>` option does not accept, and the bound action fixture lost its index signature in the spread; the test layer's typecheck (tsconfig.test.json) refused the file. Each fixture is now a distinct `HookHandler` closure (the cells compare identity only), and the bound action is typed as a record. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4d1EuHiCqvh8VEz81QD
1 parent 3f834fb commit 0990e5d

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

‎packages/objectql/src/registry-bare-name-one-holder-request-family.test.ts‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import {
3535
sealBareNameHoldersAtColdBoot,
3636
} from './registry.js';
3737
import { BUILT_IN_BARE_NAMES, bareNameReason, handlerOwnerPackageId } from './bare-name-one-holder.js';
38-
import type { ObjectQL } from './engine.js';
38+
import type { HookHandler, ObjectQL } from './engine.js';
3939

4040
type ManifestService = { register(m: unknown): void | Promise<void> };
4141
type Holder = { kind: string; packageId?: string };
@@ -66,7 +66,7 @@ const marker = (item: unknown): string | undefined =>
6666
(item as { label?: string; summary?: string } | undefined)?.label ?? (item as { summary?: string } | undefined)?.summary;
6767

6868
/** An action bound to `object`. */
69-
const boundAction = (name: string, tag: string, object: string) => ({ ...body('action', name, tag), objectName: object });
69+
const boundAction = (name: string, tag: string, object: string): Record<string, unknown> => ({ ...body('action', name, tag), objectName: object });
7070

7171
/** The package's own object, so a bound action has a target. */
7272
const itemObject = (ns: string) => ({
@@ -98,8 +98,9 @@ const caught = async (fn: () => unknown): Promise<Refusal | undefined> => {
9898
}
9999
};
100100

101+
/** A function a package's handlers bring: a distinct closure per call, so `resolveFunction`'s identity tells two holders apart. */
102+
const fn = (tag: string): HookHandler => Object.assign(async () => {}, { tag });
101103
/** The functions a package's handlers bring, as the runtime binds them: under `app:<packageId>`. */
102-
const fn = (tag: string) => async () => tag;
103104
const bindFunctions = (ql: ObjectQL, packageId: string, names: string[], tag = packageId.split('.').pop()!) =>
104105
ql.bindHooks([], { packageId: `app:${packageId}`, functions: Object.fromEntries(names.map((n) => [n, fn(tag)])) });
105106

0 commit comments

Comments
 (0)