Skip to content

Replace existing TensorSpec bounds before packing new values - #5

Open
sylvesterkaczmarek wants to merge 1 commit into
google-deepmind:masterfrom
sylvesterkaczmarek:fix/replace-tensor-spec-bounds-20260929
Open

sylvesterkaczmarek wants to merge 1 commit into
google-deepmind:masterfrom
sylvesterkaczmarek:fix/replace-tensor-spec-bounds-20260929

Conversation

@sylvesterkaczmarek

Copy link
Copy Markdown

Fixes #4.

Change

Clear each existing bound after validation and before packing its replacement. The numeric repeated-field packers append values, so repeated set_bounds calls previously retained stale values and could make scalar or vector bounds unreadable. The int8/uint8 byte packers already replaced their contents.

The setter now replaces bounds consistently across numeric types. None still unsets the corresponding bound, invalid updates leave the message unchanged, and the low-level packers' behavior remains intact. No signature or protocol changes are included.

Verification

All 32 new regression/control cases pass using real protobuf messages and the public bounds reader. They cover scalar/vector transitions, idempotence, eight numeric types, independently clearing bounds, variable-length specs, exact serialized messages and unchanged state after invalid updates. Original code fails 19 cases and passes thirteen controls.

The complete repository suite passes 417 tests and fourteen subtests locally on macOS/Python 3.12 and in exact-commit hosted validation on Ubuntu with Python 3.10/NumPy 1.26.4 and Python 3.12/NumPy 2.5.3.

Both jobs test 519950a576e9ce0e02092f79ed1d941ead9090a2, reproduce the original failures, pass the original existing suite, restore the submitted bytes and rerun the regressions. Direct wheel builds pass, and all 32 cases pass against installed wheels outside the checkout. Formatting, lint, dependency and patch checks pass. Logs, JUnit, coverage and packages are workflow artifacts; validation configuration remains on a separate fork branch.

Scope

An existing packaging issue prevents building a wheel from the source distribution because it omits the required api-common-protos submodule. This reproduces with original production source in both hosted environments. Direct wheel builds from the initialized checkout pass. Existing NumPy warnings remain.

Only the bounds setter and new regression module change. No production dependencies, upstream workflows or existing test expectations are modified. Tests include local client/server examples, without live external environments.

Run python -m pytest dm_env_rpc/v1/tensor_spec_bounds_replacement_test.py for the regressions.

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.

set_bounds appends to existing numeric bounds instead of replacing them

1 participant