docs(tasks): update task artifacts for stats workflow

This commit is contained in:
devRaGonSa
2026-06-07 21:59:55 +02:00
parent fbb8adbf01
commit 1b3cbbfb1b
4 changed files with 522 additions and 11 deletions

View File

@@ -0,0 +1,83 @@
---
id: TASK-161
title: Current match full player summary and feed badges
status: done
type: backend
team: Backend Senior
supporting_teams:
- Frontend Senior
- Experto en interfaz
roadmap_item: foundation
priority: medium
---
# TASK-161 - Current match full player summary and feed badges
## Goal
Ampliar el resumen de jugadores de `/api/current-match/players` para incluir a todos los participantes detectados de la partida actual y ajustar el feed de combate para mostrar nombre + facción en una sola línea sin cambiar su lógica funcional.
## Context
`frontend/partida-actual.html` ya expone feed de combate y tabla de estadísticas en vivo. El payload actual de jugadores depende solo de eventos `kill`, por lo que deja fuera jugadores conectados o vistos en la ventana de partida actual sin bajas registradas.
## Steps
1. Revisar parser, storage y payloads actuales de `current match`.
2. Ampliar la agregación backend usando eventos AdminLog y muestra live cuando exista.
3. Ajustar el render del feed para reutilizar el patrón visual de cápsulas de facción.
4. Validar el alcance con tests y checks pedidos.
## Files to Read First
- `AGENTS.md`
- `ai/architecture-index.md`
- `ai/repo-context.md`
- `backend/app/rcon_admin_log_storage.py`
- `backend/app/payloads.py`
- `frontend/assets/js/partida-actual.js`
## Expected Files to Modify
- `backend/app/rcon_admin_log_storage.py`
- `backend/app/payloads.py`
- `backend/tests/test_current_match_payload.py`
- `backend/tests/test_rcon_admin_log_storage.py`
- `frontend/assets/js/partida-actual.js`
- `frontend/assets/css/historico.css`
## Constraints
- No tocar histórico, rankings, retención, mantenimiento BDD ni export Gitea.
- No cambiar endpoints ni contratos incompatibles del frontend.
- No cambiar la lógica funcional del feed de combate.
- Mantener la derivación principal de estadísticas desde AdminLog y ampliarla.
## Validation
- `python -m compileall backend/app`
- `$env:PYTHONPATH = "backend"`
- `python -m unittest backend.tests.test_current_match_payload`
- `python -m unittest discover -s backend/tests -p "*current*"`
- `python -m unittest discover -s backend/tests -p "*rcon*"`
- `node --check frontend/assets/js/partida-actual.js`
- `git diff --check`
## Outcome
- `backend/app/rcon_admin_log_storage.py` ahora construye el resumen vivo de participantes de la ventana actual combinando eventos `kill`, `connected`, `disconnected`, `team_switch`, `chat` y `message`, manteniendo las estadísticas de bajas derivadas desde `kill`.
- `frontend/assets/js/partida-actual.js` y `frontend/assets/css/historico.css` ajustan solo el render visual del feed para mostrar nombre + cápsula en la misma línea reutilizando el badge de equipo de la tabla.
- Validación ejecutada:
- `python -m compileall backend/app`
- `node --check frontend/assets/js/partida-actual.js`
- `git diff --check`
- Arnes Python local que ejecuta directamente las funciones `test_*` de `backend/tests/test_current_match_payload.py` y `backend/tests/test_rcon_admin_log_storage.py`
- Observaciones de validación:
- `python -m unittest backend.tests.test_current_match_payload` y `python -m unittest discover -s backend/tests -p "*current*"` no detectan tests porque esos módulos usan estilo `pytest`.
- `python -m unittest discover -s backend/tests -p "*rcon*"` falla por un problema ajeno y preexistente en `test_rcon_materialization_pipeline`.
- Limitación conocida: el helper live actual del repositorio expone conteos y marcador (`GetServerInformation`), pero no un roster nominal de jugadores; por tanto el resumen usa todas las señales nominales ya persistidas en AdminLog y no puede inventar jugadores silenciosos si nunca fueron vistos por ningún evento.
## Change Budget
- Preferir menos de 5 archivos si es viable; si no, mantener el cambio concentrado en current match.
- Preferir cambios pequeños y verificables por tests.

View File

@@ -1,7 +1,7 @@
---
id: TASK-161
title: Define Stats section functional contract
status: pending
status: done
type: documentation
team: Analista
supporting_teams:
@@ -176,17 +176,21 @@ Before completing the task ensure:
## Outcome
Document:
Completed as documentation-only.
- validation performed
- files changed
- notable decisions
- recommended next tasks, likely:
- add player stats search endpoint
- add player personal stats endpoint
- add annual leaderboard timeframe support
- design annual ranking snapshot schema
- add Stats frontend section
- Created `docs/stats-section-functional-plan.md` as the focused contract for the future `Stats` section.
- Kept the contract aligned with the current RCON-first materialized historical read model and the weekly/monthly window policy already present in `backend/app/rcon_historical_leaderboards.py`.
- Defined the V1 user flow, player search contract, personal stats payload, ranking position rules and annual top 20 snapshot persistence direction.
- Explicitly kept backend endpoints, database migrations and frontend implementation out of scope.
## Validation Result
- Verified `docs/stats-section-functional-plan.md` exists and is specific to HLL Vietnam.
- Verified the document references the RCON-first materialized data direction.
- Verified the document defines V1 scope, API contracts, payload expectations and annual snapshot direction.
- Verified no backend implementation files were modified for this task.
- Verified no frontend implementation files were modified for this task.
- No automated or integration tests applied because this task is documentation-only.
## Change Budget

View File

@@ -0,0 +1,113 @@
---
id: TASK-162
title: Add Stats player search endpoint (RCON materialized backend V1)
status: pending
type: backend
team: Backend Senior
supporting_teams: [Arquitecto de Base de Datos, Arquitecto Python]
roadmap_item: foundation
priority: medium
---
# TASK-162 - Add Stats player search endpoint (RCON materialized backend V1)
## Goal
Implement a backend V1 endpoint to support player search for the future Stats section:
`GET /api/stats/players/search?q=<query>`.
The endpoint must use existing RCON materialized tables and return search matches that include:
- `status`
- `query`
- `items`
- `player_id`
- `player_name`
- `matches_considered`
- `last_seen_at`
- optional `servers_seen` only if it can be added with low scope cost
No frontend work, no migrations, no yearly ranking, no Elo/MMR workarounds, no Comunidad Hispana #03 reactivation.
## Context
The repository already has a RCON materialized model (`rcon_match_player_stats` + `rcon_materialized_matches`) used by leaderboard reads.
The new endpoint is the first part of the Stats backend contract defined in `docs/stats-section-functional-plan.md`.
It should reuse existing routing/payload conventions in the current backend bootstrap.
## Steps
1. Inspect required files first (mandatory before implementation):
- `AGENTS.md`
- `ai/repo-context.md`
- `ai/architecture-index.md`
- `docs/stats-section-functional-plan.md`
- `backend/app/rcon_historical_leaderboards.py`
- `backend/app/main.py`
- `backend/app/rcon_admin_log_materialization.py` (for table/schema context)
2. Reuse the existing `routes.py` + `payloads.py` endpoint/payload pattern.
3. Implement one new endpoint: `GET /api/stats/players/search`.
4. Validate `q` parameter and optional `server` or `server_id` and `limit` handling using current project conventions.
5. Query existing RCON materialized tables with read-only logic (preferably `rcon_match_player_stats` joined with `rcon_materialized_matches`).
6. Keep response shape aligned with existing backend payload conventions.
7. Add a minimal, self-contained module if needed (preferably `backend/app/rcon_historical_player_stats.py`).
8. Run backend validation/checks and document outcome.
## Files to Read First
- `AGENTS.md`
- `ai/repo-context.md`
- `ai/architecture-index.md`
- `docs/stats-section-functional-plan.md`
- `backend/app/main.py`
- `backend/app/routes.py`
- `backend/app/payloads.py`
- `backend/app/rcon_historical_leaderboards.py`
- `backend/app/rcon_admin_log_materialization.py`
## Expected Files to Modify
- `backend/app/rcon_historical_player_stats.py` (new module preferred)
- `backend/app/payloads.py`
- `backend/app/routes.py`
- `backend/app/main.py` (solo si se detecta una dependencia de export explícita o import requerido)
## Constraints
- Keep the change small and verifiable.
- Keep frontend untouched.
- No migrations.
- No annual ranking implementation.
- No Elo/MMR reactivation.
- No Comunidad Hispana #03 behavior reintroduction.
- No historical worker changes.
- Do not modify `frontend/assets/js/partida-actual.js`.
- Do not create unnecessary abstractions beyond this endpoint.
- If `/ai/` is partially ignored by git-exclude, document traceability impact only.
## Validation
Before considering the task complete:
- Run `scripts/run-integration-tests.ps1`.
- Run relevant backend tests if they exist for stats/player or historical materialized reads.
- If no dedicated tests exist for this endpoint, run manual validation with `curl` or `Invoke-WebRequest`.
- Validate `git diff --name-only` and check that only expected files were changed.
- Move task to `ai/tasks/done` on completion, or to `ai/tasks/review` if human validation is required.
## Outcome (for worker)
Document:
- endpoint contract implemented and observed behavior
- SQL/search strategy used (scope, match logic, ordering, fallback behavior)
- validation command results
- whether `servers_seen` was included and why
- any schema/data limitations found
- any blocker from git tracking (`/ai/` ignore behavior) and impact on traceability if relevant
## Change Budget
- Prefer <5 modified files.
- Prefer <200 added/changed lines per file when feasible.
- Split into follow-up tasks if the scope starts expanding.