Skip to content

fix(ui): map VIRTUAL/LOGIC per-frame sides in v2 decoder - #568

Merged
fank merged 1 commit into
mainfrom
claude/backport-v2-virtual-side
Oct 18, 2026
Merged

fank merged 1 commit into
mainfrom
claude/backport-v2-virtual-side

Conversation

@fank

@fank fank commented Oct 18, 2026

Copy link
Copy Markdown
Member

What

Backport parity with the v1 decoder for the v2/WebSocket streaming path: ProtobufDecoderV2.mapSideString didn't handle "VIRTUAL"/"LOGIC", so per-frame soldier states for virtual/zeus units in v2 recordings decoded as "CIV".

The v2 writer stores the raw side string in SoldierState.side (internal/ingestion/writer_v2.go, Side: st.Side), but the decoder's mapping fell through to the "CIV" default — the same mapping in the v1 decoder (protobufDecoder.ts) maps VIRTUAL/LOGIC to "VIRTUAL".

Why

The virtual-faction feature (web #556 / extension #211) relies on units with side VIRTUAL to render with virtual-side colors, pass side filters, and be counted in side-derived stats. In v2/streaming recordings they were misclassified as CIV.

Change

  • ui/src/data/decoders/protobufDecoderV2.ts: add VIRTUAL/LOGIC → "VIRTUAL" to mapSideString (mirrors v1).
  • ui/src/data/decoders/__tests__/protobufDecoderV2.test.ts: regression test decoding VIRTUAL and LOGIC per-frame sides → "VIRTUAL" (fails before, passes after).

Verification

  • Local: tsc --noEmit PASS, eslint src/ PASS (0 errors), full test:coverage PASS (2187 tests), build PASS.

Not in scope (follow-ups from the #220 post-merge review)

  • v2 proto ConnectEvent/EndMissionEvent are declared but never written (connects/endMission flow through GeneralEvent) — schema cleanup only, no functional loss.
  • Conversion-worker crash recovery resets interrupted streaming rows to pending, which can leave orphaned failed rows — needs a design decision.

Backport parity with the v1 decoder: the v2 streaming path writes the raw
side string into SoldierState, but ProtobufDecoderV2.mapSideString did not
handle "VIRTUAL"/"LOGIC", so virtual/zeus units in v2 recordings were
misclassified as CIV (wrong color, filters, and side-derived stats).

Add regression test covering both VIRTUAL and LOGIC per-frame sides.
@fank
fank marked this pull request as ready for review October 18, 2026 15:34
@github-actions

Copy link
Copy Markdown

Coverage Report for ui

Status Category Percentage Covered / Total
🔵 Lines 91.5%
🟰 ±0 pp
9409 / 10282
🔵 Statements 88.9%
🟰 ±0 pp
13008 / 14631
🔵 Functions 86.91%
🟰 ±0 pp
3608 / 4151
🔵 Branches 79.28%
🟰 ±0 pp
4908 / 6190
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
ui/src/data/decoders/protobufDecoderV2.ts 85.1%
⬆️ +0.08 pp
74.35%
⬆️ +0.26 pp
94.44%
🟰 ±0 pp
85.43%
⬆️ +0.10 pp
51-60, 67-71, 74, 98-101, 131, 141, 193-201, 211-216, 234-241, 279, 280, 281, 412
Generated in workflow #124 for commit 9e66ef0 by the Vitest Coverage Report Action

@fank
fank merged commit d06e631 into main Oct 18, 2026
6 checks passed
@fank
fank deleted the claude/backport-v2-virtual-side branch October 18, 2026 15:38
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