Commit Graph

17 Commits

Author SHA1 Message Date
c9af89a852 fix: CompleteRaid 보상 지급 블로킹 제거
All checks were successful
Server CI/CD / lint-and-build (push) Successful in 36s
Server CI/CD / deploy (push) Successful in 51s
HTTP 핸들러에서 동기 재시도(3회 + sleep 1s/2s)를 제거하고
1회만 시도 후 실패 시 즉시 RewardFailure DB에 저장.
기존 RewardWorker가 백그라운드에서 재시도 처리.

변경 전: 최악 ~18초 블로킹 (데디서버 15초 타임아웃 초과)
변경 후: RPC 1회 × 플레이어 수 ≈ 2-3초

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 16:28:34 +09:00
d46ba47c63 feat: 파티 인원 기반 MaxPlayers 설정 + validate-entry에 expectedPlayers 응답
All checks were successful
Server CI/CD / lint-and-build (push) Successful in 56s
Server CI/CD / deploy (push) Successful in 56s
- RequestEntry에서 MaxPlayers를 len(usernames)로 설정 (기존 고정 3 → 동적)
- ValidateEntryToken 응답에 expectedPlayers 필드 추가
- 데디 서버가 파티 크기만큼 접속 시 레이드 시작 가능

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-22 18:54:13 +09:00
4c367e84ad Fix: entry token 만료 기반으로 stale waiting room 판단
All checks were successful
Server CI/CD / lint-and-build (push) Successful in 35s
Server CI/CD / deploy (push) Successful in 56s
타임아웃 대신 Redis entry token 존재 여부로 판단:
- pending token이 Redis에 남아있음 → 정상 로딩 중, 방 보존
- pending token이 없음 (만료/소비) → abandoned 확정, 즉시 정리

정상 로딩 중인 파티원의 방을 보호하면서도
강제 종료 유저의 즉각적 복구 가능.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 11:16:28 +09:00
7ece5f3c44 Fix: 로딩 중 강제 종료 시 stale waiting room 자동 정리
All checks were successful
Server CI/CD / lint-and-build (push) Successful in 38s
Server CI/CD / deploy (push) Successful in 55s
로딩 화면에서 강제 종료하면 BossRoom이 waiting 상태로 남아
재입장이 영구 차단되는 문제 수정.

- waiting 상태 2분 초과 BossRoom 자동 정리 (15초 주기)
- RequestEntry 시 해당 유저의 stale waiting room 선제 정리
- 연결된 RoomSlot도 idle로 리셋

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 11:00:36 +09:00
9883985968 Fix: 보상 이중 지급 방지, 에러 응답 개선, Rate Limit 조정
Some checks failed
Server CI/CD / lint-and-build (push) Failing after 32s
Server CI/CD / deploy (push) Has been skipped
- reward_worker에 txCheck 기반 이중 지급 방지 추가 (LastTxID 저장 후 재시도 전 확인)
- RewardFailure 모델에 LastTxID 필드 추가
- grantWithRetry가 txID를 반환하도록 변경
- 10회 재시도 초과 시 CRITICAL 로그에 상세 정보 포함
- 경험치 실패도 hasRewardFailure에 반영하여 reward_failed 상태 전이
- 에러 응답에 requestId 필드 포함 (관측성 개선)
- /api/auth/refresh를 authLimiter에서 분리 (NAT 환경 한도 초과 방지)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 21:01:45 +09:00
d6c75dcaad Fix: BossRoom 레코드 미삭제로 데디서버 슬롯 재사용 불가 수정
CompleteRaid/FailRaid에서 슬롯 리셋 전 BossRoom hard-delete 추가.
기존에는 BossRoom.SessionName uniqueIndex 충돌로 한 번 사용된 슬롯의
재사용이 불가능했음 (10개 중 점점 사용 가능 슬롯 감소).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 12:00:14 +09:00
f4d862b47f feat: 보상 재시도 + TX 확정 대기 + 에러 포맷 통일 + 품질 고도화
- 보상 지급 실패 시 즉시 재시도(3회 backoff) + DB 기록 + 백그라운드 워커 재시도
- WaitForTx 폴링으로 블록체인 TX 확정 대기, SendTxAndWait 편의 메서드
- chain 트랜잭션 코드 중복 제거 (userTx/operatorTx 헬퍼, 50% 감소)
- AppError 기반 에러 응답 포맷 통일 (8개 코드, 전 핸들러 마이그레이션)
- TX 에러 분류 + 한국어 사용자 메시지 매핑 (11가지 패턴)
- player 서비스 테스트 20개 + chain WaitForTx 테스트 10개 추가

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 16:42:03 +09:00
b16eb6cc7a feat: 에러 처리 표준화 + BossRaid 낙관적 잠금
에러 표준화:
- pkg/apperror — AppError 타입, 7개 sentinel error
- pkg/middleware/error_handler — Fiber ErrorHandler 통합
- 핸들러에서 AppError 반환 시 구조화된 JSON 자동 응답

BossRaid Race Condition:
- 상태 전이 4곳 낙관적 잠금 (UPDATE WHERE status=?)
- TransitionRoomStatus/TransitionRoomStatusMulti 메서드 추가
- ErrStatusConflict sentinel error

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 10:48:28 +09:00
fc976dbba8 fix: ResetRoom 시 BossRoom 레코드 정리
All checks were successful
Server CI/CD / lint-and-build (push) Successful in 15s
Server CI/CD / deploy (push) Successful in 57s
데디서버가 reset-room 호출 시 슬롯만 idle로 변경하고 BossRoom 레코드는
남아있어서 다음 입장 시 unique 제약 위반(Duplicate entry) 발생.
ResetRoom에서 해당 sessionName의 BossRoom 레코드도 함께 삭제.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 23:17:14 +09:00
22e0652ee3 fix: 좀비 슬롯 정리 및 보상 실패 상태 추적
All checks were successful
Server CI/CD / lint-and-build (push) Successful in 1m5s
Server CI/CD / deploy (push) Successful in 58s
- RequestEntry() 시 CheckStaleSlots() 호출하여 좀비 슬롯 자동 정리
- 블록체인 보상 실패 시 BossRoom 상태를 reward_failed로 업데이트
- UpdateRoomStatus() 레포지토리 메서드 추가

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 20:07:34 +09:00
befea9dd68 feat: Swagger API 문서 추가 + 보스레이드/플레이어 레벨 시스템
Some checks failed
Server CI/CD / lint-and-build (push) Failing after 12m3s
Server CI/CD / deploy (push) Has been cancelled
- swaggo/swag 기반 전체 API 엔드포인트 Swagger 어노테이션 (59개)
- /swagger/ 경로에 Swagger UI 제공
- 보스레이드 데디서버 관리 (등록, 하트비트, 슬롯 리셋)
- 플레이어 레벨/경험치 시스템 및 스탯 성장

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 17:51:37 +09:00
9504bf37de fix: RequestEntry TOCTOU 경쟁 조건 수정 — 트랜잭션으로 원자화
Some checks failed
Server CI/CD / lint-and-build (push) Failing after 38s
Server CI/CD / deploy (push) Has been skipped
중복 입장 방지를 위해 active-room 체크와 room 생성을 단일 트랜잭션으로 래핑

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 18:53:33 +09:00
b0de89a18a feat: 코드 리뷰 기반 전면 개선 — 보안, 검증, 테스트, 안정성
Some checks failed
Server CI/CD / lint-and-build (push) Failing after 47s
Server CI/CD / deploy (push) Has been skipped
- 체인 nonce 경쟁 조건 수정 (operatorMu + per-user mutex)
- 등록/SSAFY 원자적 트랜잭션 (wallet+profile 롤백 보장)
- IdempotencyRequired 미들웨어 (SETNX 원자적 클레임)
- 런치 티켓 API (JWT URL 노출 방지)
- HttpOnly 쿠키 refresh token
- SSAFY OAuth state 파라미터 (CSRF 방지)
- Refresh 시 DB 조회로 최신 role 사용
- 공지사항/유저목록 페이지네이션
- BodyLimit 미들웨어 (1MB, upload 제외)
- 입력 검증 강화 (닉네임, 게임데이터, 공지 길이)
- 에러 메시지 내부 정보 노출 방지
- io.LimitReader (RPC 10MB, SSAFY 1MB)
- RequestID 비출력 문자 제거
- 단위 테스트 (auth 11, announcement 9, bossraid 16)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 18:03:25 +09:00
cc8368dfba feat: 인프라 개선 — 헬스체크, 로깅, 보안, CI 검증
Some checks failed
Server CI/CD / lint-and-build (push) Failing after 1m13s
Server CI/CD / deploy (push) Has been skipped
- /health + /ready 엔드포인트 추가 (DB/Redis 상태 확인)
- RequestID 미들웨어 + 구조화 JSON 로깅
- 체인 트랜잭션 per-user rate limit (20 req/min)
- DB 커넥션 풀 설정 (MaxOpen 25, MaxIdle 10, MaxLifetime 5m)
- Graceful Shutdown 시 Redis/MySQL 연결 정리
- Dockerfile HEALTHCHECK 추가
- CI에 go vet + 빌드 검증 단계 추가 (deploy 전 실행)
- 보스 레이드 클라이언트 입장 API (JWT 인증)
- Player 프로필 모듈 추가

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 03:41:34 +09:00
d597ef2d46 fix: 보안·안정성·동시성 개선 3차
All checks were successful
Server CI/CD / deploy (push) Successful in 1m31s
- 입력 검증 강화 (로그인/체인 핸들러 전체)
- boss raid 비관적 잠금으로 동시성 문제 해결
- SSAFY 사용자명 sanitize + 트랜잭션 처리
- constant-time API 키 비교, 보안 헤더, graceful shutdown
- 안전하지 않은 기본값 경고 추가

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 21:40:06 +09:00
cc751653c4 fix: 코드 리뷰 기반 보안·안정성 개선 2차
All checks were successful
Server CI/CD / deploy (push) Successful in 1m26s
보안:
- RPC 응답 HTTP 상태코드 검증 (chain/client)
- SSAFY OAuth 에러 응답 내부 로깅으로 변경 (제3자 상세 노출 제거)
- resolveUsername에서 username 노출 제거
- LIKE 쿼리 특수문자 이스케이프 (bossraid/repository)
- 파일명 경로 순회 방지 + 길이 제한 (download/handler)
- ServerAuth 실패 로깅 추가

안정성:
- AutoMigrate 에러 시 서버 종료
- GetLatest() 에러 시 nil 반환 (초기화 안 된 포인터 방지)
- 멱등성 캐시 저장 시 새 context 사용
- SSAFY HTTP 클라이언트 타임아웃 10s
- io.ReadAll/rand.Read 에러 처리
- Login에서 DB 에러/Not Found 구분

검증 강화:
- 중복 플레이어 검증 (bossraid/service)
- username 길이 제한 50자 (auth/handler, bossraid/handler)
- 역할 변경 시 세션 무효화
- 지갑 복호화 실패 로깅

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 17:48:05 +09:00
61cf47070d feat: 보스 레이드 방 관리 모듈 추가
All checks were successful
Server CI/CD / deploy (push) Successful in 1m34s
MMO 서버/데디케이트 서버 연동을 위한 내부 API 엔드포인트 구현:
- POST /api/internal/bossraid/entry — 파티 입장 요청 (방 생성)
- POST /api/internal/bossraid/start — 세션 시작 보고
- POST /api/internal/bossraid/complete — 클리어 보고 + TOL Chain 보상 지급
- POST /api/internal/bossraid/fail — 실패 보고
- GET /api/internal/bossraid/room — 방 조회

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 17:14:03 +09:00