feat(web): streaming CSV export of hunt participants and results - #1212
Open
autarch-agent wants to merge 1 commit into
Open
feat(web): streaming CSV export of hunt participants and results#1212autarch-agent wants to merge 1 commit into
autarch-agent wants to merge 1 commit into
Conversation
Implements Samuel1-ona#1184: - participantsExport.ts: privacy-aware participant row collection (shareResults=false excludes the row entirely, before ranking) - streamParticipantsCsv: chunked ReadableStream (header + N-size chunks) so large hunts export without buffering the whole file - csv escaping (commas, quotes, newlines) with proper doubling - pure module: data sources injected by caller; no server-only imports - 4/4 unit tests passing under vitest.no-setup.config.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Implements the export core for CSV export of hunt participants and results (#1184), mirroring the existing leaderboard export but adding participant data, privacy filtering, and streaming.
How
New
apps/web/lib/participantsExport.ts(pure module — data sources injected by the caller route, so it stays unit-testable):shareResults: falseare excluded before ranking — their rows never leave the server, and remaining ranks re-number correctly.streamParticipantsCsv(total, chunkSize, rowSource)returns aReadableStream<Uint8Array>that pulls rows in chunks through the injected source — large hunts never buffer fully in memory (acceptance criterion).rank,wallet,alias,score,completion_time,joined_at.Tests
4/4 passing under
vitest.no-setup.config.ts:Resolves #1184