Skip to content

refactor: guard native bindings and read native views, properties and dicts directly - #1126

Merged
kvlonge merged 20 commits into
mainfrom
feat/chi599-strict-fields
Oct 17, 2026
Merged

kvlonge merged 20 commits into
mainfrom
feat/chi599-strict-fields

Conversation

@kvlonge

@kvlonge kvlonge commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Why

The bindings still read SQLBuild's own native views, record properties and dicts through Python, and nothing stopped new Python round trips from being added.

Changes

  • fensu guards for the bindings, each with per-file budgets that may only fall:
    • XSB072: Python crossings.
    • XSB073: Python-typed struct fields.
    • XSB074: tests patching sqlbuild._native.
  • Strict mode for test runs: a native field read that falls back to Python on SQLBuild's own classes fails unless it is on a committed allowlist. User runs are unaffected.
  • field() reads directly from Rust:
    • native pyclass getters, including macro-generated and get_all/#[pyo3(get)] attributes;
    • record properties;
    • Rust __getattr__ views.
  • Error classes are captured at module load.
  • Multi-line and intern! field chains are read natively.
  • Dict get, items and values go through the C API.
  • Lookups in stable stdlib modules are cached.
  • SQL test planning, model chains and background planning are direct calls with native stage counters; the tests use the counters instead of spies.

Verification

  • make test and make check-ci passed, with all optional dependencies available.
  • Planner differential matched a fresh main baseline.
  • A strict record run over make test and the DuckDB E2E suites produced the allowlist.
  • CI runs E2E and the compiler differential.

…d macro-generated and getattr views directly
@kvlonge
kvlonge enabled auto-merge (squash) October 17, 2026 07:21
@kvlonge
kvlonge disabled auto-merge October 17, 2026 09:15
@kvlonge
kvlonge enabled auto-merge (squash) October 17, 2026 09:15
@kvlonge
kvlonge merged commit 1729fce into main Oct 17, 2026
40 checks passed
@kvlonge
kvlonge deleted the feat/chi599-strict-fields branch October 17, 2026 10:46
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