Skip to content

docs: fix the coverage command in CONTRIBUTING.md - #806

Closed
vishal-bala wants to merge 1 commit into
mainfrom
docs/contributing-python-and-coverage
Closed

vishal-bala wants to merge 1 commit into
mainfrom
docs/contributing-python-and-coverage

Conversation

@vishal-bala

Copy link
Copy Markdown
Collaborator

Motivation

The INT8/UINT8 range check in the vector validator never runs. It compared str(datatype).upper() with "INT8" and "UINT8". datatype is a VectorDataType(str, Enum) member, though, and str() on a str-mixin Enum returns "VectorDataType.INT8", so neither branch ever matched. On every supported Python version, a JSON schema with an int8 vector field therefore accepts {"v": [999, -999]} through validate_object.

Changes

  • redisvl/schema/validation.py: the vector validator now compares enum members directly (datatype == VectorDataType.INT8), as _map_field_to_pydantic_type in the same module already does. I flattened the nested if that the string comparison needed.
  • tests/unit/test_validation.py: TestIntegerVectorRangeValidation covers the boundary values on both sides for INT8 (-128, 127) and UINT8 (0, 255), plus the reported [999, -999] repro, on a JSON-storage schema. Hash storage takes bytes and is unaffected.

I searched redisvl/ for other str(<enum member>) comparisons and found none. mcp/tools/upsert.py:_vector_dtype unwraps .value first.

Release Notes

Schema validation now enforces the integer vector ranges it always claimed to. validate_object, load(..., validate_on_load=True) and the MCP upsert tool reject JSON int8 vectors with elements outside -128..127, and uint8 vectors outside 0..255. These inputs used to pass validation silently.

Reviewer Brief

Start here: redisvl/schema/validation.py, _validate_vector inside make_vector_validator. The whole fix is its two member comparisons.

Not verified: Redis's documentation confirms that INT8/UINT8 vector types exist, but I found no page that states their element ranges. -128..127 and 0..255 are the standard 8-bit ranges, not ones checked against Redis docs. I did not run integration tests (validate_on_load and the MCP upsert path) locally. CI runs them.

Beyond CI: the five new rejection cases fail against the code before the fix, and pass with it.

Reviewed 0e525da2 · Claude Code (claude-opus-5-5) · lenses: correctness, security, design, tests, docs, Redis behaviour

pytest-cov is not a dev dependency, so `uv run pytest --cov` fails with
an unrecognised argument. Add it for the run with `uv run --with`.
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