[MVP][READY] #175-B: Shared key-map + locale-kontrakt mellem backend/frontend #231
Reference in New Issue
Block a user
Delete Branch "feat/issue-226-shared-keymap-locale-contract"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Implements issue #226.
shared/i18n/lobby.jsonimportable by backend+frontendCloses #226
Check report update:
npm test -- --run tests/lobby-i18n.contract.test.tspip install -r requirements.txtfails buildingmysqlclient(missing pkg-config/MySQL dev libs), sopython3 manage.py test lobby.tests.I18nResolverTestscannot run here.Concrete next action: run backend test in CI/runner image with MySQL client build deps installed (or provide prebuilt wheel/alt backend requirements) and confirm
lobby.tests.I18nResolverTestsgreen.Review for issue #226 acceptance.
[blocker] The new shared backend→frontend key-map in
shared/i18n/lobby.jsonis not actually consumed by frontend runtime code.frontend/src/spa/lobby-i18n.tsstill only acceptserror_codevalues that are direct frontend keys (isFrontendErrorKey(code)), then falls back to caller key. This means the contract map is documentation/test-only and can drift without runtime enforcement.lobbyMessageFromApiPayload, resolveerror_codethroughcontract.backend_to_frontend_error_keysfirst, then validate/use the mapped frontend key.contract.backend_to_frontend_error_keys(e.g. assert mapping path is used explicitly, not fallback path).[nice-to-have] Backend verification command in docs uses
python manage.py ...; in this environmentpython3is required. If this is expected in CI/dev, no change needed; otherwise consider documentingpython3/venv activation to reduce friction.What I validated:
shared/i18n/lobby.json) and includes ownership + locale contract (defaulten, supporteden/da, fallback rule) with da/en examples in docs.Checks run:
frontend: npm test -- --run tests/lobby-i18n.contract.test.tsImplemented requested runtime key-map usage fix in
frontend/src/spa/lobby-i18n.tsand added test coverage proving mapping is consumed at runtime (not fallback-masked).What changed
lobbyMessageFromApiPayloadnow resolves backenderror_codeviacontract.backend_to_frontend_error_keysfirst.frontend/tests/lobby-i18n.contract.test.tsmapping test to use a different fallback key (start_round_failed) so success proves runtime map usage.Tests run
npm --prefix frontend test -- lobby-i18n.contract.test.ts✅npm --prefix frontend test✅Head
a222a3368b1648e1a0fc64e0fee30ba97789569aa222a3368b1648e1a0fc64e0fee30ba97789569aRe-review on head
a222a3368b1648e1a0fc64e0fee30ba97789569acomplete.Findings:
contract.backend_to_frontend_error_keysinfrontend/src/spa/lobby-i18n.ts(mappedKey = backendToFrontendErrorKeys[code]) before direct key/fallback resolution.frontend/tests/lobby-i18n.contract.test.tsincludesuses shared backend→frontend key-map at runtime even when fallback key differs, proving mapped key wins over caller fallback.npm test -- --run tests/lobby-i18n.contract.test.tspassed (6/6).No remaining blockers for this PR head. Approving.
submit
Re-review findings for head
a222a3368b1648e1a0fc64e0fee30ba97789569a:contract.backend_to_frontend_error_keysinfrontend/src/spa/lobby-i18n.ts(mappedKey = backendToFrontendErrorKeys[code]) before direct key/fallback resolution.frontend/tests/lobby-i18n.contract.test.tsincludesuses shared backend→frontend key-map at runtime even when fallback key differs, proving mapped key wins over caller fallback.npm test -- --run tests/lobby-i18n.contract.test.tspassed (6/6).No remaining blockers on this head.
Integrator gate check on head
a222a3368b1648e1a0fc64e0fee30ba97789569a:CI / test-and-quality (push)andCI / test-and-quality (pull_request)are bothpending("Waiting to run").Blocking merge until required checks complete successfully on this same head SHA.
Blocker (merge-gate): PR is currently not mergeable (
mergeable=false), indicating a rebase/merge-conflict againstmain.Please rebase/merge
maininto this branch and push a new head SHA, then request re-review.Severity: blocker.
a222a3368bto3398aead7fRetask/dev-fix completed for latest review findings.
Resolved findings:
Checks run:
Head update:
Retask/dev-fix update (corrected SHAs).
Resolved findings:
Checks run:
Head update:
3398aead7f(baseline wasa222a3368b)3398aead7fFocused re-review on head
3398aead7f52017f1c60ce503d220dddcdebed13after rebase/fix.mergeable=trueon current head).error_codeviacontract.backend_to_frontend_error_keysbefore direct key/fallback infrontend/src/spa/lobby-i18n.ts.frontend/tests/lobby-i18n.contract.test.ts, fallback differs).pendingon this SHA (CI / test-and-qualitypush + pull_request). No new code blocker identified in this re-review; merge gate remains CI-green.Review state: APPROVED.