Skip to content

fix(core): make constructor keyword binding errors actionable - #70

Merged
krafczyk merged 1 commit into
mainfrom
fix/constructor-keyword-diagnostics
Oct 15, 2026
Merged

krafczyk merged 1 commit into
mainfrom
fix/constructor-keyword-diagnostics

Conversation

@krafczyk

Copy link
Copy Markdown
Collaborator

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.slot field. For example:

Before: Signature normalization failed: argument binding failed.
After:  Signature normalization failed: argument binding failed at chlid.

The machine-readable reason remains "argument binding failed", and the original Python TypeError remains 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

  • Reproduced the public Definition.build() regression before applying the fix.
  • 38 signature tests passed, including five new cases covering the primary message/slot, preserved cause, non-renderable argument values, ordinary function behavior, accepted variadic keywords, and malformed non-string keys.
  • 94 affected tests passed across signatures, semantic argument binding, object/definition creation, signature consumers and documentation links.
  • 4,217 passed, 39 skipped in the required representative good-enough suite (277 process-state tests plus 3,940 ordinary tests). All five new cases are included in the routine profile.
  • Changed-file fatal lint and whitespace checks passed.

Local verification used the existing Python 3.12.13 big_env environment with CPU confinement and single-thread native limits. No dependency or persistent-format change is required.

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.
@krafczyk
krafczyk merged commit f79b09d into main Oct 15, 2026
42 checks passed
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.

DRYML should help users solve object creation issues with a good error message

1 participant