Skip to content

refactor: share one exception constructor and text reader across the Python bindings - #1528

Merged
kvlonge merged 1 commit into
mainfrom
refactor/shared-exception-constructors
Nov 17, 2026
Merged

kvlonge merged 1 commit into
mainfrom
refactor/shared-exception-constructors

Conversation

@kvlonge

@kvlonge kvlonge commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Why

The Python binding crates raised their error-class exceptions and read optional text values through about forty private copies of the same few lines, hidden by duplicate-code allowlist entries that deferred the consolidation.

Changes

  • exception_from in the records construct helpers builds an exception class with a message and the code and help keywords that are given. new_error takes optional code and help and replaces new_helped_error; new_plain_error, host_error and each command's error wrapper delegate to it.
  • Base readers optional_text (a str value or None) and text_item (a dict item as optional text) replace the per-crate copies. The strict None-or-str readers in compile targets and execution history are renamed nullable_text, so the two meanings no longer share a name. The lossy output-capture reader stays separate.
  • fensu.toml: the scoped [dupes] entries are gone; the dbt manifest-object and argv builders get their own entries; Python-crossing budgets drop from 3,598 to 3,567 and the sqlbuild-python line cap from 66,831 to 66,709.

Behaviour is unchanged: omitting code or help matches passing None for every class involved.

No DuckShop case applies: this changes how native errors are built, not a project shape, data value or lifecycle sequence.

Verification

  • _native surface identical to main; dense 3,000-model compile output identical (11,175 files).
  • Dense 3,000-model timing vs main, same machine, 3 alternating runs (median wall / CPU): cold 11.11 / 31.71 s base vs 10.26 / 29.28 s head; warm 0.72 vs 0.64 s; one-model edit 2.06 vs 1.92 s.
  • Focused command, compiler and runtime suites pass, including the execution-history conformance tests for opaque envelope fields; Docker-backed PostgreSQL tests could not run here.
  • make check-ci and make test on the final head.

…Python bindings

The binding crates built their error-class exceptions and read optional
text values with about forty private copies of the same few lines.

- Add exception_from to the records construct helpers. new_error now
  takes optional code and help keywords, replacing new_helped_error;
  new_plain_error and host_error delegate to it, and each command's
  error wrapper is one call.
- Add the base readers optional_text (a str value or None) and
  text_item (a dict item as optional text). They replace the per-crate
  dict readers, the compile setup and planner envelope readers, and the
  execution history reader. The strict None-or-str readers in compile
  targets and execution history are renamed nullable_text so the two
  meanings no longer share a name.
- Drop the scoped dupes allowlist entries for these clusters, give the
  dbt manifest-object and argv builders their own entries, and lower the
  Python-crossing budgets and the sqlbuild-python line cap to the new
  counts.
@kvlonge
kvlonge enabled auto-merge November 17, 2026 00:38
@kvlonge
kvlonge added this pull request to the merge queue Nov 17, 2026
Merged via the queue into main with commit f757e04 Nov 17, 2026
32 checks passed
@kvlonge
kvlonge deleted the refactor/shared-exception-constructors branch November 17, 2026 01:31
kvlonge added a commit that referenced this pull request Nov 17, 2026
…on the large-project tree

Applies the slice's shared new_error/exception_from constructor and the
base optional_text/text_item readers, keeping the large-project tree's
behaviour.

- The tree's own optional_text calls (its local reader in cli dispatch
  and the planner's reader) are unchanged; only the calls the slice
  converted use the base reader.
- The Python-tests input error keeps the tree's help text, which names
  tests/orchestration/.
- main's within_identity_pass, which the tree does not have, is not
  carried over.

Validation: cargo check --workspace --all-targets passes with no
warnings, and every line the tree added to a touched file is still
present. Nothing is built or tested yet. fensu reports 349 faults; the
three new ones ask to lower Python-crossing budgets that keep the tree's
values for the final pass.
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