[kimi] refactor: extract presence state serializer from workshop heartbeat (#668) #697

Merged
kimi merged 1 commits from kimi/issue-668 into main 2026-03-21 13:41:43 +00:00
Collaborator

Fixes #668

Summary

  • Extracted _build_world_state() logic from src/dashboard/routes/world.py into a standalone serialize_presence() function in src/infrastructure/presence.py
  • Updated world.py to delegate to serialize_presence() — no behavior change
  • Added tests/unit/test_presence.py with round-trip, defaults, partial input, and edge-case tests

Test plan

  • tox -e unit passes (2407 passed)
  • tox -e lint passes
  • tox -e pre-push passes (full CI mirror)
Fixes #668 ## Summary - Extracted `_build_world_state()` logic from `src/dashboard/routes/world.py` into a standalone `serialize_presence()` function in `src/infrastructure/presence.py` - Updated `world.py` to delegate to `serialize_presence()` — no behavior change - Added `tests/unit/test_presence.py` with round-trip, defaults, partial input, and edge-case tests ## Test plan - [x] `tox -e unit` passes (2407 passed) - [x] `tox -e lint` passes - [x] `tox -e pre-push` passes (full CI mirror)
kimi added 1 commit 2026-03-21 13:41:27 +00:00
refactor: extract presence state serializer from workshop heartbeat
Some checks failed
Tests / lint (pull_request) Has been cancelled
Tests / test (pull_request) Has been cancelled
c5ad8e8aff
Extract _build_world_state() logic from dashboard/routes/world.py into
a standalone serialize_presence() function in infrastructure/presence.py.
This allows the WebSocket gateway and other consumers to reuse the
ADR-023 presence-to-world-state transformation without importing the
dashboard route module.

- New: src/infrastructure/presence.py with serialize_presence()
- Updated: world.py delegates to serialize_presence()
- New: tests/unit/test_presence.py with round-trip and edge-case tests

Fixes #668

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
kimi merged commit 3474eeb4eb into main 2026-03-21 13:41:43 +00:00
kimi deleted branch kimi/issue-668 2026-03-21 13:41:43 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Rockachopa/Timmy-time-dashboard#697