fix: address code review feedback on PvP live session stack#37
Merged
ThunderConch merged 1 commit intoApr 12, 2026
Merged
Conversation
- sendCurrentSnapshot: clone session before mutation so seq/updatedAt are not modified in-place before the transport send; consistent with the immutable pattern used everywhere else in PvpWsServer - battle-command-service: document why seenClientCommandIds linear scan is acceptable (bounded by turns × seats, cleared on battle end) - pvp-live CLI: fall back to PVP_AUTH_TOKEN / PVP_SERVER_URL env vars so tokens are not required in shell args (and exposed in history) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Owner
Codex Adversarial Review 결과:
|
ThunderConch
added a commit
that referenced
this pull request
Apr 12, 2026
)" This reverts commit 25543ac.
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.
코드 리뷰에서 지적된 세 가지를 수정합니다.
변경 사항
sendCurrentSnapshot직접 변이 수정 (pvp-ws-server.ts)기존 코드는 파라미터로 받은
session을 직접 변이(nextSeq += 1,updatedAt,eventLog.push)한 뒤 저장했습니다. 코드베이스 전체에서 유일하게 불변성 패턴을 깨는 지점이었고,transport.send()가 예외를 던지면 seq가 이미 증가된 상태로 저장되는 문제가 있었습니다.cloneSession()후 복사본을 변이하도록 수정했습니다.seenClientCommandIdsO(n) 탐색 주석 추가 (battle-command-service.ts)배열이 배틀 수명 동안 bounded(turns × seats)되어 있어 선형 탐색이 실용적으로 문제없음을 명시했습니다.
auth token env var 지원 (
pvp-live.ts)--auth-token을 CLI 인자로만 받으면 shell 히스토리에 노출됩니다.PVP_AUTH_TOKEN/PVP_SERVER_URL환경변수로도 설정할 수 있도록 fallback을 추가했습니다.🤖 Generated with Claude Code