Repository navigation
Accept the join_verify degraded verdict and log it at warn - #5881
Conversation
infra #928 lets POST /join_verify answer 200 {status:"error"} when siteverify or the name check fails or runs past its 4 s budget, with the screened username/clanTag attached when the name check finished. The game server's verdict schema only accepted approved/rejected, so that answer was logged as a malformed response at error level and the API's name verdict was dropped. Accept the error status, use the API's identity when present, and log the API-reported degradation as "join_verify degraded" at warn. An unreachable API, a non-2xx or a malformed body stays "join_verify error" at error. Compatible with the current API, which never sends status "error". Fixes openfrontio/ai-ops#98 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Pn2xZjE8oUY44wToJE4NFe
|
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (3)
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review. WalkthroughJoin verification errors now indicate whether the failure is degraded and may include an API-screened identity. The worker applies that identity when present and logs degraded verdicts as warnings. ChangesJoin verification
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~12 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to No actionable merge-blocking issue was established; the change is ready for normal merge checks. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. An API name arrives, Comment |
🤖 Claude Code ReviewVerdict: No issues found. 0 findings (0 high, 0 medium, 0 low). Checked for bugs and CLAUDE.md compliance. The new |
Resolves openfrontio/ai-ops#98 (no OpenFrontIO issue; filed by the ops pipeline)
Description:
What was wrong. infra #928 bounds
POST /join_verifyat 4 s. When siteverify or the name check fails or runs past that budget, it answers200 {status:"error", reason, username?, clanTag?}, with the screened identity attached when the name check finished.JoinVerifyVerdictSchemahere accepted onlyapprovedandrejected. Once #928 is deployed, every one of those answers would be logged asapi-worker returned malformed responseat error level, and the API's name verdict would be thrown away. Fail-open joins were already running at about 10× their usual rate (see the ai-ops issue), so those lines would keep firing and the joins would fall back to the coarser local censor.What changed.
src/server/JoinVerify.ts: the schema now acceptsstatus: "error".JoinVerifyResponse's error variant gains two fields:degraded: true when the API itself reported the failure, false for abort/network, non-2xx or a malformed body.identity: the API's screened{username, clanTag}, present only when the name check finished; an absentclanTagbecomes null.src/server/Worker.ts: onerror, the join uses the API's identity when it is present and otherwise keeps the locally screened name, as before. The API-reported case is logged asjoin_verify degradedat warn. An unreachable or broken API is stilljoin_verify errorat error.status: "error".Note for dashboards and alerts: budgeted degradations move from the
join_verify errorline tojoin_verify degraded. Nothing in infra'ssrc/opsqueries this line. Grafana queries such as the issue's|= "join_verify error"will only count real outages from now on.Alternatives considered. I kept one log message and only lowered its level. Two distinct messages make the outage case easy to count on its own, and the existing query keeps its meaning. I also considered keeping the local censor even when the API sends an identity. The API's name check is the authoritative screen, and the same identity is applied on approval, so this PR uses it.
What I ran.
npx vitest tests/server/JoinVerify.test.ts --runwith the new tests and without the fix: 7 failed (3 new degraded-verdict tests, plus 4 existing failure-mode tests that now also assertdegraded: false). With the fix all 23 pass.npx vitest tests/server --run: 912 passed.npm run typecheck,npm run lintand prettier on the touched files all pass.Please complete the following:
Fixes openfrontio/ai-ops#98
🤖 Generated with Claude Code
https://claude.ai/code/session_01Pn2xZjE8oUY44wToJE4NFe
Generated by Claude Code