Do not mutate the input map in SwitchTransformer.switchTransformer#696
Conversation
72d8535 to
99572a8
Compare
|
Hello @vasiliy-mikhailov |
de84ea2 to
ae6381e
Compare
|
Thanks @garydgregory, and sorry for the red build. You're right that the full suite wasn't run. Honest root cause: I prepare these changes with an AI pipeline, and it had a bug where a fix could be recorded as "verified" from a bare I've fixed the pipeline so a fix is only treated as verified when there is a real green test run (actual |
switchTransformer(Map) extracted the default with map.remove(null), which removes the null key from the caller list map as a side effect. Use map.get(null) so the factory method leaves the input map unchanged.
ae6381e to
f9dac2c
Compare
|
Hello @vasiliy-mikhailov
? |
SwitchTransformer.switchTransformer(Map)extracts the default transformer withmap.remove(null), which mutates the caller's map by removing its null key entry — a surprising destructive side effect from a factory method. Usemap.get(null)instead so the input map is left unchanged.Added a test asserting the input map is not mutated.
AI assistance disclosure
This contribution was produced with the help of an AI pipeline. The pipeline processed a large amount of source code to surface suspected bugs, reproduced a subset of them with failing unit tests and generated candidate fixes, and prepared pull requests from the ones that held up. Each PR was then reviewed and verified by a human before being opened: the fix and test were checked by hand and the test was confirmed to fail before the change and pass after.