Skip to content

Add BoundedVec codec type - #17

Merged
arjanz merged 2 commits into
mainfrom
codex/bounded-vec
Oct 16, 2026
Merged

arjanz merged 2 commits into
mainfrom
codex/bounded-vec

Conversation

@arjanz

@arjanz arjanz commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Move the reusable BoundedVec codec from PyJAMaz into jamcodec.types. It preserves Vec wire encoding while enforcing inclusive count bounds, optional divisibility, and canonical VarInt64 length prefixes before constructing or decoding any elements. Encoding and deserialization enforce the same count constraints.

Validate constructor constraints and retain Vec(U8) byte semantics, counting decoded bytes for hex and UTF-8 inputs. Add usage documentation and 17 focused tests covering boundaries, malformed and oversized lengths, stream offsets, byte vectors, and nested Serializable values.

Upgrade the unit-test workflow to actions/setup-python@v7 so Python 3.9 can be downloaded when it is absent from the runner cache. Pin the runner to Ubuntu 24.04 because the Python release manifest has no 3.9 builds for Ubuntu 26.04, which ubuntu-latest is scheduled to adopt. Retain the Python 3.9–3.13 test matrix.

Validation:

  • CI: all five Python 3.9–3.13 jobs pass, including lint and tests.
  • Full codec suite: 133 tests pass on Python 3.12 and 3.13.
  • PyJAMaz codec and safrole integration: 54 tests pass using this checkout through PYTHONPATH.

@arjanz
arjanz force-pushed the codex/bounded-vec branch from 6762c55 to 6708ef4 Compare October 16, 2026 09:43
@arjanz
arjanz force-pushed the codex/bounded-vec branch from 6708ef4 to 44d50a3 Compare October 16, 2026 09:45
Added Python 3.14 support
@arjanz
arjanz merged commit 0649847 into main Oct 16, 2026
5 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.

1 participant