Problem
base.py:260 uses attrs.evolve(compiler, root=False) which produces a shallow copy. Child compilers share _subqueries, _table_context, and _counter with their parent. This is intentional — CTEs bubble up from nested compiles to the root WITH clause — but completely undocumented.
Any future change assuming evolve gives isolation will introduce bugs.
Scope
Add docstring/comments to:
Compiler class explaining the shared-state contract
attrs.evolve call site explaining why shallow copy is intentional
_subqueries dict explaining the CTE bubbling mechanism
Key Files
data_diff/databases/base.py:127 (_subqueries)
data_diff/databases/base.py:260 (evolve call)
Acceptance Criteria
Problem
base.py:260usesattrs.evolve(compiler, root=False)which produces a shallow copy. Child compilers share_subqueries,_table_context, and_counterwith their parent. This is intentional — CTEs bubble up from nested compiles to the root WITH clause — but completely undocumented.Any future change assuming
evolvegives isolation will introduce bugs.Scope
Add docstring/comments to:
Compilerclass explaining the shared-state contractattrs.evolvecall site explaining why shallow copy is intentional_subqueriesdict explaining the CTE bubbling mechanismKey Files
data_diff/databases/base.py:127(_subqueries)data_diff/databases/base.py:260(evolve call)Acceptance Criteria