forked from datafold/data-diff
-
Notifications
You must be signed in to change notification settings - Fork 1
docs: document Compiler shared-state semantics (attrs.evolve + _subqueries) #47
Copy link
Copy link
Open
Labels
P2-mediumMedium priority, next 1-2 monthsMedium priority, next 1-2 monthsdocumentationImprovements or additions to documentationImprovements or additions to documentationtriage
Description
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:
Compilerclass explaining the shared-state contractattrs.evolvecall site explaining why shallow copy is intentional_subqueriesdict explaining the CTE bubbling mechanism
Key Files
data_diff/databases/base.py:127(_subqueries)data_diff/databases/base.py:260(evolve call)
Acceptance Criteria
- Compiler shared-state semantics documented in code
- Future contributors understand the isolation boundary
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P2-mediumMedium priority, next 1-2 monthsMedium priority, next 1-2 monthsdocumentationImprovements or additions to documentationImprovements or additions to documentationtriage