Assert type: object so a parameter class is actually named - #38
Open
CNSeniorious000 wants to merge 1 commit into
Open
Assert type: object so a parameter class is actually named#38CNSeniorious000 wants to merge 1 commit into
type: object so a parameter class is actually named#38CNSeniorious000 wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Sorry @CNSeniorious000, you've used your own review budget of 250,000 diff characters for the last 7 days.
You can request another review in 4 days and 16 hours by commenting @sourcery-ai review. Upgrade to get a review now.
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.
#31 borrowed dsh's render context to name parameter objects instead of degrading them to
dict[str, Any]. It works — but only when the caller happens to puttype: 'object'on the parameters schema. Without it dsh degrades the whole args type and every parameter goes back toAny, silently.That is the third trigger of the same silent degradation, after a stray
$schemaand aoneOfat any property — and the only one reached by omission rather than by content. A schema that declarespropertiesis describing an object whether or not it says so; JSON Schema has no other reading. So it is asserted rather than assumed, spread first so a schema that does declare a type keeps its own:How it was caught, and the gap that let it through
the rendered block is a programis the only test that RUNS the fence, and therefore the only place a class that is referenced but never declared can show up — an annotation has to evaluate. Its catalogue had no object-typed parameter, so #31's classes were never executed by it; everything that did cover them read the text.This adds one, and asserts through the interpreter:
That fixture's parameters carry no
typekey — which is why the new assertion failed on its first run instead of passing quietly. The fixture style is what exposed the bug.One expectation moved on purpose
narrowing only removes a reason to rejectassertedrows: list[dict[str, Any]]. That spelling is the degradation #31 exists to remove, so it now readsrows: list[KeepArgsRows]. The other three spellings in that loop are the actual guard —narrowedmust not touch a type dsh already accepts — and they are unchanged.Verification
Mutation-checked: dropping
asObjectfails both the new fence assertion and therowsone.