Skip to content

fix(ui): placed object markers invisible when loaded via protobuf#230

Merged
fank merged 1 commit intomainfrom
worktree-bright-oak-ysn7
Feb 23, 2026
Merged

fix(ui): placed object markers invisible when loaded via protobuf#230
fank merged 1 commit intomainfrom
worktree-bright-oak-ysn7

Conversation

@fank
Copy link
Member

@fank fank commented Feb 23, 2026

Summary

  • Fixes placed object markers (mines, explosives) not rendering when missions are loaded via the protobuf path
  • The Go parser (PR refactor: handle Frame type convention in v1 parser #227) converts JSON endFrame=-1 ("show forever") to uint32(0) (FrameForever) for protobuf storage, but the frontend never normalized this back, causing these markers to be treated as expired
  • Adds FRAME_FOREVER = -1 constant in types.ts as the single canonical sentinel for "show forever"
  • Protobuf decoder normalizes 0 → FRAME_FOREVER at the boundary so both JSON and protobuf paths produce identical MarkerDef objects
  • isInfiniteEnd() checks only FRAME_FOREVER instead of multiple ad-hoc values

Root cause: Only the 5 detonated markers (with specific positive endFrame values) were visible. The 17 non-detonated markers had endFrame=0 in protobuf and were silently filtered out because isInfiniteEnd(0) returned false.

Test plan

  • Added test: protobuf marker with endFrame: 0 normalizes to FRAME_FOREVER (-1)
  • Added test: findPositionIndex treats FRAME_FOREVER as infinite
  • All existing decoder, marker-manager, and integration tests pass
  • Go backend tests pass

@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 addresses a critical bug preventing certain placed object markers from being visible when mission data was loaded using Protobuf. The core problem stemmed from an inconsistent interpretation of 'show forever' markers across the backend (Go) and frontend. The Go parser converted JSON's -1 to Protobuf's 0, but the frontend's decoder then treated this 0 as an expired frame. The fix introduces a specific conversion within the Protobuf decoder to correctly translate 0 back to -1, restoring the intended visibility of these markers.

Highlights

  • Marker Visibility Fix: Resolved an issue where placed object markers (like mines and explosives) were not rendering when missions were loaded via the protobuf path.
  • Protobuf endFrame Handling: Identified that the Go parser converted JSON endFrame=-1 (show forever) to uint32(0) for protobuf storage, but the frontend incorrectly interpreted 0 as an expired frame.
  • Data Normalization: Implemented a normalization step at the protobuf decoder boundary to convert endFrame: 0 back to -1, ensuring the frontend correctly treats these markers as 'show forever'.
Changelog
  • ui/src/data/decoders/tests/protobuf-decoder.test.ts
    • Added a test case to verify that a protobuf marker with endFrame: 0 is correctly decoded to endFrame: -1.
    • Added a test case to confirm that non-zero endFrame values are preserved without modification during decoding.
  • ui/src/data/decoders/protobuf-decoder.ts
    • Modified the convertMarkerDef function to normalize the endFrame value, converting 0 (from protobuf, representing 'FrameForever') to -1 for the frontend.
  • ui/src/playback/marker-manager.ts
    • Updated a comment for the INFINITE_FRAME constant to clarify its role as a legacy fallback for the 'show forever' sentinel.
Activity
  • Added a test to confirm that protobuf markers with endFrame: 0 correctly decode to endFrame: -1.
  • Added a test to ensure that non-zero endFrame values are preserved as expected.
  • Verified that all 733 existing UI tests continue to pass after the changes.
  • Confirmed that all Go backend tests also pass.
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.

@github-actions
Copy link

github-actions bot commented Feb 23, 2026

Coverage Report for ui

Status Category Percentage Covered / Total
🔵 Lines 76.42%
🟰 ±0%
2538 / 3321
🔵 Statements 72.7%
🟰 ±0%
3250 / 4470
🔵 Functions 72.48%
🟰 ±0%
859 / 1185
🔵 Branches 64.26%
⬆️ +0.06%
1203 / 1872
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
ui/src/data/types.ts 100%
🟰 ±0%
100%
🟰 ±0%
100%
🟰 ±0%
100%
🟰 ±0%
ui/src/data/decoders/protobuf-decoder.ts 80%
🟰 ±0%
56.12%
⬆️ +1.96%
100%
🟰 ±0%
78.08%
🟰 ±0%
43-47, 49-53, 66, 144-164, 197
ui/src/playback/marker-manager.ts 95.79%
⬇️ -0.04%
94.28%
⬇️ -0.11%
100%
🟰 ±0%
95.32%
⬇️ -0.05%
301-303, 355-356
Generated in workflow #106 for commit 4431b8b by the Vitest Coverage Report Action

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

The pull request effectively addresses the issue of placed object markers not rendering when loaded via protobuf. The core problem, where the Go parser converted endFrame=-1 to uint32(0) for protobuf storage, leading to markers being treated as expired in the frontend, has been correctly resolved. The protobuf-decoder.ts now properly normalizes endFrame: 0 back to -1 at the decoder boundary, ensuring the frontend treats these markers as "show forever". The added test cases in protobuf-decoder.test.ts provide good coverage for both the conversion of endFrame=0 to -1 and the preservation of non-zero endFrame values. The updated comment in marker-manager.ts also clarifies the role of INFINITE_FRAME as a legacy sentinel. Overall, the changes are precise, correct, and well-tested, directly solving the reported bug without introducing new issues.

@fank fank force-pushed the worktree-bright-oak-ysn7 branch from d72cb40 to 6e9f0c1 Compare February 23, 2026 18:18
The Go parser converts JSON endFrame=-1 to uint32(0) (FrameForever)
for protobuf storage. The frontend never normalized this back, so
markers with endFrame=0 were treated as expired and never rendered.

Add FRAME_FOREVER constant (-1) to types.ts as the single canonical
sentinel. The protobuf decoder normalizes 0 → FRAME_FOREVER at the
boundary so both JSON and protobuf paths produce identical MarkerDef
objects. isInfiniteEnd() checks only FRAME_FOREVER.
@fank fank force-pushed the worktree-bright-oak-ysn7 branch from 6e9f0c1 to 4431b8b Compare February 23, 2026 18:21
@fank fank merged commit 788199f into main Feb 23, 2026
3 checks passed
@fank fank deleted the worktree-bright-oak-ysn7 branch February 23, 2026 18:28
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