Skip to content

Conversation

@fank
Copy link
Member

@fank fank commented Feb 2, 2026

Summary

  • Fix marker position format detection to handle old extension format [frameNum, [x,y], dir, ?alpha]
  • Correct side index mapping to match BIS_fnc_sideID (0=EAST, 1=WEST, -1=GLOBAL)
  • Add format detection for killed/hit events to handle [frameNum, type, victimId, [killerId, weaponName], distance]

The parser was not correctly handling the data format produced by the old OCAP extension (OcapReplaySaver2). This ensures backward compatibility with existing mission recordings.

Test plan

  • All existing tests pass
  • Updated tests to reflect correct BIS_fnc_sideID mapping
  • Test with actual mission data from old extension

fank added 3 commits February 3, 2026 00:10
The parser was not correctly handling the data format produced by the
old OCAP extension (OcapReplaySaver2). This fixes three format mismatches:

1. Marker positions: Old extension produces [frameNum, [x,y], dir, ?alpha]
   but parser expected [[x,y,z], frameNum, dir, alpha]. Added detection
   to handle both formats.

2. Side index mapping: Old extension uses BIS_fnc_sideID where 0=EAST,
   1=WEST, but parser had them swapped. Also added support for -1=GLOBAL.

3. Event format: Old extension uses [frameNum, type, victimId,
   [killerId, weaponName], distance] for killed/hit events, but parser
   expected separate fields. Added format detection based on whether
   index 3 is an array.
Add comprehensive test coverage for:
- Old extension marker position format [frameNum, [x,y], dir, ?alpha]
- Old extension killed/hit event format [frameNum, type, victimId, [killerId, weapon], distance]
- Integration tests parsing markers and events with old extension format
- Both alternative and old extension formats to ensure backward compatibility
Add comprehensive edge case tests for:
- Parse function: invalid entity/event/marker/time array types
- parseEvent: non-combat events with message, float distance at index 4,
  events with only source, old extension events with empty/partial arrays
- Entity with nil position data

All parser_v1.go functions now have 100% statement coverage.
@github-actions
Copy link

github-actions bot commented Feb 2, 2026

Merging this branch will decrease overall coverage

Impacted Packages Coverage Δ 🤖
github.com/OCAP2/web/internal/storage 57.85% (-0.36%) 👎

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/OCAP2/web/internal/storage/converter.go 65.66% (-1.01%) 265 (+4) 174 91 (+4) 👎
github.com/OCAP2/web/internal/storage/parser_v1.go 58.66% (-1.81%) 670 (+116) 393 (+58) 277 (+58) 👎

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/converter_test.go
  • github.com/OCAP2/web/internal/storage/parser_test.go

@fank fank merged commit 3ec6dbf into main Feb 2, 2026
2 checks passed
@fank fank deleted the fix/parser-old-extension-format branch February 2, 2026 23:29
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.

2 participants