Skip to content

Commit 8595bf5

Browse files
committed
fix(config,test): address remaining CodeRabbit review findings
- config.py: in _type_based_merge, when a dict overlay hits a scalar/list at the same key, normalize base[key] and provenance[key] to empty dicts before recursing instead of short-circuiting with `continue`. The old approach left provenance[key] as a string, which would crash a subsequent dict-merge on the same key with TypeError. - test_default_agent.py: replace the full-prompt inline_snapshot in test_default_agent with four targeted substring assertions covering the Product Identity invariants (section header, product name, developer, and the no-model-name rule). The builtin_types snapshot is unchanged.
1 parent 4eb94fe commit 8595bf5

2 files changed

Lines changed: 10 additions & 307 deletions

File tree

src/pythinker_code/config.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -159,12 +159,12 @@ def _type_based_merge(
159159
"""
160160
for key, value in overlay.items():
161161
if isinstance(value, dict):
162-
# If base holds a scalar/list for this key, the overlay dict wins outright
163-
# (recursing into a non-dict crashes with TypeError before validation runs).
162+
# Normalize any scalar/list at this key to an empty dict before recursing;
163+
# recursing into a non-dict crashes with TypeError, and leaving provenance[key]
164+
# as a string would crash a subsequent dict-merge on the same key.
164165
if key in base and not isinstance(base[key], dict):
165-
base[key] = value
166-
provenance[key] = scope
167-
continue
166+
base[key] = {}
167+
provenance[key] = {}
168168
# For dicts, always recurse to track individual nested keys
169169
if key not in base:
170170
base[key] = {}

0 commit comments

Comments
 (0)