Skip to content

refactor(debloat): execute domain debloat worksheets across builder, core, extensions, infra, and root APIs - #784

Merged
cofin merged 6 commits into
mainfrom
flow/domain-debloat
Sep 14, 2026
Merged

cofin merged 6 commits into
mainfrom
flow/domain-debloat

Conversation

@cofin

@cofin cofin commented Sep 13, 2026

Copy link
Copy Markdown
Member

Summary

Consolidate internals, remove obsolete private helpers, hoist call-time constants, and streamline module structures across builder, core, driver/adapters, extensions, infrastructure, and root APIs without altering public contracts or runtime behavior.

Changes

  • Builder:

    • Removed 9 unused _expected_result_type declarations and unused SQLResult imports.
    • Reused comparison factories (expr_eq, expr_neq, expr_gt, expr_gte, expr_lt, expr_lte, expr_not_like) from sqlspec.core.query_modifiers; simplified _handle_not_in_operator to wrap _handle_in_operator in exp.Not.
    • Removed redundant expr_type_map identity map in SQLFactory.__call__; narrowed internal _factory.py export list; reordered public factory and COPY API before call-time helpers.
    • Hoisted vector distance operator/metric maps and MySQL EXPLAIN format map to module Final constants; removed redundant SPANNER_DIALECTS branch in EXPLAIN rendering.
    • Hoisted Dialect import in _locking.py.
    • Relocated ReturningClauseMixin from _select.py to _dml.py, preserving canonical package re-exports.
  • Core & Driver/Adapters:

    • Eliminated redundant return ladder in _processor._coerce_parameter_types; hoisted SQLSpecError import and shared missing parameter validation logic across single and batch parameter mappings.
    • Extracted shared _EXPANDING_POSITIONAL_STYLES constant in _types.py for processor and converter while keeping _OCCURRENCE_KEYED_STYLES distinct.
    • Promoted _transform_cached_parameters to transform_cached_parameters across compiler, statement, driver, and tests.
    • Removed unused _resolve_log_adapter and trivial forwarder _needs_coercion_candidate in _common.py.
    • Removed dead _update_dialect_for_extensions in ADBC config and migrated tests to runtime extension state resolution.
    • Standardized runtime helper imports in PostgreSQL-family adapter configs directly from sqlspec.core.config_runtime.
    • Inlined last_cursor alias in SQLite driver and hoisted connection.execute error mapping before query branching.
    • Cleaned ADBC driver _ = kwargs placeholder and narration comments.
  • Extensions (ADK):

    • Removed unused _require_enabled, _effective_limit, and _log_operation helpers from memory store.
    • Removed unused _new_id helper and its uuid4 import from BigQuery ADK store.
    • Reordered artifact service public API before private helpers and hoisted datetime, timezone imports to module level.
  • Infrastructure & CLI:

    • Removed unused _sql_resource_root, _output_warning, and _column_exists_query.
    • Extracted migration echo closure factory in cli.py shared by upgrade and downgrade commands.
    • Consolidated duplicate revision creation/logging and error output helpers in migrations/commands.py.
    • Hoisted importlib in dialects/__init__.py; cleaned UUID and serializer imports in utilities.
  • Root API:

    • Reordered loader.py parameter declaration parsing after value objects; grouped public SQLFileLoader methods before private helpers.
    • Reordered service.py transaction helpers after public service classes.
    • Reordered config.py migration key validation before runtime-only helpers.
    • Directed typing.py optional loader imports to utils.module_loader.

Verification

  • make lint: clean exit 0 (Prek, Ruff check, Ruff format, slotscheck, Mypy, Pyright, Zizmor).
  • Unit tests: passed across builder (1,142 tests), core (2,648 tests), adapters (3,077 tests), ADK/root (699 tests), and infrastructure/CLI (1,805 tests).

@codecov-commenter

codecov-commenter commented Sep 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 87.34491% with 102 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.92%. Comparing base (6739420) to head (35486e5).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
sqlspec/extensions/adk/artifact/service.py 19.04% 34 Missing ⚠️
sqlspec/loader.py 93.40% 16 Missing and 13 partials ⚠️
sqlspec/builder/_factory.py 62.50% 9 Missing and 6 partials ⚠️
sqlspec/builder/_dml.py 62.50% 4 Missing and 2 partials ⚠️
sqlspec/utils/arrow_helpers.py 90.74% 2 Missing and 3 partials ⚠️
sqlspec/core/parameters/_processor.py 75.00% 2 Missing and 1 partial ⚠️
sqlspec/utils/schema.py 93.18% 2 Missing and 1 partial ⚠️
sqlspec/cli.py 84.61% 1 Missing and 1 partial ⚠️
sqlspec/migrations/commands.py 83.33% 2 Missing ⚠️
sqlspec/service.py 96.66% 2 Missing ⚠️
... and 1 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #784      +/-   ##
==========================================
+ Coverage   78.90%   78.92%   +0.02%     
==========================================
  Files         491      491              
  Lines       72443    72316     -127     
  Branches    10184    10165      -19     
==========================================
- Hits        57161    57077      -84     
+ Misses      11772    11734      -38     
+ Partials     3510     3505       -5     
Flag Coverage Δ
integration 62.42% <45.53%> (+0.05%) ⬆️
py3.10 77.05% <87.22%> (+<0.01%) ⬆️
py3.11 77.06% <87.22%> (+0.02%) ⬆️
py3.12 77.06% <87.22%> (+0.01%) ⬆️
py3.13 77.06% <87.22%> (+0.01%) ⬆️
py3.14 78.20% <87.20%> (+0.02%) ⬆️
unit 67.27% <86.35%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
sqlspec/adapters/adbc/config.py 93.52% <100.00%> (+0.23%) ⬆️
sqlspec/adapters/adbc/driver.py 79.72% <ø> (-0.06%) ⬇️
sqlspec/adapters/asyncpg/config.py 93.63% <100.00%> (+0.02%) ⬆️
sqlspec/adapters/bigquery/adk/store.py 65.25% <ø> (-0.15%) ⬇️
sqlspec/adapters/cockroach_asyncpg/config.py 91.90% <100.00%> (+0.04%) ⬆️
sqlspec/adapters/cockroach_psycopg/config.py 87.81% <100.00%> (ø)
sqlspec/adapters/psqlpy/config.py 92.81% <100.00%> (+0.03%) ⬆️
sqlspec/adapters/psycopg/config.py 90.26% <100.00%> (+0.02%) ⬆️
sqlspec/adapters/sqlite/driver.py 77.18% <100.00%> (+0.32%) ⬆️
sqlspec/builder/__init__.py 100.00% <ø> (ø)
... and 36 more

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cofin
cofin force-pushed the flow/domain-debloat branch from a64c15d to 7d1b774 Compare September 14, 2026 03:01
@cofin
cofin merged commit 47ed4b7 into main Sep 14, 2026
20 checks passed
@cofin
cofin deleted the flow/domain-debloat branch September 14, 2026 03:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants