Skip to content

refactor: read native record fields directly across the bindings - #1123

Merged
kvlonge merged 5 commits into
mainfrom
feat/chi599-batch-7
Oct 17, 2026
Merged

kvlonge merged 5 commits into
mainfrom
feat/chi599-batch-7

Conversation

@kvlonge

@kvlonge kvlonge commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Why

Rust still read SQLBuild's own native records through the Python attribute protocol at thousands of sites, and rule planning and dispatch still went through module lookups.

Changes

  • Native record fields are read directly from the record's stored values through one helper; anything that is not a native record falls back to a normal attribute read. Applied across the bindings except the compile driver.
  • Rule planning, dispatch, catalogue, selection, results and fix sessions read native records and call native helpers directly.
  • Rules config and custom-rule payload JSON are produced in Rust, with the previous Python path kept for values only Python encodes.
  • SQL test, fixture schema and SQL rule model inputs are read from native facts.

Verification

  • make test and make check-ci passed with all optional dependencies available.
  • DuckDB E2E command suites passed (1,636 of 1,637; the remaining interrupt-timing test is a pre-existing intermittent failure being fixed separately).
  • Compiler differential: 371 projects, unchanged goldens. Planner differential: 11 projects matched a fresh main baseline.
  • Windows cross-check passed. Independent review checked every rewritten site against the original receiver; no blocking findings.

SQL rules read each compiled model's relative path, sql_analysis opt-out,
authored and expanded SQL and dynamic pivot proof from the native facts
and analysis instead of Python attributes. The proof's cache-key text is
encoded natively as the same sorted compact JSON json.dumps produced, so
SQL rule cache keys are unchanged; hand-built models keep reading their
record fields.
Native records now keep their class layout, so records::fields::field
reads a declared field straight from the record's values without the
Python attribute protocol, falling back to getattr for other objects.
SQL test and scenario facts and the fixture-format schemas read their
inputs this way, and discovered model files' paths, header values and
column locations through the native model file record.
Rule planning, dispatch, catalogue selection, finalization, results and
format --fix now read native record fields in place, rebuild records with
records::fields::replaced instead of dataclasses.replace, and call the
rule helpers (plan, SQL rules, finish, finalize, selection, catalogue,
compiled project builds) directly instead of through module attributes.
Rules configurations and custom payloads encode natively as the JSON the
selection and request paths parsed, falling back to Python's encoder for
values only it spells (non-finite or wide numbers, non-text keys).
Duplicate-literal hints read finding files natively, and project views
answer settings, scenarios and scope index reads from stored fields.
…records

SQL rule runs, lint settings and compiled expansions, rule guidance,
early SQL lint planning and fix-verification facts read native record
fields in place, and project views answer diagnostics reads from their
stored fields.
@kvlonge
kvlonge enabled auto-merge (squash) October 17, 2026 00:01
@kvlonge
kvlonge merged commit bbcfd7a into main Oct 17, 2026
40 checks passed
@kvlonge
kvlonge deleted the feat/chi599-batch-7 branch October 17, 2026 00:38
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