Repository navigation
Decode input with msgspec instead of a hand-coded constructor - #18
Merged
Merged
Conversation
Replace the hand-written type walker in `construct` with `msgspec.convert`. The input classes (`Program`, `TaskProxy`/`Template`, `TemplateCall`, `Runner`) are now msgspec Structs with `forbid_unknown_fields=True`, so typos in field names are reported. `Join` uses string values, and `FromStr` is removed. Input errors now report the file and location of the problem, and the CLI prints them as a regular error instead of a traceback. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 16, 2026
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.
Replaces the hand-written type walker in
brei/construct.pywithmsgspec.convert, following the same approach as Entangled.construct(annot, data)is now a thin wrapper aroundmsgspec.convertthat turns aValidationErrorinto anInputError.read_from_fileadds the file name to the error.Program,TaskProxy,TemplateCallandRunnerare nowmsgspec.Structclasses withforbid_unknown_fields=True, so a typo such asrequries = [...]is reported instead of ignored.substituteandgather_argshandle Structs as well as dataclasses.Joinuses the string values"inner"/"outer", because msgspec matches enums by value. This is now case sensitive.FromStris removed; onlyPhonyused it, and only through the old decoder.InputError, so bad input is shown as an error message instead of a traceback, for example:msgspec>=0.20.0as a runtime dependency (andentangled-clias a dev dependency).The
.pyfiles are tangled from the literate sources indocs/. Also includes a small commit fixing pyright errors.This is the first of three stacked PRs; the next one builds on this branch.
🤖 Generated with Claude Code