Repository navigation
refactor(web): let contract types flow through web/service instead of casts - #47120
Merged
Merged
Conversation
2 of 5 tasks
hyoban
marked this pull request as ready for review
November 25, 2026 10:37
lyzno1
approved these changes
Nov 25, 2026
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.
Summary
uploadPublicRemoteFileInfo(web/service/common.ts) now returns theremoteFiles.uploadcontract type. Before, a cast claimedmime_typeandurlwere always strings. The contract says they can benull, and the file uploader already falls back withres.mime_type ?? ''andres.url ?? url.FileUploadStrategy.uploadRemotenow declares the small result shape the uploader reads, withmime_typeandurlnullable. It no longer borrowsReturnType<typeof uploadPublicRemoteFileInfo>, so the contract result fits and so does the human-input v2 upload result. Runtime behavior is unchanged.Casts left in
web/service, and whyThe contract and the local type really differ in each case below. The cast was kept to avoid hiding the gap or changing behavior.
log.tsfetchRunDetail/fetchTracingListinputs_truncated,outputs_truncated,metadata,created_by).workflow.tsfetchAppWorkflowDraft/fetchPipelineWorkflowDraftgraphasRecord<string, unknown>and variablevalueasunknown. The editor needsnodes/edgesand typed environment and conversation variables.share.ts/debug.tsstream sender bodies (body as …['body'], 10 sites)StreamSendertakesRecord<string, unknown>, and its callers are the chat and text-generation hooks. Typing the bodies means changing those hooks, which is out of scope here.debug.tsgenerateBasicAppFirstTimeRule/generateRulemodel_config.mode: ''and leave outflow_id. The contract requires'chat' | 'completion'and aflow_id.share.tsfetchAppInfo(AppData)custom_configoptional andend_user_idnullable.AppDatahas both as required or non-null.share.tsfetchConversations/generationConversationName(web app branch)introductionoptional and nullable.ConversationItemhas it asstring. The installed-app branch already normalizes it throughselectConversation.share.tsfetchAppParams(ChatConfig)pre_prompt,prompt_type,dataset_configsand more thatChatConfigdeclares.share.tsfetchAppMeta(AppMeta)tool_iconsis optionalRecord<string, unknown>. The installed-app branch normalizes it, the web app branch does not.share.tsgetAppAccessModeByAppCodeaccessModeasstring, not theAccessModeenum.share.tsgetHumanInputFormLegacyHumanInputFormData.share.tshuman-input local/remote file upload responsesFileResponsefields are mostly nullish, and it has nourlfield at all. The localHumanInputFormRemoteFileUploadResponsedeclaresurl: string.tools.tsform/schema_typeschema_type: ''. The contract uses enums.plugin-credential-queries.tsCredentialview model needsis_defaultand reads fields the contract lacks (from_enterprise,not_allowed_to_use,allow_custom_token).plugin-install-queries.tsstructuralSharingpassesunknownarguments.marketplace-template-discovery.tsMarketplaceTemplatecontract does not declare.console/code-based-extension-query.ts,console/app-parameters-select.ts,console/defined-errors.tsunknownor a plain record.fetch.ts,http-error.ts,xhr-fetch.ts,event-stream.ts,base.tsuse-plugins.tsContract mismatches worth following up
humanInputForms.files.postresponse (FileResponse) has nourlfield. The legacy remote-upload code declaresurl: string.inputs_truncated,outputs_truncated,metadataandcreated_by.model_config.modeto bechatorcompletion, and the instruction payload requiresflow_id. The UI can send''for the mode and leave outflow_id.accessModeis typed as a plain string.