Repository navigation
Express data updates: how do we change individual fields without replacing unrelated data? #3361
Unanswered
contextablemark
asked this question in
Q&A
Replies: 2 comments 1 reply
|
the current python compiler has an explicit rule for this
so splitting nested updates into separate surface scopes preserves their scope but doing that for for a top level field the direct json update at this confirms the current behavior rather than whether it is the intended long term design |
0 replies
|
Thanks for bringing this up, I suspect this is a legit issue of the Express format; I'll convert this into an issue so we can track work against that! |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
We’d like to clarify how Express assignments are intended to update an existing surface’s data.
In our Python SDK tests, a single assignment to a top-level field produced a root-level data replacement, while a single assignment to a nested field produced a targeted update. We found upstream conformance tests expecting root replacement, so we’re raising this as a design clarification rather than assuming it is an implementation bug.
Example 1: changing a top-level field
Suppose surface
bookingstarts with this data:{ "status": "Pending", "user": { "name": "Grace", "email": "grace@example.com" } }We want to change the booking status:
In the case we tested, the relevant generated A2UI operation is:
{ "version": "v1.0", "updateDataModel": { "surfaceId": "booking", "path": "/", "value": { "status": "Booked" } } }Applying that operation replaces the data at
/, leaving:{ "status": "Booked" }The
userobject disappears, even though the Express assignment only mentionsstatus.For an interaction described as “change the booking status,” we would like to be able to preserve the other fields:
{ "status": "Booked", "user": { "name": "Grace", "email": "grace@example.com" } }The JSON protocol can express that through an update at
/status. Our question is how to request that behavior reliably through Express.Example 2: changing a nested field
Starting independently from the same original data, we change the traveler’s name:
In the single-nested-assignment case we tested, the relevant generated operation targets the field itself:
{ "version": "v1.0", "updateDataModel": { "surfaceId": "booking", "path": "/user/name", "value": "Ada" } }Applying this operation preserves the other fields:
{ "status": "Pending", "user": { "name": "Ada", "email": "grace@example.com" } }These examples suggest that the scope of replacement can depend on where the assigned field lives. We also observed root replacement with multiple assignments, so we do not assume that nested assignments always preserve unrelated values.
Questions
Why this matters
Interactive panels may contain values the user has edited locally. Repeating the entire data object requires the agent to know all current values and can overwrite edits if its view is stale.
A clear way to distinguish changing selected fields from replacing an object would help applications and models generate updates predictably. We’d appreciate guidance on the intended behavior and any existing syntax or documentation that addresses these cases.
Related discussions
We found these related threads, but none appeared to address Express assignment behavior directly:
We’re asking how to express these intentions through Express with the current protocol; we’re not assuming a protocol redesign is necessary.
All reactions