Add localizable metadata to ban notices#1083
Conversation
Keep the existing English notice text for old clients while adding machine-readable ban fields that newer clients can translate.\n\nConstraint: FAF/server#640 asks the server to stop relying only on rendered English ban text.\nRejected: Replace the notice text outright | would break existing clients before client-side localization lands.\nConfidence: medium\nScope-risk: narrow\nDirective: Preserve the legacy text field until all supported clients consume i18n_key.\nTested: python3 -m py_compile server/exceptions.py server/lobbyconnection.py tests/unit_tests/test_lobbyconnection.py tests/integration_tests/test_login.py; git diff --check\nNot-tested: pytest suite, because local Python environment lacks pytest/pipenv and project services.
📝 WalkthroughWalkthroughThe PR refactors ban error messaging by extracting notice payload construction into a ChangesBan Notice Refactoring
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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. Comment |
Refresh the lock hash without dependency churn and make the existing QDataStream byte packing type explicit so the PR can be reviewed against its ban-notice change instead of unrelated CI drift. Constraint: upstream CI runs pipenv verify and mypy on the PR merge ref. Rejected: full pipenv lock regeneration | it changed many package pins unrelated to this issue. Confidence: high Scope-risk: narrow Directive: keep future bounty follow-ups focused on merge blockers only; avoid dependency churn unless a maintainer requests it. Tested: /tmp/faf-pipenv-venv/bin/pipenv verify; /opt/homebrew/bin/python3.13 -m py_compile server/exceptions.py server/lobbyconnection.py server/protocol/qdatastream.py tests/integration_tests/test_login.py tests/unit_tests/test_lobbyconnection.py; git diff --check Not-tested: full pytest suite unavailable locally without project service dependencies
Update the exact-dict assertion so the test checks the legacy English text plus the structured i18n fields added by the bounty fix. Constraint: CI still exercises the old live-ban game command path. Rejected: removing legacy text assertion | old clients still depend on that fallback field. Confidence: high Scope-risk: narrow Directive: keep notice tests asserting both backward-compatible text and localization metadata. Tested: /opt/homebrew/bin/python3.13 -m py_compile tests/integration_tests/test_server.py; git diff --check Not-tested: local integration pytest requires MySQL service; GitHub Actions provides that service
Trigger a fresh CI run after the only remaining failure was an unrelated matchmaker timeout in tests/integration_tests/test_matchmaker_violations.py::test_violation_config_disabled[json]. Constraint: GitHub does not allow fork author to rerun failed upstream Actions jobs without repository admin rights. Rejected: changing unrelated matchmaker tests | failure is outside the ban-notice bounty scope. Confidence: medium Scope-risk: narrow Directive: do not patch unrelated flaky matchmaker behavior unless maintainers request it. Tested: previous run passed pipenv-verify, mypy, flake8, isort, docker-build, Codacy, and 1009/1010 unit tests. Not-tested: rerun could still hit same upstream flake Co-authored-by: OmX <omx@oh-my-codex.dev>
|
Follow-up: CI is green now. The branch keeps the localized ban notice payload small and backward-compatible ( |
|
Opened the companion lobby-model PR so clients can consume the new notice metadata without raw JSON handling: FAForever/faf-java-commons#277 |
|
Opened the Downlord client companion PR as well: FAForever/downlords-faf-client#3514 That completes the chain for the funded issue: server emits the metadata, faf-java-commons models it, and the client can render localized notice text while falling back to the legacy |
Constraint: FAForever/server#1083 adds optional notice i18n metadata before faf-java-commons is released to this client. Rejected: Bump commons immediately | no published artifact contains the new notice fields yet. Confidence: medium Scope-risk: narrow Directive: Replace reflection with direct NoticeInfo getters after the commons dependency includes i18nKey and i18nArgs. Tested: git diff --check Not-tested: Gradle tests locally; no Java runtime installed in this environment. Co-authored-by: OmX <omx@oh-my-codex.dev>
Constraint: FAForever/server#1083 adds optional notice i18n metadata before faf-java-commons is released to this client. Rejected: Bump commons immediately | no published artifact contains the new notice fields yet. Confidence: medium Scope-risk: narrow Directive: Replace reflection with direct NoticeInfo getters after the commons dependency includes i18nKey and i18nArgs. Tested: git diff --check Not-tested: Gradle tests locally; no Java runtime installed in this environment. Co-authored-by: OmX <omx@oh-my-codex.dev>
|
The mixing of i18n_args and explicit fields like expired_at is inconsistent. Also none of the projects use issue hunt any longer. |
Addresses #640
This keeps the existing English ban notice text for current clients, but adds structured fields clients can use for localization:
i18n_key:login.error.bannedi18n_args:[expires_at, ban_reason]expires_at: the ban expiry as an ISO timestampThat gives the Downlord client enough data to translate/render the message locally without breaking older clients that still read
text.Companion PRs:
Verification:
unit-test— passeddocker-build— passedisort,flake8,mypy,pipenv-verify— passedpatchandproject— passedpython3 -m py_compile server/exceptions.py server/lobbyconnection.py tests/unit_tests/test_lobbyconnection.py tests/integration_tests/test_login.pygit diff --checkNot run locally: pytest, because this machine does not have the repo pipenv/pytest environment installed.