Repository navigation
fix(web_core): store null from updateDataModel on pre-1.0 surfaces - #4537
Conversation
`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
There was a problem hiding this comment.
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.
|
From triage bot, analysis: For humansTL;DR Summary: Targeted issues: Why flagged for triage: Suggestion:
Reply:
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/4537For softwareThis analysis does not change after taking the later submitted comments into account: a merge of This analysis is auto-created to help humans to triage this item. Please, do not treat it as a team decision. |
…ull-pre-1.0 # Conflicts: # typescript/core/web_core/CHANGELOG.md
|
From triage bot, analysis: For humansTL;DR Summary: Targeted issues: Why flagged for triage: Suggestion:
Reply:
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/4537For softwareThis analysis is auto-created to help humans to triage this item. Please, do not treat it as a team decision. |
Problem
Fixes #4525.
On pre-1.0 surfaces (v0.9 and v0.9.1), an
updateDataModelmessage that sets anon-root path to
nullremoves the key from the data model instead of storingnull.MessageProcessor.processUpdateDataModelOpcallsDataModel.set(path, value)without
preserveNull, whileDataContext.setalready passes it for pre-1.0surfaces, so the same write behaves differently depending on where it comes from.
Changes
processUpdateDataModelOpcomputespreserveNullwith the same expression asDataContext.set(protocolVersionset and below1.0) and passes it toDataModel.set. v1.0 surfaces, surfaces without a version, and root-pathwrites behave as before.
message-processor.test.ts: a null at a non-root path is stored onv0.9 and v0.9.1 surfaces (both failed before the change), and the key is
still removed on a v1.0 surface.
## Unreleasedintypescript/core/web_core/CHANGELOG.md.v0.8 is not tested here: its adapter rejects a
nullcontent value before itreaches
updateDataModel.Possible follow-up, not changed here to keep the scope to the issue: the
createSurfaceinitialdataModelpath (message-processor.ts, thesurface.dataModel.set(path, value)call for non-empty keys) also omitspreserveNull, so a pre-1.0 initial{"x": null}dropsx. Happy to open aseparate issue or PR if you want that aligned too.
Local checks in
typescript/core/web_core:yarn test(build, conformance andunit tests: 1698 passed), eslint (0 errors on the touched files) and prettier.
Pre-launch Checklist
One time:
For this PR:
No documentation change is needed (no documented behaviour changes). I could not
run
scripts/e2e_test.shor 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