| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Merge #6314 PiperOrigin-RevId: 943391685
|
Thank you @VectorPeak for your contribution! 🎉 Your changes have been successfully imported and merged via Copybara in commit 6b385e4. Closing this PR as the changes are now in the main branch. |
Sorry, something went wrong.
Merge google#6314 PiperOrigin-RevId: 943391685
| Back | FazBrowse Home | New Git URL |
Please ensure you have read the contribution guide before creating a pull request.
Link to Issue or Description of Change
1. Link to an existing issue (if applicable):
2. Or, if no issue exists, describe the change:
Problem:
Event._accept_convenience_kwargs() routes convenience inputs such as message, state, route, and node_path into the model's canonical nested fields. It currently does that by calling pop() directly on the data mapping received by the mode="before" model validator.
The before validator receives a dict in both common entry paths:
That second path is the bug: the issue is not just that a dict can theoretically reach the validator, but that the public model_validate(dict) API can hand the validator the same mapping object still owned by the caller.
A minimal reproduction before this fix:
Before the fix, payload is rewritten in place. That can surprise callers that reuse the same mapping for logging, retries, comparisons, or subsequent validation.
Solution:
Copy the incoming mapping before consuming convenience keys. This keeps the existing convenience-key routing behavior unchanged while ensuring Event.model_validate() does not mutate caller-owned input.
The change is intentionally narrow:
Testing Plan
Unit Tests:
Passed targeted unit tests locally:
Additional local checks:
Manual End-to-End (E2E) Tests:
Not applicable for this validator-level change. The regression is covered by a focused unit test that exercises the public Event.model_validate() path and verifies both behaviors: the caller-provided payload remains unchanged, and the resulting Event still receives content, actions.state_delta, actions.route, and node_info.path.
Checklist
Additional context
This PR does not remove the existing pop()-based convenience-key routing. It only makes the validator operate on a local copy, so the canonical event output remains unchanged while avoiding a top-level mutation of caller-provided dictionaries.