fix: guard FizEncoders construction when no encoder axis is present#212
Open
rocketmark wants to merge 6 commits into
Open
fix: guard FizEncoders construction when no encoder axis is present#212rocketmark wants to merge 6 commits into
rocketmark wants to merge 6 commits into
Conversation
jamesmosys
approved these changes
May 21, 2026
get_tracking_frame() unconditionally constructed FizEncoders(None, None, None) when no FIZ axis appeared in the packet, causing ValueError. Guard the construction so lens_encoders is only set when at least one encoder value was decoded. Adds a unit test with a hand-crafted packet containing no encoder axes.
rocketmark
force-pushed
the
upstream-pr/fix-f4-fiz-encoders-none
branch
from
May 21, 2026 13:37
04eb1d2 to
e9b67d8
Compare
Contributor
Author
|
Force pushed to resolve the branch conflicts. The change here doesn't conflict with the other changes. |
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
get_tracking_frame()inmosys/f4.pyunconditionally constructsFizEncoders(focus, iris, zoom)at the end of every frame. When no FIZaxis appears in the packet, all three values remain
NoneandFizEncodersraises
ValueError: FizEncoders requires at least one of focus or iris or zoom,crashing the parser.
Demonstration
BEFORE:
F4PacketParser.get_tracking_frame()on any packet with no encoder axesraises
ValueError: FizEncoders requires at least one of focus or iris or zoomAFTER:
returns a valid frame with
lens_encodersunset (None)Impact
Any F4 packet that omits FIZ encoder axes causes
get_tracking_frame()toraise, aborting frame parsing. Callers receive an unhandled exception rather
than a partial frame.
Change
mosys/f4.py: wrap theFizEncodersconstruction in a guard so it is onlyexecuted when at least one of
focus,iris, orzoomwas decoded from thepacket. One-line change.
test_mosys_reader.py: addtest_no_encoder_axes_does_not_crash— a unit testusing a hand-crafted minimal packet with no encoder axes. Verifies the parser
returns a valid frame with
lens_encoders is None.Found via
Hypothesis-based property testing against a synthetic F4 packet generator.
Packets containing only the minimum required axes (timecode + focal length)
triggered the crash immediately on the first generated example.