refactor phase 3b: split ops.py — package conversion + compile strategies extracted - #299
Merged
Merged
Conversation
hussainsultan
force-pushed
the
refactor/phase3-core-knot
branch
from
August 18, 2026 23:15
c80ade6 to
ecd25f5
Compare
hussainsultan
force-pushed
the
refactor/phase3b-ops-split
branch
from
August 18, 2026 23:15
42c8229 to
ee75f26
Compare
hussainsultan
force-pushed
the
refactor/phase3-core-knot
branch
from
August 18, 2026 23:26
ecd25f5 to
e9d512b
Compare
hussainsultan
force-pushed
the
refactor/phase3b-ops-split
branch
from
August 18, 2026 23:26
ee75f26 to
39183ce
Compare
hussainsultan
force-pushed
the
refactor/phase3-core-knot
branch
from
August 18, 2026 23:37
e9d512b to
016622a
Compare
hussainsultan
force-pushed
the
refactor/phase3b-ops-split
branch
from
August 18, 2026 23:37
39183ce to
abff27b
Compare
Mechanical stage 1 of the split: ops.py moves to ops/_core.py verbatim (relative imports adjusted one level), and ops/__init__.py becomes the stable import surface — explicit re-exports of every name any module or test pulls from boring_semantic_layer.ops, with a __getattr__ fallback to _core so the zone-by-zone split can never break an importer. Full suite green; SQL snapshots byte-identical. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
_patch_xorq_sortkey_compat, _ensure_xorq_table, _connection_identity, _rebind_to_backend, _rebind_to_canonical_backend move verbatim out of _core.py into their own leaf module. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
ColumnTracker, ColumnExtractionResult, JoinColumnExtractionResult, _make_tracking_proxy, _extract_columns_from_callable, _extract_join_key_columns move verbatim out of _core.py; a stale banner comment from the deleted requirements cluster goes with them. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The phase-2-deferred ReductionKind consolidation: _reductions_for_expr plus the mean/count/count-distinct sniffers, re-aggregation op selection, and count-identity fills move verbatim into one leaf module — the single answer to 'how does this reduction re-aggregate from a finer pre-aggregate'. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The value types plus _CallableWrapper/_ensure_wrapped, _is_deferred, _reject_bool_resolution, the dimension proxies, and the column-error formatter move verbatim into their own module. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…allocation) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
SemanticAggregateOp's strategy methods move out of _core.py as functions taking the op: - _compile_preagg.py (1,288 ln): fan-out-safe source-grain pre-aggregation + the dimension-bridge re-join helpers and calc-spec application - _compile_deferred.py (235 ln): aggregate-first + deferred dimension LEFT JOINs - _compile_nest.py (86 ln): nest= aggregate entries Strategy modules import _core downward; the op methods dispatch through a call-time module accessor, keeping the import graph acyclic (ratchet green). Bodies moved verbatim (self -> op); the # --- N. phase decomposition of the preagg pipeline is the follow-up, now against a 1,288-line module instead of a 7,700-line one. Full suite green (1703 passed, exit 0); SQL snapshots byte-identical. _core.py: 7,720 -> 5,369 lines. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
hussainsultan
force-pushed
the
refactor/phase3b-ops-split
branch
from
August 18, 2026 23:43
abff27b to
d3c17e3
Compare
hussainsultan
marked this pull request as ready for review
August 18, 2026 23:48
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase 3b of the SCC-driven refactor, stacked on #298. The 7,720-line
ops.pymonolith becomes anops/package: five helper zones and the three compile strategies move into focused modules, all as verbatim moves — every commit is green on the full suite and the SQL snapshots are byte-identical throughout._core.pyshrinks 7,720 → 5,369 lines.Shape
Stage 1 — package conversion.
ops.py→ops/_core.pyverbatim;ops/__init__.pyis the stable import surface (explicit re-exports of every name any module or test pulls fromboring_semantic_layer.ops, plus a__getattr__fallback to_core), so the split can never break an importer.Stage 2 — helper zones out of
_core, one commit each:_compat.py— xorq/plain-ibis backend interop (conversion, connection identity, backend rebinding)_tracking.py— projection-pushdown column tracking (ColumnTracker & friends)_reductions.py— the phase-2-deferred ReductionKind consolidation: reduction sniffers, re-aggregation op selection, count-identity fills — one module answers "how does this reduction re-aggregate from a finer pre-aggregate"_values.py—Dimension/Measure/CalcMeasure,_CallableWrapper, the dimension proxies, column-error formatting_normalize.py— join/group-by input normalization and collision-free join-name allocationStage 3 — compile strategies out of
SemanticAggregateOp:_compile_preagg.py(1,288 ln) — fan-out-safe source-grain pre-aggregation, the dimension-bridge re-join helpers, calc-spec application_compile_deferred.py(235 ln) — aggregate-first + deferred dimension LEFT JOINs_compile_nest.py(86 ln) —nest=aggregate entriesStrategy modules import
_coredownward; the op methods dispatch through a call-time module accessor, so the import graph stays acyclic (the #298 ratchet stayed green through every commit — lazy in-package imports would have tripped it).What stays in
_coreand whyThe op classes are mutually referential (
SemanticJoinOp.index()constructsSemanticIndexOp; the join analysis helpers isinstance-check the op types and are called fromto_untaggeddispatchers), so the index cluster and the join-tree analysis belt can't leave without inverting those references — that's the next seam. The# --- N.phase decomposition of the preagg pipeline is deliberately not in this PR: everything here is a verbatim move, and the decomposition is behavior-adjacent surgery that deserves its own diff (phase 3c) — now against a 1,288-line module instead of a 7,700-line one, with the snapshot corpus as its gate.Verification
🤖 Generated with Claude Code