Repository navigation
Fix JSON decoding of nested dictionary environment values - #1109
Conversation
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — Preserves dictionary value types so nested environment values receive JSON decoding at the intended level. Focused regression coverage and unchanged source-access behavior keep the change's risk limited. Notes:
You can add or adjust custom eligibility rules. Learn more. |
|
AI-assisted supplemental regression evidence: this also fixes model-valued dictionary keys that coincide with the value model's field names or validation aliases, beyond the nested-container cases currently in the PR. For example, with I ran seven cases against actual base Pinned runnable probe, raw outputs and exact dependencies (evidence commit This gives an additional regression shape to consider for the PR tests. Focused evidence only, not a full review or platform-matrix claim; no duplicate fix PR. Update: I converted these into native tests in tests-only collaboration PR to your existing branch, code commit |
Move the regression test next to the other nested dict env tests and cover more shapes from pydantic#1107: Annotated value types, Optional dicts, dicts inside models (and models inside dicts), and dict keys that match a field name of the dict's value model. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PRaoYMkPxtZ35KHCmqCYHf
Dismissing prior approval to re-evaluate 74c01ae
|
Thanks @Hugohong258 |
For
dict[str, list[dict[str, str]]], an environment value such asAPP_VALUES__X='[{"k":"v"}]'reaches validation as a string.next_field()descends into the dictionary's type arguments before recognizing the dictionary itself, losing the value's container type. Handle the outer dictionary first so the value is decoded at the correct nesting level. Fixes #1107.Three new cases fail on the base and one control passes. With the change, the settings module passes 515 tests with 7 skips on Windows/Python 3.12.3; settings and nested-secret tests pass 577 with 1 skip on Linux/Python 3.14.4. Repository-wide Ruff lint/format and mypy (22 library files) pass using the lockfile tools. The broader Windows unit run excluding documentation examples has 1,276 passes, 11 skips and 6 failures while creating symlinks (WinError 1314); these cases pass in the Linux selection. Documentation examples and the full OS/interpreter matrix were not run.