refactor phase 1: dead-code deletion + SCC rim cuts (23 → 13 modules) - #296
Merged
Conversation
hussainsultan
marked this pull request as ready for review
August 18, 2026 23:05
get_ibis_module is the repo-wide ibis-flavor router (used by query, utils, ops, server, agents) and had nothing to do with nested-array compilation; importing it dragged nested_compile into every consumer. It now lives in _xorq.py (the bottom layer) together with _unwrap_table_proxy and null_safe_equal; the 14-line join_utils module is folded away. nested_compile re-exports get_ibis_module so the documented import path keeps working. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
agents/tools.py imported from_yaml from the package root instead of .yaml — the root __init__ lazily imports agents, so that one line made agents.tools, agents.backends.langgraph, AND boring_semantic_layer's __init__ mutually reachable with the core knot. SCC: 23 -> 20 modules. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
expr.py imported .chart at module level — core depending on a presentation extra, and the edge that closed the cycle keeping all six chart modules in the SCC (chart.utils reaches down into ops, which lazily reaches expr). The .chart() method now resolves the chart package at call time, pandas-.plot style. Core import no longer loads chart at all. SCC: 20 -> 14 modules. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The 11 @convert.register handlers were a parallel, drifted copy of the real to_untagged lowering with no caller anywhere in src or tests (the module was imported by __init__ solely 'to register dispatch handlers'). Only the resolver proxies (_Resolver, _AggResolver, _PrefixProxy) are used — convert.py shrinks 496 -> 117 lines, loses its ops import, and leaves the import SCC. SCC: 14 -> 13 modules. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
join_one/join_many/join_cross/filter_/group_by_/aggregate_/mutate_/ order_by_/limit_ were pure pass-throughs to the fluent methods — never exported from __init__, never documented, used by exactly one test (now rewritten fluent-style). api.py: 279 -> 124 lines; what remains (to_semantic_table, entity_dimension, time_dimension) is all public. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
expr_to_ibis_string / ibis_string_to_expr and their five source- introspection helpers (~170 lines in utils.py) were the pre-v2 'expressions as strings' serialization path, superseded by the structured resolver-tree codec. No production caller remained — only tests exercising the dead feature, which are removed with it. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
bfs, replace_nodes (real callers use the _xorq shim), to_node_safe, try_to_node, find_dimensions_and_measures, find_entity_dimensions, find_event_timestamp_dimensions, traverse_roots_with, extract_column_from_dimension and their private helpers had zero non-test callers. Their tests go with them; is_field/is_table_field stay (used by build_dependency_graph). graph_utils: 569 -> ~190 lines. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
hussainsultan
force-pushed
the
refactor/phase1-dead-code-and-scc-rim
branch
from
August 18, 2026 23:15
ce453f5 to
dfef20f
Compare
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 1 of the SCC-driven refactor, stacked on #295. Two workstreams: peel the strongly-connected component's periphery with mechanical edge cuts, and delete verified-dead code. The SCC ratchet from #295 enforces every cut. Full suite green (1686 passed; the count dropped from #295's 1707 by exactly the deleted dead-feature tests).
SCC rim cuts — 23 → 13 modules
agents/tools.pyimportedfrom_yamlfrom the package root instead of.yaml; since the root__init__lazily imports agents, that single line keptagents.tools,agents.backends.langgraph, andboring_semantic_layer's own__init__in the knot. One-line fix, 3 modules out.expr.pyimported.chartat module level: core depending on a presentation extra, and the edge closing the cycleexpr → chart → chart.utils → ops → (lazy) expr. The.chart()method now resolves the chart package at call time (pandas-.plotstyle); importing the core no longer loads chart at all (verified).opsimport._xorq.py—get_ibis_moduleis the repo-wide ibis-flavor router (used by query, utils, ops, server, agents) and had nothing to do with nested-array compilation; it moves to the bottom layer along with_unwrap_table_proxyandnull_safe_equal, and the 14-linejoin_utils.pyis folded away.nested_compilere-exportsget_ibis_moduleso the documented import path keeps working.The residual 13-module SCC is the core knot (
ops/expr/query/api/format/graph_utils/projection_utils/utils+serialization/*) — phase 2/3 territory.Dead-code deletion (~1,100 lines)
convert.py496 → 117 lines — the 11@convert.registerhandlers foribis.expr.sql.convertwere a parallel, drifted copy of the realto_untaggedlowering with no caller anywhere in src or tests (the module was imported by__init__solely "to register dispatch handlers"). Only the resolver proxies (_Resolver,_AggResolver,_PrefixProxy) survive.api.py279 → 124 lines — the nine functional wrappers (join_one,filter_,group_by_, …) were pure pass-throughs to the fluent methods: never exported, never documented, used by exactly one test (rewritten fluent-style). What remains is all public API.utils.py) —expr_to_ibis_string/ibis_string_to_exprand five source-introspection helpers were the pre-v2 serialization path, superseded by the structured resolver-tree codec; only tests of the dead feature referenced them, and those are removed with it.graph_utils569 → ~190 lines — nine dead exports removed (bfs,replace_nodes— real callers use the_xorqshim —to_node_safe,try_to_node, thefind_*family,traverse_roots_with,extract_column_from_dimension) plus their private helpers and tests.is_field/is_table_fieldstay (used bybuild_dependency_graph).Deliberately deferred
The three drifted twin test files (
tests/vsagents/tests/andchart/tests/copies oftest_semantic_mcp,test_mcp_json_parsing,test_chart) are not deduped here — each pair has diverged, so merging them is a test-by-test job, not a mechanical one. The publicgraph_bfsfamily stays exported; demoting it belongs with the API-surface phase's single deprecation batch.Verification
python3 -m pytest src/boring_semantic_layer: 1686 passed, 1 skipped, 11 xfailed, 4 xpassedruff check/ruff format --check: cleanchart; every deletion grep-verified caller-free before removal🤖 Generated with Claude Code