You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SelectReferenceResolver (706 lines) now handles eight responsibilities. The CTE pre-pass (ResolveCtes, RewriteCteReferences, WrapCteTable, ResolveNonRecursiveSetOperationTerms, ResolveRecursiveTerms) is ~200 lines substantially independent of the column-reference logic — they share only the read-only constructor parameters.
Both classes are internal, so this is not a NuGet surface concern.
Proposed Work
Extract CTE resolution to internal class CteReferenceResolver in src/Core/Utils/CteReferenceResolver.cs. SelectReferenceResolver.ResolveTablesDatabase calls new CteReferenceResolver(...).Resolve(sqlSelectDefinition, outerTablesInScope) at its head and receives back the populated outerTablesInScope (CTEs added) before proceeding to column resolution.
Acceptance Criteria
All 1279 existing tests pass without change
SelectReferenceResolver is under 550 lines
CteReferenceResolver is under 250 lines
Both classes remain internal
CTE resolution integration tests in AnsiSqlScenarioTests.cs pass
Discovered by: /uber-report 2026-05-10 (SqlBuildingBlocks Architect)
Context
SelectReferenceResolver(706 lines) now handles eight responsibilities. The CTE pre-pass (ResolveCtes,RewriteCteReferences,WrapCteTable,ResolveNonRecursiveSetOperationTerms,ResolveRecursiveTerms) is ~200 lines substantially independent of the column-reference logic — they share only the read-only constructor parameters.Both classes are
internal, so this is not a NuGet surface concern.Proposed Work
Extract CTE resolution to
internal class CteReferenceResolverinsrc/Core/Utils/CteReferenceResolver.cs.SelectReferenceResolver.ResolveTablesDatabasecallsnew CteReferenceResolver(...).Resolve(sqlSelectDefinition, outerTablesInScope)at its head and receives back the populatedouterTablesInScope(CTEs added) before proceeding to column resolution.Acceptance Criteria
SelectReferenceResolveris under 550 linesCteReferenceResolveris under 250 linesinternalAnsiSqlScenarioTests.cspass