Conversation
…when none is given Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
|
commit: |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
client.experimental.tasks.getTaskResult(taskId)now falls back toGetTaskPayloadResultSchemawhen the caller omits the optional result schema, instead of forwardingundefinedinto validation.Fixes #2742
Motivation and Context
The wrapper declares
resultSchema?: Tbut hands it straight toProtocol.getTaskResult, whose parameter is required and goes intorequest()unchanged. Withundefinedthe response path reachesisZ4Schema(undefined)insrc/server/zod-compat.tsand throwsTypeError: Cannot read properties of undefined (reading '_zod')from inside_onresponse, so it does not surface as a rejection of the awaited call either.getTaskandlistTasksalready pass a default schema;tasks/resulthas one too (GetTaskPayloadResultSchema, the looseResultSchema), it was just never wired up. The type parameter now defaults to that schema so a schema-less call is typed asGetTaskPayloadResultrather than resolving through the bareAnyObjectSchemaconstraint. Callers that pass a schema are unaffected.How Has This Been Tested?
Extended the existing
should query task result from server using getTaskResulttest intest/client/index.test.tsto also fetch the same task without a schema. It fails onv1.xwith the reported_zodTypeError before the change.npm run typecheck,npm run lintand the client, server and task-lifecycle suites pass locally.Breaking Changes
None.
Types of changes
Checklist
Additional context
Based on
v1.xsince that is where the reported code lives.