What changed - #383
Closed
snowplow-claude-review[bot] wants to merge 1 commit into
Closed
Conversation
…2fa691c78-snowplow-python-tracker-29729203883)
|
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-29729203883
branch
July 20, 2026 11:48
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
What changed
Added input validation to
Subject.set_color_depthto reject non-positive values, consistent with the existing guards onset_screen_resolutionandset_viewport.snowplow_tracker/subject.py— insertedgreater_than(depth, 0)as the first line ofset_color_depth(before the field assignment), exactly mirroring lines 63–64 (set_screen_resolution) and lines 77–78 (set_viewport). No import changes needed —greater_thanwas already imported. Docstring type annotation updated frominttoint,>0for consistency with the sibling setters.snowplow_tracker/test/unit/test_subject.py— addedtest_set_color_depth_invalidtoTestSubject. Assertspytest.raises(ValueError)for inputs0and-1, and asserts no error for input1. Follows thepytest.raisespattern already in the file (e.g. line 69).Why
The
set_screen_resolutionandset_viewportsetters already guard their numeric inputs with the repo'sgreater_thancontract helper.set_color_depthwas the only numeric setter missing this guard, allowing nonsensical values (zero, negatives) to be silently attached to events. This change closes that gap with no new error-handling machinery — just the same one-liner already used elsewhere.What a reviewer should verify
greater_than(depth, 0)is in the correct position (first line ofset_color_depth, before theself.standard_nv_pairs['cd'] = depthassignment).int,>0, matchingset_screen_resolutionandset_viewport.test_set_color_depth_invalidcovers0,-1, and a positive value (1), and usespytest.raises(ValueError).test_subject_0(depth=1080) andtest_combine_subject(depth=10) still pass — no regression.