Skip to content

refactor: port CLI commands, progress and output, rules pieces and cursor arithmetic to the native extension - #1101

Merged
kvlonge merged 29 commits into
mainfrom
feat/native-group-2
Oct 13, 2026
Merged

kvlonge merged 29 commits into
mainfrom
feat/native-group-2

Conversation

@kvlonge

@kvlonge kvlonge commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

Why

Rust-hosted SQLBuild port (CHI-585), second combined PR: Phase 3 (CHI-592) CLI commands and output, plus Phase 1 (CHI-589) rules/lint pieces and the first Phase 4 (CHI-593) piece.

Changes

  • CLI: integration-result records; lifecycle progress; sqb scope, lineage, rename/mv, janitor, freshness, debug, playground (templates moved to src/sqlbuild/playground_templates/), skills; command connection and warehouse resolution; cost store and reports; presentation helpers.
  • Phase 1: DSL header lint/format, rules result rendering, custom-rule evidence, typed config readers.
  • Phase 4: new sqlbuild-cursor crate for microbatch cursor and range arithmetic.
  • Movable Python: 103,112 → 89,820 lines.

Intentional differences: some traceback frames on error paths; --depth rejects 1_0; stricter run.json reading; integer cursors above ~1.7e38 overflow; internal Python APIs removed or renamed.

Verification

  • Workers compared old vs new real CLI runs per command (scope 32, lineage 18, rename/mv 14 with project trees, janitor 28 with warehouse state, freshness 33, debug 19, playground/skills 28 incl. 5,731 written files, cost 357 steps, 611 integration records): identical apart from noted differences.
  • 203,563 cursor cases and 2,512 header inputs vs the old Python: 0 mismatches.
  • 10,772 focused tests incl. ~20 e2e files; compiler differential with full coverage; byte-identical compile output on a 1k-model and a large private project; make check-ci.
  • Independent review: no findings.

…tively

Move the lifecycle progress projector, the connection and planning progress
reporters, the verbose inspection writer, execution headers and SQL
expectation rows into the native extension and delete the Python they
replace.
Load the offline scope index, qualify bare targets, run the scope query and
render its text in Rust, route sqb scope to the native handler, and delete
the Python command, target and output modules.
Header scanning, body ranges, the header lint rules (parse, description
presence and length, trailing whitespace) and the header formatting fixes
(whitespace, leading-comment relocation, description and audit wrapping)
run natively in sqlbuild-rules, reproducing Python's textwrap and string
semantics. Header values are still parsed by parse_header_values. Delete
the Python header scanner and native header rules.
…ively

Rules result text and JSON rendering and the SQBRSQL044 duplicate-literal
hints run natively in sqlbuild-rules, with PurePosixPath ordering and
json.dumps output reproduced exactly. Delete the Python implementations.
Select relation and column lineage, read and write the structural cache,
and render tree, list and JSON output in Rust, route sqb lineage to the
native handler, resolve rename and move targets with the native target
reader, and delete the Python lineage command, selection, cache and output
modules.
Read the target, build planner facts and the declaration placement host,
plan, stage, verify, migrate and commit in Rust, render the edit tree,
the layer-move suggestion and the JSON report natively, route rename and
mv to the native handler, and delete the Python command, facts, output,
target and plan-decoding modules. The offline compile stays in Python.
Resolve the invocation and settings, render the plan preview, --as
preview framing, confirmation prompt and completion summary in Rust, and
route sqb janitor to the native handler. Compilation, warehouse
connection, planning and cleanup stay in the Python janitor runtime.
Custom-rule import closures, implementation fingerprints and statically
associated harness test cases are read natively with the CPython-mirrored
ruff tree in sqlbuild-pysource. Loading and running custom rules stays in
Python. Delete the Python evidence module.
The typed authored-config readers (string, boolean, integer, string tuple
and cursor bound) run natively and raise the same ConfigValueTypeError.
Delete the Python helper and its five public wrappers; callers import the
readers from sqlbuild._native.
Cursor parsing, rendering, comparison, grain flooring and stepping,
observed partitions, interval clamping, merging, batch splitting, caps,
interval validation and calendar durations run in the new plain-Rust
sqlbuild-cursor crate with thin bindings. Python datetime objects stay at
the boundary: results keep the input's datetime type and tzinfo, fixed
offsets are computed natively and other zones are resolved through the
input tzinfo. The cursor value models, sentinels and grain constants stay
in Python; callers import the functions from sqlbuild._native.
@kvlonge
kvlonge enabled auto-merge (squash) October 13, 2026 15:08
@kvlonge
kvlonge merged commit 74fcac8 into main Oct 13, 2026
76 of 78 checks passed
@kvlonge
kvlonge deleted the feat/native-group-2 branch October 13, 2026 16:58
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.

1 participant