6.0 KiB
6.0 KiB
id, title, status, type, team, supporting_teams, roadmap_item, priority
| id | title | status | type | team | supporting_teams | roadmap_item | priority | |
|---|---|---|---|---|---|---|---|---|
| TASK-152 | Current match live kill feed | done | backend | Backend Senior |
|
rcon-full-data | high |
TASK-152 - Current match live kill feed
Goal
Expose recent current-match kill events and render them as a live visual feed
on partida-actual.html.
Background
The current-match page will exist at
partida-actual.html?server=<server_slug>. The backend already stores/parses
RCON AdminLog data and materializes kill/player stats for historical matches.
Existing materialization logic uses AdminLog kill payload fields such as:
killer_idkiller_namekiller_teamvictim_idvictim_namevictim_teamweapon
We now want a live/current-match kill feed similar to a FPS kill feed: killer, weapon, victim, teamkill distinction, timestamp.
Constraints / DO NOT BREAK
- Do not query RCON directly from the frontend.
- Do not expose raw AdminLog lines.
- Do not expose admin-only/sensitive fields.
- Do not break existing historical materialization.
- Do not break existing match detail player stats.
- Do not depend on server #03.
- Do not fabricate kill events.
- Do not duplicate kill rows on repeated polling.
- Keep polling safe.
Allowed Changes
- backend endpoint for current match kill feed
- backend read-model/helper for current/open match event window
- frontend current-match JS/CSS
- tests for event normalization/filtering where practical
Implementation Requirements
- Add a backend endpoint for recent current-match kill events by server.
- Supported servers:
comunidad-hispana-01comunidad-hispana-02
- Unknown server values must return a safe 400/404 style response and must not query arbitrary targets.
- The endpoint should return normalized event rows:
event_idevent_timestamporserver_timekiller_namekiller_teamvictim_namevictim_teamweaponis_teamkill- confidence/source if needed
- The endpoint should only return events belonging to the current/open match if that can be determined.
- If the current/open match window cannot be determined reliably, return a
safe recent window and include a clear confidence marker, for example:
- scope:
"recent-admin-log-window" - confidence:
"partial"
- scope:
- Do not return raw AdminLog text.
- Add frontend rendering for a kill feed:
- newest events visible at top or bottom consistently
- killer name
- weapon label/icon placeholder
- victim name
- timestamp
- teamkill visual distinction
- Prevent duplicate rendering:
- track
event_idvalues already rendered - update existing rows only if needed
- track
- Poll every 15-30 seconds.
- Add an empty state:
- "Todavía no se han detectado bajas en esta partida."
- Add an error/stale state:
- "No se pudo actualizar el feed de combate."
- Do not show fake/sample kill events in production UI.
Files to Read First
AGENTS.mdai/architecture-index.mdai/repo-context.mdai/orchestrator/backend-senior.md- current-match page files created by TASK-151
- AdminLog materialization/read-model files that already normalize kill data
Expected Files to Modify
- backend current-match kill feed endpoint/read-model files
- current-match frontend JS/CSS files
- focused tests for event normalization/filtering where practical
Validation
python -m compileall backend/app- Run backend tests related to AdminLog/materialization/current-match feed.
- Run
node --checkon current-match frontend JS. - Review
git diff --name-onlyand confirm the changed files match this task.
Manual Verification
- Open
partida-actual.html?server=comunidad-hispana-01. - Open
partida-actual.html?server=comunidad-hispana-02. - Verify kill feed renders only normalized events.
- Verify repeated polling does not duplicate rows.
- Verify teamkills are visually distinguishable.
- Verify raw AdminLog lines are never displayed.
Commit Message
feat: add current match live kill feed
Expected Outcome
The current-match page can show a safe, normalized, non-duplicated live kill feed based on RCON/AdminLog data.
Outcome
- Added read-only
GET /api/current-match/kills?server=&limit=for the active trusted Comunidad Hispana servers. Unsupported servers fail before any AdminLog query is built. - Added a safe AdminLog kill feed read that emits normalized fields only:
generated
event_id, event time/server time, killer/victim names and teams, weapon, and computedis_teamkill. It does not return raw AdminLog text, player ids or admin-only payload fields. - Feed scope prefers
open-admin-log-match-windowwithconfidence: "admin-log-boundary"when the latest AdminLog boundary for the server is an unmatchedmatch_start. Otherwise it returnsrecent-admin-log-windowwithconfidence: "partial"as the explicit fallback. - Extended
partida-actual.jsto poll the feed with the existing 30-second in-flight-protected current-match refresh cycle, dedupe rows byevent_id, keep newest events ordered by server/event time, render a TK badge for teamkills, and show empty/error states without fake rows. - Added a focused AdminLog storage test for open-window filtering and teamkill
normalization. The environment does not have
pytestinstalled (pytestandpython -m pytestboth failed), so the same storage normalization path was verified with a narrow inline Python scenario. - Validation:
python -m compileall backend/app;node --check frontend/assets/js/partida-actual.js;powershell -ExecutionPolicy Bypass -File scripts/run-integration-tests.ps1; narrow inline route guard check for missing, unknown and invalid-limit feed requests; inline storage normalization check excluding pre-window kills and confirming no raw message field leaks. - Scope review:
git diff --name-onlyandgit status --shortwere reviewed.
Change Budget
- Prefer fewer than 5 modified files.
- Prefer changes under 200 lines when feasible.
- Split the work into follow-up tasks if the scope grows.