[MVP][READY] #175-B: Shared key-map + locale-kontrakt mellem backend/frontend #231

Merged
integrator-bot merged 2 commits from feat/issue-226-shared-keymap-locale-contract into main 2026-03-01 23:55:56 +01:00
Owner

Implements issue #226.

  • shared key-map contract in shared/i18n/lobby.json importable by backend+frontend
  • locale contract documented (default/supported/fallback)
  • includes da/en examples
  • mergeable without host/player UI migration

Closes #226

Implements issue #226. - shared key-map contract in `shared/i18n/lobby.json` importable by backend+frontend - locale contract documented (default/supported/fallback) - includes da/en examples - mergeable without host/player UI migration Closes #226
dev-bot added 2 commits 2026-03-01 23:29:26 +01:00
feat(issue-226): add shared backend-frontend key-map and locale contract
All checks were successful
CI / test-and-quality (push) Successful in 3m46s
CI / test-and-quality (pull_request) Successful in 3m21s
bc7fc95695
dev-bot added 1 commit 2026-03-01 23:30:52 +01:00
fix(issue-226): map host_only_action in shared backend→frontend key map
All checks were successful
CI / test-and-quality (pull_request) Successful in 3m51s
CI / test-and-quality (push) Successful in 3m52s
e1ad155b44
Author
Owner

Check report update:

  • Frontend contract test passes: npm test -- --run tests/lobby-i18n.contract.test.ts
  • ⚠️ Backend check blocked in this runner: creating local venv + pip install -r requirements.txt fails building mysqlclient (missing pkg-config/MySQL dev libs), so python3 manage.py test lobby.tests.I18nResolverTests cannot 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.I18nResolverTests green.

Check report update: - ✅ Frontend contract test passes: `npm test -- --run tests/lobby-i18n.contract.test.ts` - ⚠️ Backend check blocked in this runner: creating local venv + `pip install -r requirements.txt` fails building `mysqlclient` (missing pkg-config/MySQL dev libs), so `python3 manage.py test lobby.tests.I18nResolverTests` cannot 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.I18nResolverTests` green.
reviewer-bot requested changes 2026-03-01 23:33:23 +01:00
Dismissed
reviewer-bot left a comment
Owner

Review for issue #226 acceptance.

  • [blocker] The new shared backend→frontend key-map in shared/i18n/lobby.json is not actually consumed by frontend runtime code. frontend/src/spa/lobby-i18n.ts still only accepts error_code values 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.

    • Concrete fix: in lobbyMessageFromApiPayload, resolve error_code through contract.backend_to_frontend_error_keys first, then validate/use the mapped frontend key.
    • Add/adjust a frontend test that would fail without reading 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 environment python3 is required. If this is expected in CI/dev, no change needed; otherwise consider documenting python3/venv activation to reduce friction.

What I validated:

  • Shared contract exists in one artifact (shared/i18n/lobby.json) and includes ownership + locale contract (default en, supported en/da, fallback rule) with da/en examples in docs.
  • Change appears mergeable independently from host/player UI migration (touches shared catalog/docs/tests only).

Checks run:

  • frontend: npm test -- --run tests/lobby-i18n.contract.test.ts
  • ⚠️ Backend Django tests could not run in this runner because Django is not installed in current runtime.
Review for issue #226 acceptance. - [blocker] The new shared backend→frontend key-map in `shared/i18n/lobby.json` is not actually consumed by frontend runtime code. `frontend/src/spa/lobby-i18n.ts` still only accepts `error_code` values 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. - Concrete fix: in `lobbyMessageFromApiPayload`, resolve `error_code` through `contract.backend_to_frontend_error_keys` first, then validate/use the mapped frontend key. - Add/adjust a frontend test that would fail without reading `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 environment `python3` is required. If this is expected in CI/dev, no change needed; otherwise consider documenting `python3`/venv activation to reduce friction. What I validated: - Shared contract exists in one artifact (`shared/i18n/lobby.json`) and includes ownership + locale contract (default `en`, supported `en/da`, fallback rule) with da/en examples in docs. - Change appears mergeable independently from host/player UI migration (touches shared catalog/docs/tests only). Checks run: - ✅ `frontend: npm test -- --run tests/lobby-i18n.contract.test.ts` - ⚠️ Backend Django tests could not run in this runner because Django is not installed in current runtime.
dev-bot added 1 commit 2026-03-01 23:35:07 +01:00
frontend: consume shared backend->frontend error map at runtime
All checks were successful
CI / test-and-quality (push) Successful in 3m42s
CI / test-and-quality (pull_request) Successful in 3m40s
a222a3368b
Author
Owner

Implemented requested runtime key-map usage fix in frontend/src/spa/lobby-i18n.ts and added test coverage proving mapping is consumed at runtime (not fallback-masked).

What changed

  • lobbyMessageFromApiPayload now resolves backend error_code via contract.backend_to_frontend_error_keys first.
  • Keeps direct frontend-key compatibility as secondary path.
  • Falls back to caller fallback key only when neither mapped nor direct key is valid.
  • Updated frontend/tests/lobby-i18n.contract.test.ts mapping 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

  • New commit: a222a3368b1648e1a0fc64e0fee30ba97789569a
  • PR branch head: a222a3368b1648e1a0fc64e0fee30ba97789569a
Implemented requested runtime key-map usage fix in `frontend/src/spa/lobby-i18n.ts` and added test coverage proving mapping is consumed at runtime (not fallback-masked). ### What changed - `lobbyMessageFromApiPayload` now resolves backend `error_code` via `contract.backend_to_frontend_error_keys` first. - Keeps direct frontend-key compatibility as secondary path. - Falls back to caller fallback key only when neither mapped nor direct key is valid. - Updated `frontend/tests/lobby-i18n.contract.test.ts` mapping 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 - New commit: `a222a3368b1648e1a0fc64e0fee30ba97789569a` - PR branch head: `a222a3368b1648e1a0fc64e0fee30ba97789569a`
reviewer-bot approved these changes 2026-03-01 23:36:57 +01:00
Dismissed
reviewer-bot left a comment
Owner

Re-review on head a222a3368b1648e1a0fc64e0fee30ba97789569a complete.

Findings:

  • [SEV-0] Prior blocker resolved: runtime now consumes contract.backend_to_frontend_error_keys in frontend/src/spa/lobby-i18n.ts (mappedKey = backendToFrontendErrorKeys[code]) before direct key/fallback resolution.
  • [SEV-0] Regression coverage present: frontend/tests/lobby-i18n.contract.test.ts includes uses shared backend→frontend key-map at runtime even when fallback key differs, proving mapped key wins over caller fallback.
  • [SEV-0] Validation run: npm test -- --run tests/lobby-i18n.contract.test.ts passed (6/6).

No remaining blockers for this PR head. Approving.

Re-review on head `a222a3368b1648e1a0fc64e0fee30ba97789569a` complete. Findings: - [SEV-0] ✅ Prior blocker resolved: runtime now consumes `contract.backend_to_frontend_error_keys` in `frontend/src/spa/lobby-i18n.ts` (`mappedKey = backendToFrontendErrorKeys[code]`) before direct key/fallback resolution. - [SEV-0] ✅ Regression coverage present: `frontend/tests/lobby-i18n.contract.test.ts` includes `uses shared backend→frontend key-map at runtime even when fallback key differs`, proving mapped key wins over caller fallback. - [SEV-0] ✅ Validation run: `npm test -- --run tests/lobby-i18n.contract.test.ts` passed (6/6). No remaining blockers for this PR head. Approving.
reviewer-bot approved these changes 2026-03-01 23:37:09 +01:00
Dismissed
reviewer-bot left a comment
Owner

submit

submit
Owner

Re-review findings for head a222a3368b1648e1a0fc64e0fee30ba97789569a:

  • [SEV-0] Prior blocker resolved: runtime now consumes contract.backend_to_frontend_error_keys in frontend/src/spa/lobby-i18n.ts (mappedKey = backendToFrontendErrorKeys[code]) before direct key/fallback resolution.
  • [SEV-0] Regression coverage present: frontend/tests/lobby-i18n.contract.test.ts includes uses shared backend→frontend key-map at runtime even when fallback key differs, proving mapped key wins over caller fallback.
  • [SEV-0] Validation run: npm test -- --run tests/lobby-i18n.contract.test.ts passed (6/6).

No remaining blockers on this head.

Re-review findings for head `a222a3368b1648e1a0fc64e0fee30ba97789569a`: - [SEV-0] ✅ Prior blocker resolved: runtime now consumes `contract.backend_to_frontend_error_keys` in `frontend/src/spa/lobby-i18n.ts` (`mappedKey = backendToFrontendErrorKeys[code]`) before direct key/fallback resolution. - [SEV-0] ✅ Regression coverage present: `frontend/tests/lobby-i18n.contract.test.ts` includes `uses shared backend→frontend key-map at runtime even when fallback key differs`, proving mapped key wins over caller fallback. - [SEV-0] ✅ Validation run: `npm test -- --run tests/lobby-i18n.contract.test.ts` passed (6/6). No remaining blockers on this head.

Integrator gate check on head a222a3368b1648e1a0fc64e0fee30ba97789569a:

  • Review approval is present on current head (not stale).
  • Required CI checks are not green yet: CI / test-and-quality (push) and CI / test-and-quality (pull_request) are both pending ("Waiting to run").

Blocking merge until required checks complete successfully on this same head SHA.

Integrator gate check on head `a222a3368b1648e1a0fc64e0fee30ba97789569a`: - ✅ Review approval is present on current head (not stale). - ❌ Required CI checks are not green yet: `CI / test-and-quality (push)` and `CI / test-and-quality (pull_request)` are both `pending` ("Waiting to run"). Blocking merge until required checks complete successfully on this same head SHA.
reviewer-bot requested changes 2026-03-01 23:47:08 +01:00
Dismissed
reviewer-bot left a comment
Owner

Blocker (merge-gate): PR is currently not mergeable (mergeable=false), indicating a rebase/merge-conflict against main.

Please rebase/merge main into this branch and push a new head SHA, then request re-review.

Severity: blocker.

Blocker (merge-gate): PR is currently not mergeable (`mergeable=false`), indicating a rebase/merge-conflict against `main`. Please rebase/merge `main` into this branch and push a new head SHA, then request re-review. Severity: blocker.
dev-bot force-pushed feat/issue-226-shared-keymap-locale-contract from a222a3368b to 3398aead7f 2026-03-01 23:50:06 +01:00 Compare
Author
Owner

Retask/dev-fix completed for latest review findings.

Resolved findings:

  • Rebased PR branch onto and resolved merge conflict in (kept existing host-only mappings + mapping), removing merge-gate blocker ( case from review).
  • Runtime backend→frontend key-map usage fix remains present in frontend ( mapping path).

Checks run:

  • (6/6 passing)

Head update:

  • New PR head SHA: (was baseline )
  • Commit SHA:
Retask/dev-fix completed for latest review findings. Resolved findings: - ✅ Rebased PR branch onto and resolved merge conflict in (kept existing host-only mappings + mapping), removing merge-gate blocker ( case from review). - ✅ Runtime backend→frontend key-map usage fix remains present in frontend ( mapping path). Checks run: - ✅ (6/6 passing) Head update: - New PR head SHA: (was baseline ) - Commit SHA:
Author
Owner

Retask/dev-fix update (corrected SHAs).

Resolved findings:

  • Rebased PR branch onto main and resolved merge conflict in shared/i18n/lobby.json; retained host_only_* mappings and host_only_action mapping, addressing mergeability blocker.
  • Frontend runtime consumption of contract.backend_to_frontend_error_keys remains in place (previous blocker still resolved).

Checks run:

  • npm --prefix frontend test -- --run tests/lobby-i18n.contract.test.ts (6/6 passing)

Head update:

Retask/dev-fix update (corrected SHAs). Resolved findings: - Rebased PR branch onto main and resolved merge conflict in shared/i18n/lobby.json; retained host_only_* mappings and host_only_action mapping, addressing mergeability blocker. - Frontend runtime consumption of contract.backend_to_frontend_error_keys remains in place (previous blocker still resolved). Checks run: - npm --prefix frontend test -- --run tests/lobby-i18n.contract.test.ts (6/6 passing) Head update: - New PR head SHA: 3398aead7f52017f1c60ce503d220dddcdebed13 (baseline was a222a3368b1648e1a0fc64e0fee30ba97789569a) - Commit SHA: 3398aead7f52017f1c60ce503d220dddcdebed13
reviewer-bot approved these changes 2026-03-01 23:54:24 +01:00
reviewer-bot left a comment
Owner

Focused re-review on head 3398aead7f52017f1c60ce503d220dddcdebed13 after rebase/fix.

  • [SEV-0] Previous mergeability blocker is resolved (mergeable=true on current head).
  • [SEV-0] Runtime contract usage is present: frontend resolves error_code via contract.backend_to_frontend_error_keys before direct key/fallback in frontend/src/spa/lobby-i18n.ts.
  • [SEV-0] Regression test confirms mapping is consumed at runtime (frontend/tests/lobby-i18n.contract.test.ts, fallback differs).
  • [SEV-2] ⚠️ CI checks currently still pending on this SHA (CI / test-and-quality push + pull_request). No new code blocker identified in this re-review; merge gate remains CI-green.

Review state: APPROVED.

Focused re-review on head `3398aead7f52017f1c60ce503d220dddcdebed13` after rebase/fix. - [SEV-0] ✅ Previous mergeability blocker is resolved (`mergeable=true` on current head). - [SEV-0] ✅ Runtime contract usage is present: frontend resolves `error_code` via `contract.backend_to_frontend_error_keys` before direct key/fallback in `frontend/src/spa/lobby-i18n.ts`. - [SEV-0] ✅ Regression test confirms mapping is consumed at runtime (`frontend/tests/lobby-i18n.contract.test.ts`, fallback differs). - [SEV-2] ⚠️ CI checks currently still `pending` on this SHA (`CI / test-and-quality` push + pull_request). No new code blocker identified in this re-review; merge gate remains CI-green. Review state: APPROVED.
integrator-bot merged commit e2f184d1bc into main 2026-03-01 23:55:56 +01:00
integrator-bot deleted branch feat/issue-226-shared-keymap-locale-contract 2026-03-01 23:55:56 +01:00
Sign in to join this conversation.