Commit 49feaef
committed
fix(server): defensive copy before hook call eliminates in-place mutation footgun
Pass dict(params) to pre_validation_hook so hooks that mutate their
argument in-place still leave raw_params (the context-echo snapshot)
untouched. The "must return a new dict" restriction is removed from
docstrings; either mutation style is now safe.
Adds test_in_place_mutation_is_safe_for_context_echo to prove the
invariant. Adds a docstring cross-reference to #623 for the account-omission
case per adopter feedback on #629.
Co-authored-by: bokelley <bokelley@users.noreply.github.com>
https://claude.ai/code/session_0115Pruuy4MbdaxhPvgTBFoo1 parent a7afcbb commit 49feaef
3 files changed
Lines changed: 48 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
452 | 452 | | |
453 | 453 | | |
454 | 454 | | |
455 | | - | |
456 | | - | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
457 | 458 | | |
458 | 459 | | |
459 | 460 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1901 | 1901 | | |
1902 | 1902 | | |
1903 | 1903 | | |
1904 | | - | |
1905 | | - | |
1906 | | - | |
1907 | | - | |
1908 | | - | |
1909 | | - | |
| 1904 | + | |
| 1905 | + | |
| 1906 | + | |
| 1907 | + | |
| 1908 | + | |
| 1909 | + | |
| 1910 | + | |
| 1911 | + | |
| 1912 | + | |
| 1913 | + | |
1910 | 1914 | | |
1911 | 1915 | | |
1912 | | - | |
1913 | | - | |
1914 | | - | |
| 1916 | + | |
| 1917 | + | |
| 1918 | + | |
| 1919 | + | |
| 1920 | + | |
| 1921 | + | |
| 1922 | + | |
1915 | 1923 | | |
1916 | 1924 | | |
1917 | 1925 | | |
| |||
1960 | 1968 | | |
1961 | 1969 | | |
1962 | 1970 | | |
1963 | | - | |
| 1971 | + | |
1964 | 1972 | | |
1965 | 1973 | | |
1966 | 1974 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
176 | 202 | | |
177 | 203 | | |
178 | 204 | | |
| |||
0 commit comments