Repository navigation
fix(core): make constructor keyword binding errors actionable - #70
Merged
Merged
Conversation
Definition.build normalized constructor binding failures to a generic SignatureError, leaving the misspelled keyword visible only in the exception cause. Retain a known unexpected keyword in the existing slot field for closed constructor signatures so primary error displays are actionable. Keep the stable binding-failure reason and original cause. Diagnose from constructor metadata and keyword names without rendering caller values or parsing raw exception text; general function errors and accepted variadic keyword names retain their existing behavior. Update API documentation and release notes. Verification: reproduced the Definition.build regression before the fix; 38 signature tests and 94 affected tests pass. The representative good-enough suite passes 4217 tests with 39 unrelated skips, with all five new cases included. Changed-file fatal lint and whitespace checks pass. Fixes #6.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix the remaining constructor-diagnostic gap in #6:
Definition(...).build()retained a misspelled keyword only in the exception cause, so displaying the primary exception lost the actionable detail.For a closed constructor signature, identify a known unexpected keyword from the declared parameters and supplied keyword names, then retain it in the existing
SignatureError.slotfield. For example:The machine-readable reason remains
"argument binding failed", and the original PythonTypeErrorremains the cause. Diagnostics do not render argument values or parse raw exception text. The change is constructor-only; ordinary function binding and valid variadic keyword names retain their existing handling. Update the public signature documentation and release notes.Fixes #6.
Verification
Definition.build()regression before applying the fix.good-enoughsuite (277 process-state tests plus 3,940 ordinary tests). All five new cases are included in the routine profile.Local verification used the existing Python 3.12.13
big_envenvironment with CPU confinement and single-thread native limits. No dependency or persistent-format change is required.