Skip to content

refactor: move the front layer of the Python bindings into sqlbuild-python-front - #1516

Merged
kvlonge merged 4 commits into
mainfrom
refactor/python-front
Nov 16, 2026
Merged

kvlonge merged 4 commits into
mainfrom
refactor/python-front

Conversation

@kvlonge

@kvlonge kvlonge commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Why

sqlbuild-python is still far above the crate size limit. This third slice moves the front of the compile pipeline into a new crate, sqlbuild-python-front, between sqlbuild-python-base and sqlbuild-python.

Changes

  • New crate sqlbuild-python-front (144 modules): discovery, model configuration and headers, scopes, macro rendering and authored values, SQL text, model attachment and the compile driver, cursors, contract and refactor facts, and the consumption, observation and audit-result state tables. Same layout as the base crate.
  • sqlbuild-python imports from the front crate directly; there are no shims. Scripts rewrote imports, fensu.toml and tests/native_field_fallbacks.txt.
  • Three positional_record! calls in models.rs become plain structs with tuple conversions. NativeConfigError moves to errors.rs.
  • Locations::shared and HeaderValues::shared share one helper; stale [dupes] entries go, new clusters get reasons.
  • Caps: sqlbuild-python 197,963 → 169,863 code lines after merging main. Combined delta across the three binding crates is +4,767 (222,122 → 226,889; front holds 32,867), mostly the 390 one-function main/ entry files the layout requires.

No DuckShop case applies: this changes only where binding code lives, not compiler behaviour.

Verification

  • _native surface (names, kinds, signatures, members) identical to main.
  • Dense 3,000-model compile vs the previous slice, alternating on one machine, neutral:
    • Compile JSON and all 11,175 compiled files identical.
    • Cold, median of 7: wall 8.73 → 8.85 s (1.01×), CPU 27.71 → 28.02 s.
    • One-model edit, median of 3: wall 1.73 → 1.78 s.
  • XSB078 covers the moved observation entries again; a policy test guards it.
  • Passing: crate and script tests, fensu check, fensu dupes --fail-on-new, the native layering, stub, build-features and boundary checks, make check-ci. make test fails only environment-bound tests that fail on main here too.

…ython-front

Discovery, model configuration and headers, scopes, macro rendering and
authored values, SQL text, model attachment and the compile driver, cursors,
contract and refactor facts, and the consumption, observation and audit result
state tables move into a new crate between sqlbuild-python-base and
sqlbuild-python, one area per helper bucket. sqlbuild-python imports their
entry points directly; the extension module surface is unchanged.
…servation boundary

The observation boundary matched `observations_state` as a whole word, so the
`append_observations` and `register_observations_state` entries the front crate
exports, and the files that call them, fell outside it after the move. The
pattern now names both entries, and their callers are listed again.
Keeps both rules imports, and sets the sqlbuild-python cap to the
measured 169,863 code lines (main's 72 added lines on top of 169,791).
@kvlonge
kvlonge marked this pull request as ready for review November 16, 2026 12:56
@kvlonge
kvlonge enabled auto-merge November 16, 2026 12:56
@kvlonge
kvlonge added this pull request to the merge queue Nov 16, 2026
@kvlonge
kvlonge removed this pull request from the merge queue due to a manual request Nov 16, 2026
@kvlonge
kvlonge added this pull request to the merge queue Nov 16, 2026
Merged via the queue into main with commit 893e5a5 Nov 16, 2026
32 checks passed
@kvlonge
kvlonge deleted the refactor/python-front branch November 16, 2026 14:05
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