Use shared field guards for TransformConfig numeric settings - #520
Closed
HarshRajSinghania wants to merge 1 commit into
Closed
HarshRajSinghania wants to merge 1 commit into
HarshRajSinghania wants to merge 1 commit into
Conversation
Replace the hand-rolled crf, gop_seconds, and chunk_size_bytes checks with the shared helpers, and assert each refusal message instead of only the field name. Fixes Hebbian-Robotics#510
|
👋 Hi @HarshRajSinghania — thanks for the contribution! To keep starter issues available You already have #517 open, so this one is being closed automatically. |
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.
Summary
Route
TransformConfignumeric validation through the shared helpers in_field_guardsinstead of hand-rolling type and range checks forcrf,gop_seconds, andchunk_size_bytes.Motivation
Fixes #510. The issue asked to convert the three remaining guards and to stop matching only the field name in the refusal tests, so a type refusal and a range refusal stay distinguishable.
Implementation
crfusesrequire_int_in_range(..., minimum=0, maximum=51).gop_secondsstays optional; when set it usesrequire_positive_float.chunk_size_bytesstays optional; when set it usesrequire_positive_int.isinstance(..., bool)is gone fromtransform.py.Noneremains legal for the two optional fields, and accepted numeric values are the same as before.Refusal messages now follow the shared helpers (for example
crf must be in [0, 51], got 52rather thancrf must be between 0 and 51). That is the existing helper wording, not a new contract.Testing
The ten existing invalid cases now each assert their exact helper message. The valid-settings case still covers
crf=0,gop_seconds=1, andchunk_size_bytes=1. Defaults (gop_seconds=None,chunk_size_bytes=None) remain accepted by the existingTransformConfig()construction intest_pipeline_version_is_a_content_hash.The full project suite needs
uv, ffmpeg, and a C toolchain, which were not available in this environment. The change is a direct substitution onto already-tested helpers plus tightened assertions around those helpers.