Skip to content

feat: chat tab, Steam UID player profiles and paged recording list - #626

Open
YetheSamartaka wants to merge 5 commits into
OCAP2:mainfrom
YetheSamartaka:feat/chat-tab-player-profiles
Open

YetheSamartaka wants to merge 5 commits into
OCAP2:mainfrom
YetheSamartaka:feat/chat-tab-player-profiles

Conversation

@YetheSamartaka

Copy link
Copy Markdown
Contributor
  • Chat tab in playback, with search, a filter per channel, and click-to-seek. The admin password in #login commands is masked on receipt, in the v1 download and in playback (#login ********), so recordings saved before this change are covered too.
  • Player search and profiles across recordings, on a new /players page and under the recording search. A player is matched by Steam UID when the recording has one, otherwise by in-game name. Profiles list the other names a player used.
  • Converted v1 recordings are indexed from their .json.gz, because the v1 protobuf has no UIDs. The JSON is streamed, so large recordings don't load whole into memory.
  • The recording list is paged on the server. New query parameters: limit, offset, sort, dir, q, world, player, playerUid. The total comes in an X-Total-Count header, and there is a new GET /api/v1/operations/summary. Requests without limit still get every recording.
  • Database migration 17 adds the operation_players table. Existing recordings are indexed once at startup.
  • The side panel fits all tabs on one row in every locale.
  • Tests: Go and UI tests pass at 100% coverage; typecheck and lint are clean.

- Chat tab in playback: search, per-channel filters and click to seek.
  The admin password in a #login command is masked on receipt, in the
  v1 export of stored recordings and in playback ("#login ********").
- Player search and profiles across recordings (/players). A player is
  identified by Steam UID when the recording has one and by in-game name
  otherwise; profiles list the other names a player used. Converted v1
  recordings are indexed from their JSON source, which keeps the UIDs.
- The recording list is paged, filtered and sorted on the server
  (limit, offset, sort, dir, q, world, player, playerUid) with an
  X-Total-Count header, plus GET /api/v1/operations/summary. Requests
  without limit still get every recording.
- The side panel is wide enough for all tabs on one row in every locale.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@YetheSamartaka
YetheSamartaka requested a review from fank December 1, 2026 22:25
@fank

fank commented Dec 1, 2026 •

Copy link
Copy Markdown
Member

Ratatoskr reviewed this pull request.

Changes requested on 4edca589. See the review.

Finished 2026-12-01 22:33 UTC.

@github-actions

github-actions Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Coverage Report for ui

Status Category Percentage Covered / Total
🔵 Lines 100%
🟰 ±0 pp
10564 / 10564
🔵 Statements 100%
🟰 ±0 pp
15153 / 15153
🔵 Functions 100%
🟰 ±0 pp
4414 / 4414
🔵 Branches 100%
🟰 ±0 pp
6115 / 6115
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
ui/src/data/apiClient.ts 100%
🟰 ±0 pp
100%
🟰 ±0 pp
100%
🟰 ±0 pp
100%
🟰 ±0 pp
ui/src/data/players.ts 100% 100% 100% 100%
ui/src/data/decoders/jsonDecoder.ts 100%
🟰 ±0 pp
100%
🟰 ±0 pp
100%
🟰 ±0 pp
100%
🟰 ±0 pp
ui/src/data/decoders/protobufDecoder.ts 100%
🟰 ±0 pp
100%
🟰 ±0 pp
100%
🟰 ±0 pp
100%
🟰 ±0 pp
ui/src/i18n/locales.ts 100%
🟰 ±0 pp
100%
🟰 ±0 pp
100%
🟰 ±0 pp
100%
🟰 ±0 pp
ui/src/pages/players/PlayersPage.tsx 100% 100% 100% 100%
ui/src/pages/recording-playback/deepLink.ts 100%
🟰 ±0 pp
100%
🟰 ±0 pp
100%
🟰 ±0 pp
100%
🟰 ±0 pp
ui/src/pages/recording-playback/shortcuts.ts 100%
🟰 ±0 pp
100%
🟰 ±0 pp
100%
🟰 ±0 pp
100%
🟰 ±0 pp
ui/src/pages/recording-playback/components/ChatTab.tsx 100%
🟰 ±0 pp
100%
🟰 ±0 pp
100%
🟰 ±0 pp
100%
🟰 ±0 pp
ui/src/pages/recording-playback/components/SidePanel.tsx 100%
🟰 ±0 pp
100%
🟰 ±0 pp
100%
🟰 ±0 pp
100%
🟰 ±0 pp
ui/src/pages/recording-selector/RecordingSelector.tsx 100%
🟰 ±0 pp
100%
🟰 ±0 pp
100%
🟰 ±0 pp
100%
🟰 ±0 pp
ui/src/playback/engine.ts 100%
🟰 ±0 pp
100%
🟰 ±0 pp
100%
🟰 ±0 pp
100%
🟰 ±0 pp
ui/src/playback/events/chatEvent.ts 100%
🟰 ±0 pp
100%
🟰 ±0 pp
100%
🟰 ±0 pp
100%
🟰 ±0 pp
Generated in workflow #401 for commit 88e3daf by the Vitest Coverage Report Action

@github-actions

github-actions Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Merging this branch will increase overall coverage

Impacted Packages Coverage Δ 🤖
github.com/OCAP2/web/cmd/ocap-webserver 100.00% (ø)
github.com/OCAP2/web/internal/conversion 100.00% (ø)
github.com/OCAP2/web/internal/ingestion 100.00% (ø)
github.com/OCAP2/web/internal/redact 100.00% (+100.00%) 🌟
github.com/OCAP2/web/internal/server 100.00% (ø)
github.com/OCAP2/web/internal/storage 100.00% (ø)
github.com/OCAP2/web/internal/testkit 100.00% (ø)
Coverage details

Compared to commit d982b8a (run #46626337829)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/OCAP2/web/cmd/ocap-webserver/main.go 100.00% (ø) 96 (+4) 96 (+4) 0
github.com/OCAP2/web/internal/conversion/worker.go 100.00% (ø) 271 (+104) 271 (+104) 0
github.com/OCAP2/web/internal/ingestion/export_v1_from_v2.go 100.00% (ø) 196 196 0
github.com/OCAP2/web/internal/ingestion/redact_json.go 100.00% (+100.00%) 233 (+233) 233 (+233) 0 🌟
github.com/OCAP2/web/internal/ingestion/redact_stored.go 100.00% (+100.00%) 116 (+116) 116 (+116) 0 🌟
github.com/OCAP2/web/internal/ingestion/session.go 100.00% (ø) 446 (+1) 446 (+1) 0
github.com/OCAP2/web/internal/redact/redact.go 100.00% (+100.00%) 8 (+8) 8 (+8) 0 🌟
github.com/OCAP2/web/internal/server/chat_redaction.go 100.00% (+100.00%) 85 (+85) 85 (+85) 0 🌟
github.com/OCAP2/web/internal/server/datapath_other.go 100.00% (+100.00%) 1 (+1) 1 (+1) 0 🌟
github.com/OCAP2/web/internal/server/datapath_windows.go 0.00% (ø) 0 0 0
github.com/OCAP2/web/internal/server/handler.go 100.00% (ø) 412 (+47) 412 (+47) 0
github.com/OCAP2/web/internal/server/handler_admin.go 100.00% (ø) 105 105 0
github.com/OCAP2/web/internal/server/handler_players.go 100.00% (+100.00%) 49 (+49) 49 (+49) 0 🌟
github.com/OCAP2/web/internal/server/handler_stream.go 100.00% (ø) 557 (+2) 557 (+2) 0
github.com/OCAP2/web/internal/server/operation.go 100.00% (ø) 400 (+91) 400 (+91) 0
github.com/OCAP2/web/internal/server/players.go 100.00% (+100.00%) 129 (+129) 129 (+129) 0 🌟
github.com/OCAP2/web/internal/server/upload_staging.go 100.00% (+100.00%) 10 (+10) 10 (+10) 0 🌟
github.com/OCAP2/web/internal/storage/engine.go 0.00% (ø) 0 0 0
github.com/OCAP2/web/internal/storage/json.go 100.00% (ø) 83 (+28) 83 (+28) 0
github.com/OCAP2/web/internal/storage/parser_v1.go 100.00% (ø) 305 (+13) 305 (+13) 0
github.com/OCAP2/web/internal/storage/precompress.go 100.00% (ø) 83 (+23) 83 (+23) 0
github.com/OCAP2/web/internal/storage/protobuf.go 100.00% (ø) 38 (+1) 38 (+1) 0
github.com/OCAP2/web/internal/storage/protobuf_v2.go 100.00% (ø) 72 (+1) 72 (+1) 0
github.com/OCAP2/web/internal/testkit/cases.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/web/internal/conversion/players_test.go
  • github.com/OCAP2/web/internal/conversion/worker_test.go
  • github.com/OCAP2/web/internal/ingestion/chat_login_test.go
  • github.com/OCAP2/web/internal/ingestion/redact_json_test.go
  • github.com/OCAP2/web/internal/ingestion/redact_stored_test.go
  • github.com/OCAP2/web/internal/redact/redact_test.go
  • github.com/OCAP2/web/internal/server/chat_redaction_test.go
  • github.com/OCAP2/web/internal/server/datapath_windows_test.go
  • github.com/OCAP2/web/internal/server/handler_admin_test.go
  • github.com/OCAP2/web/internal/server/handler_players_test.go
  • github.com/OCAP2/web/internal/server/handler_test.go
  • github.com/OCAP2/web/internal/server/integration_test.go
  • github.com/OCAP2/web/internal/server/operation_indexes_test.go
  • github.com/OCAP2/web/internal/server/operation_test.go
  • github.com/OCAP2/web/internal/server/players_test.go
  • github.com/OCAP2/web/internal/server/upload_staging_test.go
  • github.com/OCAP2/web/internal/storage/chat_conversion_test.go
  • github.com/OCAP2/web/internal/storage/parser_test.go
  • github.com/OCAP2/web/internal/storage/player_uid_test.go
  • github.com/OCAP2/web/internal/storage/precompress_test.go

@fank fank left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

REQUEST_CHANGES — 6 blocking findings, including incomplete admin-password redaction.

Review details
  1. Previously stored recordings can still disclose the Arma admin password. handler.go:586–607 serves an existing v1 JSON copy unchanged; the redacting exporter only runs when the copy is missing. Native v2 saves write that copy by default, so the playback download still returns the original password if it was captured before masking. Also, masking in the browser does not sanitize the old manifest served by the asset handler. Make historical recording delivery safe server-side, including previously generated copies and cached variants, and pin the stored-copy case at the HTTP response boundary. The export unit test does not exercise that branch.
  2. Converting a v1 recording with chat makes the chat disappear in playback. streaming_converter.go:162–177 uses the generic parser, which stored Side as the message for my synthetic [2, "chat", "Moving up", "Nosey", "Side"] event. The v1 protobuf decoder then drops chat entirely. Carry the chat fields through conversion and decoding, and cover the converted playback path rather than just the JSON decoder.
  3. A second name used in the same recording is neither searchable nor shown as an alias. worker.go:343–351 keeps only the first name per UID. In a recording with Nosey and Raven on two entities sharing one UID, searching for Raven returned no players and the profile had no aliases. Index all observed names without counting the recording twice.
  4. The tag chip no longer selects the exact tag. RecordingSelector.tsx:112–118 sends the selected badge to the legacy substring filter. A COOP selection returned both COOP and COOP-training; the old UI matched only COOP. Give the chips an exact-match filter without changing the existing API's tag semantics.
  5. A world offered by the summary can filter out its own recordings. operation.go:763–767 lowercases only the query values, while the stream's update path can store a mixed-case name. A stored Altis appeared in the summary, but selecting Altis returned no rows. Normalize both sides or migrate existing values as well as fixing writes.
  6. Newest-first paging sorts supported RFC3339 dates as text. operation.go:89–94 sorts by the raw date string. With a one-row descending page, 2026-01-02T00:30:00+02:00 came before 2026-01-01T23:30:00Z, though it is one hour earlier. The old UI compared instants. Sort by normalized time before applying the page, retaining an ID tie-breaker.

Verification at 4edca58: GitHub Go, UI, and coverage-report checks passed. In a disposable checkout, go test -coverprofile=cover.raw -coverpkg=./cmd/...,./internal/... ./..., go run ./cmd/ocap-testkit run route-access playback-delivery conversion-recovery, UI build, npx --no-install tsc --noEmit, npx --no-install eslint src/, and npm run test:coverage passed. UI: 2,509 passed, 13 skipped. Separate synthetic Go checks reproduced findings 2–6; finding 1 is from tracing server delivery. No rendered browser check was performed.

Earlier discussions: GitHub GraphQL returned no review threads, so none were resolved, left open, or skipped.

- Mask #login passwords in recordings stored before masking: the v2
  manifest with its precompressed sidecars and the v1 JSON copy or upload
  are rewritten in place before the server first serves any of them, and
  swept once at startup (chat_redaction_revision, migration 19). A
  recording that cannot be checked is not served. The response boundary
  is pinned for the stored copy, every manifest encoding and a sidecar
  asked for by name.
- Carry chat through v1 conversion as JSON in the event message, masked,
  and decode it in the v1 protobuf decoder; the converted playback path
  is covered end to end.
- Index every name a player used in a recording (operation_player_names)
  so each is searchable and listed as an alias without counting the
  recording twice.
- Tag chips filter on a new exact tagExact parameter; tag keeps its
  contains semantics.
- Lowercase world names when a streamed recording is saved, and fix the
  rows saved before (migration 18), so every summary world selects its
  recordings.
- Sort dates by the instant they name (julianday), RFC3339 offsets
  included, for paging, profiles and player search.
- Match #login after any Unicode whitespace or U+FEFF, the same set in
  the server, the UI and the addon (shared internal/redact package).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@YetheSamartaka
YetheSamartaka requested a review from fank December 2, 2026 07:45
@fank

fank commented Dec 2, 2026 •

Copy link
Copy Markdown
Member

Ratatoskr reviewed this pull request.

Changes requested on 3e6f82b5. See the review.

Finished 2026-12-02 08:04 UTC.

@fank fank left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

REQUEST_CHANGES — 8 blocking findings, including remaining admin-password exposure.

Review details
  1. Valid historical JSON can still disclose the Arma admin password. redact_stored.go:99–108 skips parsing when the raw JSON does not contain the literal word login. Legacy upload accepts JSON from other writers, and an encoder can write letters as Unicode escapes without changing the decoded chat message. The redactor then marks the recording checked and the download still contains the original credential. Match decoded JSON strings rather than treating a raw-text miss as proof that the file is safe. Extend the registered-route regression test with a synthetic escaped command.
  2. The revision can certify files that were never checked or were not fully rewritten. redact_stored.go:44–55 processes only the first existing JSON file, but GetData can serve either .json.gz or .json. When both exist, the plain copy can retain the password. Also, ReplaceArtifact replaces the raw manifest before its sidecars. If that second step fails, the retry sees an already-masked manifest and skips the sidecars. The route can then serve the stale sidecar by name, outside negotiated freshness checks. Verify every served representation or remove derived variants before certifying completion. Test coexistence and a retry after partial replacement; the current HTTP test only covers a single JSON copy and a successful rewrite.
  3. A replacement upload can publish unchecked bytes under the previous revision. handler.go:533–542 makes the uploaded JSON visible before resetting the database row. A concurrent download in that window sees the old completed revision in ChatRedactor.Ensure and serves the new, unsanitized file. If the DB write fails, the mismatch persists. Sanitize the staged upload before publishing it, or bind the serve decision to the exact artifact generation checked. Cover replacement with an already-marked recording and a failed metadata write.
  4. Deleted or replaced recordings can leave searchable aliases. An async job that read a recording before its deletion can finish after the deletion transaction. ReplaceOperationPlayers inserts the child rows and commits even when its revision update matches zero operations. SearchPlayers can then find a surviving UID by a name from the deleted recording that no longer appears in the profile. Require a live parent operation in the write transaction and test a stale job completing after deletion or replacement.
  5. The same-recording alias fix still omits names recorded on connections. worker.go:390–420 uses connection names to infer UIDs but only adds names from units and Zeus slots. A player recorded as Raven on a unit and Nosey on a connection with the same UID is neither searchable as Nosey nor shown with that alias. Add the connection name to the matched participant without creating another participation record or counting connect-only observers.
  6. Player search and the profile disagree on the latest name when dates tie. Streamed recordings use date-only values. SearchPlayers takes the name from a bare column alongside MAX(julianday(...)), while the profile breaks ties by operation ID. A synthetic same-day pair returned Old in search and New on the profile. Use the same deterministic latest-row order in both.
  7. The recording list can duplicate or skip rows when a recording is added or deleted between pages. operation.go:736–748 uses a live offset, and RecordingSelector.tsx:137–146 blindly appends. For descending IDs, after [4,3], inserting 5 makes offset 2 return [3,2]; deleting 4 instead skips 2. Give the UI a stable page boundary or restart pagination when its snapshot is invalidated. Deduplication alone does not recover skipped rows.
  8. Recording search lost Unicode case-insensitive matching. The old selector lowercased both sides; operation.go:787–797 now relies on SQLite LIKE, which only folds ASCII by default. For example, évac no longer finds Évacuation. Preserve Unicode case matching for q before counting and paging, and pin a non-ASCII fixture.

Earlier review: Rechecked the previous six findings at 3e6f82b. Conversion now preserves chat in newly converted v1 recordings; exact tag chips, mixed-case world filtering, and RFC3339 instant ordering are fixed. Same-UID units now retain both names without counting a recording twice, but connection aliases are still missing. Historical HTTP redaction is improved but incomplete (findings 1–3). GraphQL returned no review threads; none were resolved, left open, or skipped. The earlier findings were in the review body, not in resolvable threads.

Verification at 3e6f82b: GitHub Go, UI, and coverage-report checks passed. In a disposable checkout, go test -coverprofile=cover.raw -coverpkg=./cmd/...,./internal/... ./... passed (100% Go statement coverage); go run ./cmd/ocap-testkit run route-access playback-delivery conversion-recovery passed. UI npm run build, npx --no-install tsc --noEmit, npx --no-install eslint src/, and npm run test:coverage passed (2,514 passed, 13 skipped, 100% measured coverage). The redaction findings are from tracing server delivery and the write/retry paths; no live data or credentials were used. No rendered browser check was performed.

- Stored chat: match #login in decoded JSON, check both .json.gz and
  .json, and rewrite any sidecar that differs from its manifest, so a
  recording is only marked once every servable file is clean.
- ReplaceArtifact removes sidecars before replacing the raw file, so a
  failure part way leaves none of the old bytes.
- Uploads are masked before they are published; a non-JSON upload is
  refused.
- Player index writes require a live operation, so a stale job after a
  delete or replace writes nothing.
- Connection names join the matching participant as other names.
- Player search and profile pick the latest name by the same order.
- The recording list pages by cursor (after / X-Next-Cursor), so rows
  added or deleted between pages neither repeat nor skip.
- q matches in any case of any script.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@YetheSamartaka
YetheSamartaka requested a review from fank December 2, 2026 17:35
@fank

fank commented Dec 2, 2026 •

Copy link
Copy Markdown
Member

Ratatoskr reviewed this pull request.

Changes requested on acd080ff. See the review.

Finished 2026-12-02 20:08 UTC.

@fank fank left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

REQUEST_CHANGES — 3 blocking findings, including admin-password exposure during upload.

Review details
  1. Viewers can still receive an unmasked Arma admin password while an upload is in progress. StoreOperation writes unredacted bytes to a fixed staging file inside the served data directory before masking them. chatRecording does not recognize that staging file, and GetData serves existing files even when they are not recognized recording artifacts. The fixed path also lets two uploads for the same recording share the file that one request already checked. Use a unique staging file per request in an area the viewer route cannot serve, then publish only that checked file. The current replacement test only requests the final filename after the upload returns; add a registered-route test that pauses before masking and verifies staging files cannot be fetched.
  2. Historical redaction buffers the whole position history before serving playback. maskJSONChat decodes each top-level value into a json.RawMessage, so the entire entities array, including every position, gets buffered and copied even when there is no chat. In a disposable checkout, checking a clean synthetic 76.1 MiB recording allocated 332.1 MiB in total, with heap allocation still 268.1 MiB above baseline when the call returned. RedactStoredChat also runs this scan for the JSON copy before the first request can receive that recording's v2 manifest. Large recordings can exhaust a memory-limited server during backfill or ordinary playback. Stream or skip non-chat values without buffering the whole array; cover a large clean recording as well as a rewrite.
  3. A transient error loading the next page silently strands the rest of the recordings. RecordingSelector.tsx:158–162 sets pageFailed, which disables further loading, but the list only renders a loading indicator, not an error or retry. The existing test leaves only 3 of 7 recordings visible until it changes the sort. Show an error and offer a retry of the same cursor so users can recover without changing their search or sort. Test a failed page followed by a successful retry.

Earlier reviews: Rechecked the first review and the follow-up at acd080f. Converted chat, exact tags, mixed-case worlds, RFC3339 instant ordering, same-recording and connection aliases, stale index writes, same-day name ties, cursor paging across inserts/deletes, and Unicode mission search are fixed. Historical escaped chat, both JSON copies, stale manifest sidecars, and the final filename after an isolated upload are covered; finding 1 is the remaining upload-delivery gap. GitHub GraphQL returned no unresolved review threads. None were resolved, left open, or skipped; the earlier findings are in the review bodies.

Verification: GitHub Go, UI, and coverage-report checks passed. In a disposable checkout with CGO enabled, go test -coverprofile=cover.raw -coverpkg=./cmd/...,./internal/... ./... passed (100% measured Go statement coverage). go run ./cmd/ocap-testkit run route-access legacy-upload playback-delivery conversion-recovery passed after installing the UI dependencies required by the playback case. UI npm run build, npx --no-install tsc --noEmit, npx --no-install eslint src/, and npm run test:coverage passed (2,517 passed, 13 skipped, 100% measured coverage). Finding 1 is from tracing the registered route and upload code, not a live-service test. No browser rendering was inspected.

…d page

- Stage each upload in a random directory of its own under
  .upload-staging/ and publish only the masked file, by a rename. /data/
  refuses the staging area under any name the disk resolves to it, and
  no recording may take its name, so a removal never reaches it.
- /data/ refuses backslashes, and on Windows serves a file only by its
  stored name: no other case, 8.3 short name or stream suffix. The chat
  check matches names in any case and with the trailing dots and spaces
  Windows drops, so a recording named "Op." still plays.
- A chat-bearing file of no recording is refused instead of masked through
  the requested name, which on a disk that ignores case could rename a
  stored recording. Recordings share a fixed set of locks, so requested
  names cannot grow it.
- Check v1 JSON chat with a streaming scanner that holds one event at a
  time and accepts exactly what encoding/json does: a 30 MiB recording
  is checked with about 85 KiB allocated instead of 94 MiB.
- Show an error with a retry of the same cursor when a page of the
  recording list fails to load.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@YetheSamartaka
YetheSamartaka requested a review from fank December 3, 2026 07:01
@fank

fank commented Dec 3, 2026 •

Copy link
Copy Markdown
Member

Ratatoskr reviewed this pull request.

Changes requested on 134c7436. See the review.

Finished 2026-12-03 07:20 UTC.

@fank fank left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

REQUEST_CHANGES — 2 blockers: unchecked manifest sidecars can leak passwords, and redaction can block otherwise playable recordings.

Review details
  1. A leftover manifest sidecar can still disclose the Arma admin password. redactManifestChat treats a missing manifest.pb as clean without checking its compressed copies. Ensure can then mark the recording checked, and GetData serves an existing sidecar by name. A partial restore that retains a precompressed historical manifest but not the raw file therefore leaves the old chat downloadable. Fail closed for a sidecar without a verified authoritative manifest, or sanitize the sidecar itself. Add a registered-route test for orphaned gzip and zstd copies; the existing failed-rewrite test still has a raw manifest.
  2. A broken copy blocks playback of the intact format. RedactStoredChat ties the checks for the native manifest and the legacy JSON together. At the registered viewer route, a synthetic truncated legacy copy made a valid native manifest return 503; reversing the fixture made a valid legacy recording return 503 because of a damaged native manifest. That defeats the documented v1 fallback. Check the representation being served independently: keep unchecked bytes unavailable, but serve the intact, redacted format. Cover both directions at the route boundary.

Earlier reviews: Rechecked the three most recent blockers. The registered-route test now pauses two same-recording uploads in separate staging directories and confirms viewers cannot fetch them; the large-recording tests bound allocations for both a clean scan and a rewrite; and the recording-list tests verify retrying the same cursor. The fixes for converted chat, exact tags, world casing, RFC3339 sorting, aliases, stale index writes, latest-name ties, cursor paging, and Unicode search still hold. Historical escaped chat, both JSON filenames, and stale sidecars with a raw manifest present remain covered. GraphQL returned no review threads, so none were resolved, left open, or skipped; the earlier findings are in the submitted review bodies.

Verification at 134c7436: GitHub Go, UI, and coverage-report checks passed. In a disposable checkout, go test -coverprofile=cover-final.raw -coverpkg=./cmd/...,./internal/... ./... passed (100% measured Go statement coverage). go run ./cmd/ocap-testkit run route-access legacy-upload playback-delivery conversion-recovery passed. UI build, npx --no-install tsc --noEmit, npx --no-install eslint src/, and npm run test:coverage passed (2,519 passed, 13 skipped, 100% measured coverage). An additional synthetic route test reproduced both 503s in finding 2; finding 1 is from tracing server delivery. No native Windows or browser-rendered checks were run.

… copies

- The manifest with its sidecars, the .json.gz and the .json are now
  checked and served separately. A damaged copy in one format returns
  503 only for itself, and the other format still plays, masked. A
  recording is marked as checked once all three are clean.
- A precompressed manifest left without its manifest.pb, as a partial
  restore can leave one, fails the check. It is never served by name or
  as an encoding, and it is left on disk.
- A manifest whose version is neither 1 nor 2, such as one damaged at
  its start, fails the check instead of passing as converted. The
  sidecars of a converted manifest are now compared with it too.
- A .json request is no longer answered with the .json.gz beside it as
  if that were its sidecar. Only the manifest's own sidecars stand in
  for it.
- /data/ refuses manifest.* files other than the manifest and its
  sidecars, and files under the server's temporary names (.stream-*,
  .<file>.tmp*, and <name>.json.gz.tmp from older uploads), since no
  check reads them.
- Route tests cover both damage directions, orphaned gzip and zstd
  sidecars, and each kind of unchecked copy. The testkit fixture is now
  ocap-local-v7.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@YetheSamartaka
YetheSamartaka requested a review from fank December 3, 2026 07:53
@fank

fank commented Dec 3, 2026 •

Copy link
Copy Markdown
Member

Ratatoskr reviewed this pull request.

Changes requested on 88e3dafe. See the review.

Finished 2026-12-03 08:14 UTC.

@fank fank left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

REQUEST_CHANGES — 2 blockers: an incomplete upload can overwrite a good recording, and playback does not use the intact copy.

Review details
  1. An incomplete gzip upload can replace a working recording. maskJSONChat stops at the closing JSON brace; openRecordingJSON closes the gzip reader without reading to EOF, so it can miss a truncated or invalid trailer. At the registered upload route, a synthetic replacement containing complete JSON but missing the gzip trailer returned 200 and overwrote the good file byte-for-byte with the corrupt upload. Reading the replacement through gzip returned unexpected EOF. Validate through EOF before publishing the staged file, and pin that an invalid replacement returns 400 and preserves the existing file.
  2. The intact JSON copy is downloadable, but the recording still fails to play. loadRecording.ts:38–49 chooses one format from the DB metadata. For a native v2 row, a manifest 503 ends playback without requesting the intact JSON copy. A focused loader test with a 503 from the manifest and a working JSON response confirmed this. The new route test proves the copy can be fetched directly, not the documented behavior that the other format stays playable. Fall back to the checked JSON copy on a protobuf load failure and test opening a recording whose metadata still says protobuf. Do not serve unchecked protobuf to make the fallback work.

Earlier discussions: Rechecked the previous review. Orphaned gzip and zstd manifest sidecars are now refused, and a damaged JSON copy no longer makes a good manifest return 503. The reverse direction is fixed at the asset route but not at playback (finding 2). The earlier staging, bounded chat scan, paging retry, converted chat, alias/index, and filtering fixes remain covered. GraphQL found no review threads; none were resolved, left open, or skipped. The earlier findings were in submitted review bodies.

Verification at 88e3dafe: GitHub Go, UI, and coverage-report checks passed. In a disposable copy, go test -coverprofile=cover.raw -coverpkg=./cmd/...,./internal/... ./... passed (100% measured statements), and go run ./cmd/ocap-testkit run route-access legacy-upload playback-delivery conversion-recovery passed. UI npm run build, npx --no-install tsc --noEmit, npx --no-install eslint src/, and npm run test:coverage passed (2,519 passed, 13 skipped, 100% measured coverage). Two additional isolated regression tests reproduced the findings above. No browser-rendered, native Windows, or native map-tool checks were run.

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