fix: tolerate null for optional strings in wire models (v0.25.4) - #64
Merged
Conversation
Optional server columns come back as an explicit JSON null once a caller
clears them, but 20 wire fields were typed as a bare `str` with an ""
default. Pydantic rejects null for those, and because the failure happens
during list validation, one cleared row takes down the entire response:
$ goodeye templates list
ValidationError: 1 validation error for TemplateList
items.1.outcome
Input should be a valid string
Clearing `outcome` on a single template broke `templates list` and
`templates search` outright, including rows that parsed fine.
Add a `NullableStr` alias (BeforeValidator coercing None to "") and apply
it to every optional string field that already defaulted to "". Consumers
keep a plain `str`, so callers that format the value stay safe, and
non-string types are still rejected.
This matches the module's stated intent that the wire models be
"deliberately minimal and permissive so minor additive server changes do
not break old CLI releases."
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
The bug
Clearing
outcomeon a single template breaksgoodeye templates listandgoodeye templates searchentirely:20 fields in
wire.pywere typed as a barestrwith an""default. The default covers an absent key, but Pydantic still rejects an explicitnull. Because validation happens on the list, one cleared row takes down the whole response, including rows that parsed fine.The server is correct here; the API returns
nullfor a cleared nullable column, and the MCP client reads it without complaint.Blast radius
templates listandtemplates searchfail outright for any account owning one template with a clearedoutcome. The same latent bug exists ondescription, and on the skills-side models (WorkflowSummary,WorkflowDetail,WorkflowSearchItem).The fix
Add a
NullableStralias (aBeforeValidatorcoercingNoneto"") and apply it to every optional string field that already defaulted to"".str, so call sites that format or concatenate the value stay safe (e.g.table.add_row(item.outcome, ...)incommands/templates.py).nullchanges meaning.This matches the module's stated intent that the wire models be "deliberately minimal and permissive so minor additive server changes do not break old CLI releases."
Tests
New
tests/test_wire_nullable_strings.py, 11 cases: per-field null tolerance, the list-level case where one null row must not fail its siblings, search responses, unchanged behavior for absent/present values, and a guard that wrong types still raise.Full suite: 1136 passed.
ruff,ruff format, andpyrightall pass.Release
Version bumped 0.25.3 -> 0.25.4 (patch: no API or behavior change beyond accepting input that previously crashed).
🤖 Generated with Claude Code