Skip to content

refactor: handle Frame type convention in v1 parser#227

Merged
fank merged 4 commits intomainfrom
refactor/frame-type
Feb 22, 2026
Merged

refactor: handle Frame type convention in v1 parser#227
fank merged 4 commits intomainfrom
refactor/frame-type

Conversation

@fank
Copy link
Member

@fank fank commented Feb 22, 2026

Summary

  • Fixes parseMarker() in parser_v1.go to convert -1 (v1 JSON "forever" sentinel) to 0 (FrameForever) instead of wrapping to MaxUint32
  • Adds test assertion for the -1 → 0 conversion
  • Transitive dependency bumps from go mod tidy

Part of a coordinated change across 3 repos:

Test plan

  • go build ./... passes
  • go test ./... passes (all packages)
  • TestParserV1_Parse_Markers_OldExtensionFormat asserts EndFrame == 0 for -1 input

Fix parseMarker() to convert -1 (v1 JSON "forever" sentinel) to 0
(FrameForever) instead of letting it wrap to MaxUint32. Add test
assertion for the conversion.
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @fank, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refactors the v1 parser to accurately interpret the "forever" marker convention, ensuring that negative frame values from the legacy JSON format are correctly mapped to the FrameForever constant. This change improves data integrity and consistency when processing older data, complemented by updated Go module dependencies.

Highlights

  • V1 Parser Frame Handling: Corrected parseMarker() in parser_v1.go to convert the v1 JSON "forever" sentinel value of -1 to 0 (representing FrameForever) instead of allowing it to wrap to MaxUint32.
  • Test Coverage: Added a new test assertion in parser_test.go to specifically verify the -1 to 0 conversion for EndFrame.
  • Dependency Updates: Updated several transitive Go module dependencies, including golang.org/x/crypto, golang.org/x/net, and golang.org/x/sys, as a result of go mod tidy.
Changelog
  • go.mod
    • Updated golang.org/x/crypto from v0.46.0 to v0.47.0.
    • Updated golang.org/x/net from v0.48.0 to v0.49.0.
    • Updated golang.org/x/sys from v0.39.0 to v0.40.0.
  • go.sum
    • Updated checksums for golang.org/x/crypto, golang.org/x/net, and golang.org/x/sys to reflect new versions.
  • internal/storage/parser_test.go
    • Added an assert.Equal call to verify that m.EndFrame is uint32(0) when the input is -1.
  • internal/storage/parser_v1.go
    • Introduced logic in parseMarker to check if rawEndFrame is less than 0. If true, endFrame is set to 0; otherwise, it's cast to uint32.
Activity
  • The author created the pull request to address a specific parsing issue.
  • The author confirmed that go build ./... passes.
  • The author confirmed that go test ./... passes for all packages.
  • The author specifically verified that TestParserV1_Parse_Markers_OldExtensionFormat asserts EndFrame == 0 for -1 input.
  • The changes are part of a coordinated effort across three repositories.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request correctly fixes an issue in the v1 parser where a "forever" frame sentinel value of -1 was being incorrectly converted. The change ensures it is parsed as 0 (FrameForever) as intended, preventing a wrap-around to MaxUint32. The new test assertion effectively validates this fix. The dependency updates are also noted. I have one suggestion to improve maintainability by replacing a magic number with a constant.

@github-actions
Copy link

Merging this branch will increase overall coverage

Impacted Packages Coverage Δ 🤖
github.com/OCAP2/web/internal/storage 93.21% (+0.07%) 👍

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/OCAP2/web/internal/storage/parser_v1.go 100.00% (ø) 242 (+5) 242 (+5) 0

Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code.

Changed unit test files

  • github.com/OCAP2/web/internal/storage/parser_test.go

@fank fank merged commit 43e3362 into main Feb 22, 2026
2 checks passed
@fank fank deleted the refactor/frame-type branch February 22, 2026 17:32
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