Repository navigation
Fix Patch.update shared mapping ownership - #4144
peterolkhov wants to merge 1 commit into
Conversation
|
|
Thanks for the PR! Our team will take a look and follow up. |
T4rk1n
left a comment
There was a problem hiding this comment.
Fix is right: copying E before merging stops the bug from the issue, and it also stops a later edit to the caller's dict from changing a merge that's already queued. Nothing blocks merge. The notes below are test cleanups.
| data = json.loads(raw_data) | ||
| return all("amount" in data.get(month, {}) for month in ("jan", "feb")) | ||
|
|
||
| until(data_received, timeout=3) |
There was a problem hiding this comment.
The data_received poll plus the second Pre is more than this needs. JSON.stringify output is deterministic here, so dash_duo.wait_for_text_to_equal("#records-json", '{"jan":{"retained":1,"currency":"USD","amount":100},"feb":{"retained":2,"currency":"USD","amount":200}}') covers it in one line. Can you switch to that and drop the helper?
|
|
||
| @app.callback( | ||
| Output("records", "data"), | ||
| Output("common-json", "children"), |
There was a problem hiding this comment.
The common-json output only checks that the input dict wasn't changed, and test_pat022 already covers that without a browser. Can you drop it so this test only checks the Store result?
| ] | ||
|
|
||
|
|
||
| def test_pat025_patch_update_union(): |
There was a problem hiding this comment.
test_pat024 and test_pat025 pass on dev too, so they don't cover the fix. The other case the copy fixes is changing the dict after the call: p.update(common), then common["x"] = 1, used to change the queued merge. Can you add that check here (or replace test_pat025 with it)?



Fixes #4143
Reusing one dictionary for two
Patch.updatecalls with different keywords currently changes the first queued merge when the second call runs. In a running Store callback, January and February both receive200 instead of100/200, and the input dictionary is changed too.Copy the top-level dictionary before merging keywords. Nested values stay shallow and keywords keep precedence. The fix is one production line, with unit controls and a permanent
dash_duoregression checking the actual Store output.Native validation:
Codex generated the implementation, tests and description. Tests ran on the exact source commit in standard GitHub-hosted runners; no local or human review is claimed. The full integration suite was not run, per the project's instruction to use specific files. Unit skips are recorded in the linked logs.