Skip to content

feat: capture color field in sector events#149

Merged
fank merged 3 commits intomainfrom
fix/v1-sector-event-color-field
Mar 7, 2026
Merged

feat: capture color field in sector events#149
fank merged 3 commits intomainfrom
fix/v1-sector-event-color-field

Conversation

@fank
Copy link
Member

@fank fank commented Mar 7, 2026

Summary

  • Add Color field to SectorEvent struct
  • Parse color from :EVENT:SECTOR: args at index 5 (addon now sends [frame, type, objectType, unitName, side, color, posX?, posY?, posZ?])
  • Export color in v1 JSON at the correct position: [objectType, unitName, side, color, [x, y, z]]

Test plan

  • Parser tests updated and passing (TestParseSectorEvent)
  • Builder tests updated and passing (TestBuildWithSectorEvents)
  • Integration test updated and passing (TestIntegrationFullExport)
  • All tests passing (go test ./...)

The v1 JSON format includes a color field at index 3 between side and
position: [objectType, unitName, side, color, [x, y, z]]. The builder
was omitting this field, shifting position from index 4 to index 3 and
breaking index-based consumers. Add empty string placeholder for color
since the extension does not capture it.
@gemini-code-assist
Copy link

Summary of Changes

Hello, 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 data formatting issue in the v1 sector event export. By explicitly including an empty 'color' field, it ensures that the JSON structure adheres to the expected index-based format, preventing errors in systems that consume this data.

Highlights

  • V1 Sector Event Format Correction: Introduced an empty string placeholder for the 'color' field in the v1 JSON sector event format to maintain correct indexing for consumers.
  • Prevented Index Shifting: Resolved an issue where the omission of the 'color' field caused subsequent data points (like position) to shift indices, breaking downstream parsers.
  • Test Coverage: Updated unit and integration tests to reflect the new format and ensure data integrity.
Changelog
  • internal/storage/memory/export/v1/builder.go
    • Added an empty string placeholder for the 'color' field in the v1 sector event JSON array.
    • Updated the comment describing the v1 sector event format to include the 'color' field.
  • internal/storage/memory/export/v1/builder_test.go
    • Adjusted assertions in TestBuildWithSectorEvents to account for the newly added 'color' field at index 3.
    • Shifted the index for position data assertion from 3 to 4.
  • internal/storage/memory/export_test.go
    • Modified TestIntegrationFullExport to include an assertion for the empty 'color' field in sector event payloads.
Activity
  • Unit tests were updated and are passing.
  • Integration tests were updated and are passing.
  • All memory storage tests are passing.
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

@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 the v1 sector event format by adding a placeholder for the color field, which was causing issues for consumers. The change is simple, effective, and is accompanied by corresponding updates to both unit and integration tests to validate the new format. I've added a couple of suggestions in the test files to improve their long-term maintainability by reducing the use of magic index numbers when asserting on array-based event payloads.

fank added 2 commits March 7, 2026 15:29
Add Color field to SectorEvent struct and parse it from :EVENT:SECTOR:
args at index 5. Update v1 JSON export to use the actual color value
instead of a hardcoded empty string. Args format changes from
[frame, type, objectType, unitName, side, posX?, posY?, posZ?] to
[frame, type, objectType, unitName, side, color, posX?, posY?, posZ?].
@github-actions
Copy link

github-actions bot commented Mar 7, 2026

Merging this branch will not change overall coverage

Impacted Packages Coverage Δ 🤖
github.com/OCAP2/extension/v5/internal/parser 100.00% (ø)
github.com/OCAP2/extension/v5/internal/storage/memory 99.22% (ø)
github.com/OCAP2/extension/v5/internal/storage/memory/export/v1 100.00% (ø)
github.com/OCAP2/extension/v5/pkg/core 0.00% (ø)

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/OCAP2/extension/v5/internal/parser/parse_events.go 100.00% (ø) 231 (+2) 231 (+2) 0
github.com/OCAP2/extension/v5/internal/storage/memory/export/v1/builder.go 100.00% (ø) 212 212 0
github.com/OCAP2/extension/v5/pkg/core/events.go 0.00% (ø) 0 0 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/extension/v5/internal/parser/parse_events_test.go
  • github.com/OCAP2/extension/v5/internal/storage/memory/export/v1/builder_test.go
  • github.com/OCAP2/extension/v5/internal/storage/memory/export_test.go

@fank fank changed the title fix: add empty color field to v1 sector event format feat: capture color field in sector events Mar 7, 2026
@fank fank merged commit d9d47ae into main Mar 7, 2026
3 checks passed
@fank fank deleted the fix/v1-sector-event-color-field branch March 7, 2026 14:35
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