Skip to content

test(ui): cover the tab components' interaction and rendering paths - #591

Merged
fank merged 3 commits into
mainfrom
claude/coverage-ui-tabs
Oct 25, 2026
Merged

fank merged 3 commits into
mainfrom
claude/coverage-ui-tabs

Conversation

@fank

@fank fank commented Oct 25, 2026 •

Copy link
Copy Markdown
Member

Summary

Raises overall UI coverage to 94.7% statements / 83.9% branches / 96.2% lines (from 91.4 / 80.9 / 93.6). Test-only — no production file is touched.

Component Statements Branches
CommsTab.tsx 57.6% → 97.2% 26.3% → 78.9%
OrbatTab.tsx 69.4% → 94.0% 54.5% → 83.3%
EventsTab.tsx 73.3% → 92.0% 64.1% → 80.6%
StatsTab.tsx 82.5% → 99.7% 75.0% → 90.9%
PlayerProfileDiff.tsx 55.3% → 99.0% → 98.4%

What's pinned

CommsTab — heard counts against out-of-range peers (one net, two peers at different distances: 1/2); clicking a transmission seeks to its start and opens its net; clicking a roster member pans to them; the ±window keeps distant transmissions out of the list; search matches speaker, radio model and formatted net, each with its no-match note; a member hit narrows the net and auto-expands it while a net-label hit lists without expanding; a speaker with no entity resolves to Unit 9 and, without a snapshot radio, silently uses the addon's fallback range (no heard count); the no-data placeholder.

OrbatTab — a member-name hit keeps only that member with strength recounted; role matches work; junk searches show the no-match note; the faction with players is preselected and an explicit pick of a player-less faction sticks (and returns); member clicks follow; vehicles are searchable by their own name and by anyone who ever crewed them; the no-player-vehicles note.

EventsTab — rendering, click-pan target and search haystacks for zeus pings, zeus modules, servicing (including the rearm magazine detail), static weapons and transmissions; transmissions and chat are toggled through the filter panel since both default off.

StatsTab — wind direction reported without a speed sample; gusts, lightnings and waves rows; movement ranking with formatted distances (200 m, 1.0 km, Runner ranked above Walker) and the no-movement note.

PlayerProfileDiff — every field kind through the grid (number, percent, bool, blood pressure with the no-pressure fallback, hemorrhage levels, stance labels, plain text), body parts with damage and items, treatments, medical logs, rounds deltas for each polarity (added keeps the new count, removed keeps the old, changed shows from → to), radio rows per polarity, the stamina view, and both empty-state variants.

Test conventions

Engine snapshot effects settle on the microtask queue after a seek, so seek-dependent assertions await a settle pass first — the same pattern the overlay tests use. Chat fields are top-level on the event def (not payload), matching the factory signature.

Verification

Click-through tests were mutation-checked: removing the seekTo from the transmission click handler, the followEntity from the member row, and the panToEntity from the transmission row each fails its test. Full suite: 2268 passed / 13 skipped on the branch (2304 after merging current main), npx tsc --noEmit clean.

fank added 2 commits October 25, 2026 19:01
- Finalize: no-op without a flusher, recorded chunk errors surfaced as-is
  (distinguished from the flush wrap), flush failures wrapped, and an empty
  recording still writes chunk zero because playback always requests it
- HandleAddSoldier: a rejoining player keeps their player flag and unit name
- HandleAddVehicle: a re-sent Add replaces the record; HandleVehicleState
  registers unknown vehicles from the state's own capture frame
- seedChunkBoundaries: vehicles are seeded alongside soldiers, entities deleted
  before a boundary are left out, and a failed seed surfaces its write error
- derivePlacedObjects: magazine-icon fallback, minefield default, explicit icon
  precedence, earliest lifecycle event wins the end frame, hits attribute to the
  placer with vehicle victims keeping the vehicle id, and unknown/victim-less
  events are skipped
- eventsToV1/markersToV1: vehicle ids win victim/killer slots; polylines carry
  geometry only (matching the pinned v2 writer) while plain markers append a
  position per state
- sideToIndex, projectileEndPos, positionFromExtra, decodePayload: pinned
  directly, including malformed-payload rejection
- WriteJSONGzNamed: gzip artifact readable back, missing output dir fails at
  create time
- writeFileAtomic: rename onto a directory and a missing directory both fail
  loudly; removeSidecar errors propagate; WriteSidecars aborts on encoder
  failure and surfaces write failures

Verified each behavioral pin fails when the guarded code is broken

coverage: ingestion 85.1% -> 90.5%, storage 93.5% -> 94.2%
- CommsTab (57.6% -> 97.2% statements, 26.3% -> 78.9% branches): heard counts
  against out-of-range peers, click-to-seek opening the net, pan-to-member,
  the transmission window, search matching speaker/radio/net with the
  no-match notes, net narrowing with member auto-expand, unknown-unit fallbacks
  with no range guess, and the no-data placeholder
- OrbatTab (69.4% -> 94.0%): member and role search keeping only hits, the
  player-faction preselection and explicit picks, follow-on-click, vehicle
  search by name and by crew, and the empty vehicle note
- EventsTab (73.3% -> 92.0%): rendering, click-pan and search haystacks for
  zeus pings/modules, servicing, static weapons and transmissions
- StatsTab (82.5% -> 99.7%): wind direction without a speed sample, gusts,
  lightnings and waves, movement ranking with formatted distances, and the
  no-movement note
- PlayerProfileDiff (55.3% -> 99.0%, branches 98.4%): every field kind through
  the grid, body parts, treatments, medical logs, rounds deltas per polarity,
  radio and stamina views, and the empty-state variants

Test-only: no production file is touched. Engine snapshot effects settle on the
microtask queue, so seek-dependent assertions await a settle pass first, matching
the existing overlay test conventions

overall UI coverage: 91.4% -> 94.7% statements, 80.9% -> 83.9% branches,
93.6% -> 96.2% lines
@fank
fank requested a review from smitt14ua October 25, 2026 18:46

@smitt14ua smitt14ua left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Test-only, good coverage bump with meaningful interaction tests (seek/pan/follow on click, search haystacks, faction preselection). Locally: tsc --noEmit clean, eslint has no new warnings, recording-playback suite green (656 tests). Heads-up: this branch also carries the Go commit from #590, so merge #590 first and this diff will shrink to the UI files. A few small test-quality nits below, nothing blocking. Approving.

Details

Verified locally (Windows, branch claude/coverage-ui-tabs @ 99e66105):

  • npx tsc --noEmit — clean
  • npx eslint src/pages/recording-playback — 0 errors. The 2 warnings are in PlayerProfileCard.tsx / profileDiff.ts, which this PR doesn't touch.
  • npx vitest run src/pages/recording-playback — 43 files / 656 tests pass

Branch structure: commit c001c525 (test(go): cover ingestion finalize lifecycle…) is the same commit as in #590, so the PR shows internal/ingestion/lifecycle_test.go and internal/storage/precompress_test.go as changes. Merge order: #590 → #591. Otherwise this PR merges #590's content implicitly.

Nits (non-blocking):

  1. Mid-file imports.

    • CommsTab.test.tsx: import { vi } from "vitest"; is added after the first describe block. Move it into the existing top-level vitest import.
    • PlayerProfileDiff.test.tsx: same with import { MedicalDiffView, RadioDiffView, StaminaDiffView, DiffEmpty } from "../PlayerProfileDiff"; and the type import from ../../profileDiff.

    ES imports are hoisted, so it works, but it's easy to miss when reading.

  2. Double I18nProvider in PlayerProfileDiff.test.tsx. renderView() already wraps ui() in <I18nProvider locale="en">, and every call site wraps its view in another <I18nProvider locale="en">. Drop one of the two, most naturally the inner one at the call sites.

  3. Vacuous or missing assertions:

    • EventsTab.test.tsx › "searches chat messages, transmissions and module names": the final expect(screen.queryByTestId("event-row-0")).toBeNull() can never fail, because no event sits at frame 0 (rows are 5/10/15/20). Assert the rows that were visible before are gone (event-row-5, event-row-10, event-row-15), or assert the no-match message.
    • OrbatTab.test.tsx › "narrows groups to a member-name hit…": the comment says "with the recounted strength 1/2", and the PR description says "strength recounted", but only getByText("Alpha") is asserted. Add an assertion on the strength text, or drop the claim.
    • CommsTab.test.tsx › "narrows nets to a member hit…": the net-label search ("200") is described as "lists the net without expanding it", but only the header's presence is checked. Add expect(header("200 MHz").getAttribute("aria-expanded")).toBe("false") (or queryByText("Charlie") → null) to actually pin the no-expand behaviour.
  4. Minor cleanup:

    • async without await in OrbatTab "follows a member when their row is clicked".
    • Double blank lines between the helpers in CommsTab.test.tsx.
    • EventsTab.test.tsx adds its own radioTransmission(frameNum, action, frequency) helper, and CommsTab.test.tsx adds transmission(frameNum, unitId, action, frequency) with the same payload shape. Could live in testHelpers next to radioSnapshot.

CI (UI › check) is SKIPPED while the PR is a draft. It needs to run once it's marked ready.

@fank
fank marked this pull request as ready for review October 25, 2026 20:10
@fank
fank merged commit 3cc8f9d into main Oct 25, 2026
5 checks passed
@fank
fank deleted the claude/coverage-ui-tabs branch October 25, 2026 20:10
@github-actions

Copy link
Copy Markdown

Merging this branch will increase overall coverage

Impacted Packages Coverage Δ 🤖
github.com/OCAP2/web/internal/ingestion 94.00% (+4.92%) 👍
github.com/OCAP2/web/internal/storage 94.31% (+0.71%) 👍
Coverage details

Compared to commit f4cfae4 (run #40201649259)

Changed unit test files:

  • github.com/OCAP2/web/internal/ingestion/lifecycle_test.go
  • github.com/OCAP2/web/internal/storage/precompress_test.go

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