Skip to content

fix(web_core): store null from updateDataModel on pre-1.0 surfaces - #4537

Merged
polina-c merged 4 commits into
a2ui-project:mainfrom
AndresDvst:fix/4525-preserve-null-pre-1.0
Dec 3, 2026
Merged

polina-c merged 4 commits into
a2ui-project:mainfrom
AndresDvst:fix/4525-preserve-null-pre-1.0

Conversation

@AndresDvst

Copy link
Copy Markdown
Contributor

Problem

Fixes #4525.

On pre-1.0 surfaces (v0.9 and v0.9.1), an updateDataModel message that sets a
non-root path to null removes the key from the data model instead of storing
null. MessageProcessor.processUpdateDataModelOp calls DataModel.set(path, value)
without preserveNull, while DataContext.set already passes it for pre-1.0
surfaces, so the same write behaves differently depending on where it comes from.

Changes

  • processUpdateDataModelOp computes preserveNull with the same expression as
    DataContext.set (protocolVersion set and below 1.0) and passes it to
    DataModel.set. v1.0 surfaces, surfaces without a version, and root-path
    writes behave as before.
  • Tests in message-processor.test.ts: a null at a non-root path is stored on
    v0.9 and v0.9.1 surfaces (both failed before the change), and the key is
    still removed on a v1.0 surface.
  • Entry under ## Unreleased in typescript/core/web_core/CHANGELOG.md.

v0.8 is not tested here: its adapter rejects a null content value before it
reaches updateDataModel.

Possible follow-up, not changed here to keep the scope to the issue: the
createSurface initial dataModel path (message-processor.ts, the
surface.dataModel.set(path, value) call for non-empty keys) also omits
preserveNull, so a pre-1.0 initial {"x": null} drops x. Happy to open a
separate issue or PR if you want that aligned too.

Local checks in typescript/core/web_core: yarn test (build, conformance and
unit tests: 1698 passed), eslint (0 errors on the touched files) and prettier.

Pre-launch Checklist

One time:

For this PR:

  • I have updated the relevant CHANGELOG.md file.
  • I updated/added relevant documentation.
  • My code changes (if any) have tests.
  • If my branch is on a fork, I have verified that scripts/e2e_test.sh passes.

No documentation change is needed (no documented behaviour changes). I could not
run scripts/e2e_test.sh or a sample: they need Flutter and a Gemini API key,
which I don't have in this environment.

If you need help, consider asking for advice on the discussion board.

🤖 Generated with Claude Code

`MessageProcessor.processUpdateDataModelOp` called `DataModel.set`
without `preserveNull`, so an `updateDataModel` that set a non-root path
to `null` on a v0.9 or v0.9.1 surface removed the key instead of storing
`null`. It now computes `preserveNull` the same way `DataContext.set`
does; v1.0 surfaces still remove the key.

Fixes a2ui-project#4525

@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 updates the MessageProcessor to preserve explicit null values when updateDataModel is called on a non-root path for v0.9 and v0.9.1 surfaces, while maintaining the behavior of removing the key for v1.0 surfaces. It also adds corresponding unit tests to verify this behavior and updates the changelog. I have no feedback to provide as the changes are well-implemented and include appropriate test coverage.

@github-actions github-actions Bot added the status: needs-triage auto-managed: https://github.com/a2ui-project/a2ui/blob/main/scripts/triage.mjs label Dec 2, 2026
@polina-c

polina-c commented Dec 2, 2026 •

Copy link
Copy Markdown
Collaborator

From triage bot, analysis:

For humans

TL;DR
Case: this external PR fixes the web_core null-handling bug in #4525, with tests.
Suggestion: assign for triage to gspencergoog.

Summary:
On v0.9 and v0.9.1 surfaces, the PR makes MessageProcessor store an explicit null that updateDataModel sets at a non-root path, instead of removing the key. It adds tests for v0.9, v0.9.1 and v1.0, and a changelog entry.

Targeted issues:
#4525

Why flagged for triage:
This PR has no assignee.

Suggestion:

  1. Add labels: type: bug, component: core sdk, lang: typescript, status: assigned-for-triage
  2. Assign: gspencergoog
  3. Related items: fix(web_core,angular,lit): restore pre-1.0 call sites broken by the 1.0 API #3658, fix(web_core): reject a message whose version is not its surface's #4452

Reply:

From triage:

Thanks for the fix and the tests. Assigning this PR to gspencergoog, who maintains message-processor.ts, to decide on it. They can also say whether the createSurface initial data model should get the same change in a follow-up.

To adjust the analysis and apply its suggestion, open it in the hosted triage UI, or run in your a2ui checkout:

tools/internal/triage/triage_ui.sh https://github.com/a2ui-project/a2ui/pull/4537
For software
<a2ui>
root = TriageAnalysis(
  tldr="""Case: this external PR fixes the `web_core` null-handling bug in [#4525](https://github.com/a2ui-project/a2ui/issues/4525), with tests.
Suggestion: assign for triage to `gspencergoog`.""",
  summary="""On v0.9 and v0.9.1 surfaces, the PR makes `MessageProcessor` store an explicit `null` that `updateDataModel` sets at a non-root path, instead of removing the key. It adds tests for v0.9, v0.9.1 and v1.0, and a changelog entry.""",
  reason="This PR has no assignee.",
  suggestion="""- Good candidate: a small bug fix with tests that closes [#4525](https://github.com/a2ui-project/a2ui/issues/4525). It passes `preserveNull` in [`processUpdateDataModelOp`](https://github.com/a2ui-project/a2ui/blob/9319cedd44ba9b0739afc5d2cf65460c9abe63b4/typescript/core/web_core/src/processing/message-processor.ts#L1869), as [`DataContext.set`](https://github.com/a2ui-project/a2ui/blob/9319cedd44ba9b0739afc5d2cf65460c9abe63b4/typescript/core/web_core/src/resolution/data-context.ts#L517-L518) does. No merge conflicts.
- `gspencergoog` wrote [10 of the last 20 commits](https://github.com/a2ui-project/a2ui/commits/main/typescript/core/web_core/src/processing/message-processor.ts) to `message-processor.ts`, and [#3658](https://github.com/a2ui-project/a2ui/pull/3658), which added `preserveNull` to `DataContext.set`.
- Open [#4452](https://github.com/a2ui-project/a2ui/pull/4452) adds a line to the same function, in a separate hunk.
- The author offers to fix the same gap in the [`createSurface` data model](https://github.com/a2ui-project/a2ui/blob/9319cedd44ba9b0739afc5d2cf65460c9abe63b4/typescript/core/web_core/src/processing/message-processor.ts#L1325) separately.""",
  reply="""Thanks for the fix and the tests. Assigning this PR to `gspencergoog`, who maintains `message-processor.ts`, to decide on it. They can also say whether the [`createSurface` initial data model](https://github.com/a2ui-project/a2ui/blob/9319cedd44ba9b0739afc5d2cf65460c9abe63b4/typescript/core/web_core/src/processing/message-processor.ts#L1325) should get the same change in a follow-up.""",
  added_labels=["type: bug", "component: core sdk", "lang: typescript", "status: assigned-for-triage"],
  new_assignees=["gspencergoog"],
  targeted_issues=[4525],
  related_items=[3658, 4452]
)
</a2ui>

This analysis does not change after taking the later submitted comments into account: a merge of main into the PR by AndresDvst, which resolves a conflict in the web_core CHANGELOG.md.

This analysis is auto-created to help humans to triage this item. Please, do not treat it as a team decision.

@polina-c
polina-c enabled auto-merge (squash) December 3, 2026 18:45
@polina-c

polina-c commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator

From triage bot, analysis:

For humans

TL;DR
Case: polina-c already started reviewing this external PR, which fixes #4525.
Suggestion: assign polina-c.

Summary:
On v0.9 and v0.9.1 surfaces, the PR makes MessageProcessor store an explicit null that updateDataModel sets at a non-root path, instead of removing the key. It adds tests for v0.9, v0.9.1 and v1.0, and a changelog entry.

Targeted issues:
#4525

Why flagged for triage:
This PR has no assignee.

Suggestion:

  1. Add labels: type: bug, component: core sdk, lang: typescript
  2. Assign: polina-c
  3. Related items: fix(web_core,angular,lit): restore pre-1.0 call sites broken by the 1.0 API #3658, fix(web_core): reject a message whose version is not its surface's #4452

Reply:

From triage:

Thanks for the fix and the tests. Assigning this PR to polina-c, because they already started reviewing it.

To adjust the analysis and apply its suggestion, open it in the hosted triage UI, or run in your a2ui checkout:

tools/internal/triage/triage_ui.sh https://github.com/a2ui-project/a2ui/pull/4537
For software
<a2ui>
root = TriageAnalysis(
  tldr="""Case: `polina-c` already started reviewing this external PR, which fixes [#4525](https://github.com/a2ui-project/a2ui/issues/4525).
Suggestion: assign `polina-c`.""",
  summary="""On v0.9 and v0.9.1 surfaces, the PR makes `MessageProcessor` store an explicit `null` that `updateDataModel` sets at a non-root path, instead of removing the key. It adds tests for v0.9, v0.9.1 and v1.0, and a changelog entry.""",
  reason="This PR has no assignee.",
  suggestion="""- `polina-c` [approved](https://github.com/a2ui-project/a2ui/pull/4537#pullrequestreview-6176207194) the PR and [merged `main`](https://github.com/a2ui-project/a2ui/pull/4537/commits/dea62b4cfa5634ebc392af8c806d124f7a2dd96c) into it, so the team decided to review it.
- [#4525](https://github.com/a2ui-project/a2ui/issues/4525), which the PR closes, has no assignee either: assign `polina-c` there too.
- The fix passes `preserveNull` in [`processUpdateDataModelOp`](https://github.com/a2ui-project/a2ui/blob/9319cedd44ba9b0739afc5d2cf65460c9abe63b4/typescript/core/web_core/src/processing/message-processor.ts#L1869) as [`DataContext.set`](https://github.com/a2ui-project/a2ui/blob/9319cedd44ba9b0739afc5d2cf65460c9abe63b4/typescript/core/web_core/src/resolution/data-context.ts#L517-L518) does since [#3658](https://github.com/a2ui-project/a2ui/pull/3658).
- Open [#4452](https://github.com/a2ui-project/a2ui/pull/4452) also edits `message-processor.ts`, so one of them may need a merge.""",
  reply="""Thanks for the fix and the tests. Assigning this PR to `polina-c`, because they already started reviewing it.""",
  added_labels=["type: bug", "component: core sdk", "lang: typescript"],
  new_assignees=["polina-c"],
  targeted_issues=[4525],
  related_items=[3658, 4452]
)
</a2ui>

This analysis is auto-created to help humans to triage this item. Please, do not treat it as a team decision.

@polina-c
polina-c merged commit cb2ca8b into a2ui-project:main Dec 3, 2026
55 of 56 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: needs-triage auto-managed: https://github.com/a2ui-project/a2ui/blob/main/scripts/triage.mjs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: web_core: MessageProcessor.processUpdateDataModelOp omits preserveNull on pre-1.0 surfaces

2 participants