Skip to content

fix(web_core): accept function calls that omit args (v0.9) - #2632

Open
wrenj wants to merge 1 commit into
mainfrom
fixbugggg
Open

wrenj wants to merge 1 commit into
mainfrom
fixbugggg

Conversation

@wrenj

@wrenj wrenj commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator

Problem

common_types.json#/$defs/FunctionCall requires only call, but the Zod
schema marked args as required. So a spec-valid {"call": "now"}:

  • failed validation, and
  • crashed DataContext with a raw TypeError from
    Object.entries(undefined) on both the sync and reactive resolve paths.
    Swift already models args as optional, so web_core was the outlier.

Fix

  • FunctionCallSchema: args is now .optional(), matching the JSON schema.
  • DataContext: default to {} in resolveDynamicValue and resolveSignal.
    The optional type makes removing either guard a compile error.

Tests

Four added, each confirmed to fail before the fix:

  • data-context.test.ts: argument-less calls resolve on the sync and
    reactive paths, and the invoker receives {}.
  • verify-schema.test.ts: FunctionCall.required matches the spec JSON, and
    an argument-less call parses. The existing parity suite only compares
    server_to_client definitions, which is why this drift went unnoticed.

@github-project-automation github-project-automation Bot moved this to Todo in A2UI Sep 11, 2026
@wrenj wrenj changed the title fix bug in functioncallschema fix(web_core): accept function calls that omit args (v0.9) Sep 11, 2026
@wrenj
wrenj requested review from gspencergoog, josemontespg and nan-yu and removed request for josemontespg September 11, 2026 19:11

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request makes the args field optional in FunctionCallSchema to align with the specification. It updates DataContext to handle omitted arguments using nullish coalescing (call.args ?? {}) when resolving dynamic values and signals, and adds corresponding unit tests to verify this behavior. There are no review comments, so I have no feedback to provide.

@wrenj
wrenj enabled auto-merge (squash) September 11, 2026 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants