Validate set_color_depth input in the Python tracker - #381
Closed
snowplow-claude-review[bot] wants to merge 1 commit into
Closed
Conversation
…2fa691c78-snowplow-python-tracker-29727716248)
|
Thanks for your pull request. Is this your first contribution to a Snowplow open source project? Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://docs.snowplowanalytics.com/docs/contributing/contributor-license-agreement/ to learn more and sign. Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks. |
Matus Tomlein (matus-tomlein)
deleted the
loop/3a307af295a281a9ba70f6d2fa691c78-snowplow-python-tracker-29727716248
branch
July 20, 2026 08:32
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.
🤖 Draft implementation — refinement loop (3a307af295a281a9ba70f6d2fa691c78)
Drafted automatically by the Snowplow refinement loop (refine → product review → implement → review) from a Notion refinement, and opened here for a human to finish.
What the loop did
Validate
set_color_depthinput in the Python trackerWhat changed
Added
greater_than(depth, 0)validation toSubject.set_color_depthinsnowplow_tracker/subject.py, placed immediately before the assignment tostandard_nv_pairs["cd"]. Thegreater_thancontract helper was already imported on line 19 — no new imports or error-handling patterns introduced.Updated the
depthdocstring type annotation frominttoint,>0to match the style of the sibling setters (set_screen_resolution,set_viewport).Added
test_set_color_depth_validationtoTestSubjectinsnowplow_tracker/test/unit/test_subject.py:ValueErrorfor0and-124) still work and are stored correctlyAll 4 existing subject tests continue to pass (
test_subject_0,test_combine_subject, etc.).Why
set_screen_resolutionandset_viewportalready guard their numeric inputs withgreater_than, butset_color_depthwas never given the same treatment. Zero and negative colour-depth values are nonsensical and would silently produce invalid events. This is a consistency fix — no wire-format or schema change; thecdfield itself is unchanged.Decisions
greater_thancontract helper (no new error handling invented).Subjectsetter — out of scope by design.Reviewer checklist
greater_than(depth, 0)is placed before the assignment inset_color_depth, consistent with sibling setters0,-1) and a valid one (24)test_subject_0,test_combine_subject)