Repository navigation
fix(binding): conversions take any mapping and refuse invalid wire values, and unknown table statuses are not active - #134
Merged
kalaspuff merged 3 commits intoOct 31, 2026
Conversation
…lues, and unknown table statuses are not active
The binding took only dicts where its stubs promise mappings, split a
str of PartiQL parameters into characters, read invalid typed values
("====" base64, {"NULL": false}, {"SS": []}) and raised TypeError,
UnicodeEncodeError or ValueError instead of ValidationError for others.
In-memory awaitables lacked __iter__, a failed wake-up write could
leave later calls undelivered, and the AWS adapter read table statuses
it does not know as ACTIVE.
Fixes #101
Co-authored-by: Carl Oscar Aaro <[email protected]>
This comment has been minimized.
This comment has been minimized.
…ready either Co-authored-by: Carl Oscar Aaro <[email protected]>
…ssage Co-authored-by: Carl Oscar Aaro <[email protected]>
This was referenced Oct 31, 2026
fix(models): numbers of union fields render as stored, and literals of plain enum members write
#126
Merged
Contributor
Author
|
Stack of 10 pull requests, merged in this order with "Squash and merge":
|
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.
What and why
The smaller binding and AWS adapter issues of #101:
Mappingforexpression_attribute_names/expression_attribute_values,request_items,tags,_check_expressions/_apply_update'snames/values,from_wireandvalue_from_wire, but the binding took onlydicts: aMappingProxyTypeorUserDictraisedTypeError. The binding now takes anycollections.abc.Mappingthere, as the stub says. PartiQLparametersgiven as astr(aSequencetoo) raiseTypeErrorinstead of being split into characters, and the stub types them as a list or tuple.ValidationError, using DynamoDB's wording where it has one.=, so"====","A==="and"AA==AAAA"no longer decode to zero bytes.{"NULL": false}is refused ("Null attribute value types must have the value of true"), and so are empty sets ("An string set may not be empty").{"N": 5},{"BOOL": 1}, astrforL,SS,NSorBS, and non-strnames raiseValidationErrorinstead ofTypeError.json.loads('"\\ud800"')) raisedUnicodeEncodeError, and anintof more than 4,300 digits raised Python's int-to-strValueError. Both are now aValidationError, and ints beyond DynamoDB's range are refused before they are written out. Anintsubclass with its own__str__is written as its number, usingint.__repr__, also above 2**63.Readyis iterable:yield from call.__await__()intypes.coroutinecode raisedTypeErrorfor in-memory calls; the awaitable now has__iter__, like anasyncio.Future.REPLICATION_NOT_AUTHORIZEDor ones added later, asACTIVE, and unknown global index statuses as no status, sowait_for_tabletook such tables for ready. The table status enum now hasREPLICATION_NOT_AUTHORIZEDandUNKNOWN, and the index status enumUNKNOWN; waiters do not take these for ready. A response without any status reads as before.Verified with Python tests of the native module (wire format, mappings, invalid text and numbers, int subclasses, a generator coroutine, mapping arguments of client calls,
strparameters) and a Rust test of the table and index status mapping, each failing without the fix.make checkpasses. The wake-up retry has no test: the binding crate has no Rust test harness, and the failure cannot be provoked from Python. It was found and fixed by reading.Fixes #101
Checklist
TableDescription.status,_core.pyi, changelog)make checkpasses locally (lint, types, clippy, consistency, tests)Worth confirming
dict."UNKNOWN"rather than its own name, since the status is a fixed enum in the core.fctl session
Note
Medium risk. It makes the native conversions of
from_wire/to_wireand the client's call arguments stricter, and changes how the event loop is woken and how unknown table and index statuses are read, so inputs that used to pass can now raise.What it does. The native module's functions now accept any mapping (such as
MappingProxyTypeorUserDict) where the type stubs promise one, and PartiQLparametersgiven as astrraiseTypeErrorinstead of being split into characters. The typed wire format (from_wire,value_from_wire) now refuses invalid input withValidationError: malformed base64,{"NULL": false}, empty sets, wrongly typedN,SandBOOLvalues, non-list containers, lone surrogates and numbers out of DynamoDB's range. It also lets in-memory calls be awaited withyield from, retries a failed event-loop wake-up write, and reads a table or index status that the AWS SDK adds later asUNKNOWNinstead ofACTIVE, sowait_for_tablekeeps waiting. Tests cover the new conversions and error messages, and the changelog and low-level access guide say what changed.Stricter wire parsing.
from_wireandvalue_from_wirenow take only a list or tuple forL,SS,NSandBSand raiseValidationErrorfor input they used to read leniently, so callers passing sets or other iterables there will see errors.fctl review's first look at
7734f16· 12 files, +403 −85 · Review agent settings