Skip to content

Commit 3db5805

Browse files
fix(core): #2351 review-6 — hasInputRequestMethod O(1) membership probe; rescope Task* header to registry surface
1 parent c74924f commit 3db5805

5 files changed

Lines changed: 7 additions & 3 deletions

File tree

packages/core/src/shared/inputRequiredEngine.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,7 @@ export async function dispatchInputRequest(
131131
);
132132
}
133133
const method = entry['method'];
134-
const membership = codec.validateInputRequest(method, entry);
135-
if (!membership.ok && membership.reason === 'not-in-era') {
134+
if (!codec.hasInputRequestMethod(method)) {
136135
throw new SdkError(
137136
SdkErrorCode.InvalidResult,
138137
`Invalid input request '${key}': '${method}' is not an embedded request the ${codec.era} revision defines ` +

packages/core/src/wire/codec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ export interface WireCodec {
162162
/** Registry membership — the deletion story (inbound −32601 by absence; outbound typed local error). */
163163
hasRequestMethod(method: string): boolean;
164164
hasNotificationMethod(method: string): boolean;
165+
hasInputRequestMethod(method: string): boolean;
165166

166167
// ── Function-only validation surface ──────────────────────────────────
167168
// The validator-agnostic contract: callers never see a Zod schema, only a

packages/core/src/wire/rev2025-11-25/codec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ export const rev2025Codec: WireCodec = {
5858
validateNotification: (method: string, raw: unknown) => triState(getNotificationSchema(method), raw),
5959
// No in-band input-request vocabulary on this era: elicitation, sampling
6060
// and roots are real wire request methods here (see the registry).
61+
hasInputRequestMethod: (): boolean => false,
6162
validateInputRequest: (): ValidateOutcome<never> => NOT_IN_ERA,
6263
validateInputResponse: (): ValidateOutcome<never> => NOT_IN_ERA,
6364

packages/core/src/wire/rev2025-11-25/schemas.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
* registry; the deprecated Task* TYPES remain importable from the types barrel
1616
* (Q1-SD2: nameability is constant, runtime availability is version-keyed) but
1717
* appear in no API signature. Q1 increment 2 — deletions are physical: the
18-
* 2026-era codec has no Task* schemas at all.
18+
* 2026-era REGISTRY has no Task* methods (its frozen building-block copies do
19+
* carry the deprecated Task* sub-schemas by composition — soft contamination,
20+
* tracked for anchor-exactness adjudication).
1921
*
2022
* The only cross-layer dependency is `import type { JSONObject, JSONValue }`
2123
* from the neutral types barrel — pure structural type aliases with no parse

packages/core/src/wire/rev2026-07-28/codec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ export const rev2026Codec: WireCodec & {
120120

121121
hasRequestMethod: hasRequestMethod2026,
122122
hasNotificationMethod: hasNotificationMethod2026,
123+
hasInputRequestMethod: (method: string): boolean => getInputRequestSchema2026(method) !== undefined,
123124

124125
// ── Function-only validation surface ──
125126
validateRequest: (method: string, raw: unknown) => triState(getRequestSchema2026(method), raw),

0 commit comments

Comments
 (0)