Files
comunidadhll/ai/tasks/done/TASK-129-parse-materialize-player-profile-message-blocks.md
2026-05-19 15:32:35 +02:00

86 lines
3.5 KiB
Markdown

---
id: TASK-129
title: Parse and materialize player profile MESSAGE blocks
status: done
type: backend
team: Backend Senior
supporting_teams:
- Arquitecto de Base de Datos
- Arquitecto Python
roadmap_item: rcon-full-data
priority: medium
---
# TASK-129 - Parse and materialize player profile MESSAGE blocks
## Goal
Extract useful long-term player profile snapshots from RCON AdminLog `MESSAGE` blocks generated by the server bot.
## Background
Observed AdminLog `MESSAGE` blocks can include profile-like stats such as first seen, sessions, matches played, play time, sanctions, averages, kills, deaths, teamkills, K/D, victims, nemesis and favorite weapons. These are profile snapshots, not authoritative per-match stats.
## Constraints
- Do not use profile snapshots as authoritative per-match stats.
- No frontend changes unless adding backend API contract tests requires fixtures.
- Do not reactivate Elo/MMR.
- Do not reintroduce Comunidad Hispana #03.
- Do not store secrets, runtime DB files or `backend/runtime`.
- Do not expose raw full `MESSAGE` content through public APIs by default.
## Allowed Changes
- backend parser/materialization/storage code for profile snapshots
- backend tests with anonymized examples
- this task file when moving it through the workflow
## Implementation Requirements
- Work from a dedicated branch for this task.
- Read first:
- `AGENTS.md`
- `ai/architecture-index.md`
- `ai/repo-context.md`
- `ai/orchestrator/backend-senior.md`
- `ai/orchestrator/database-architect.md`
- `backend/app/rcon_admin_log_parser.py`
- `backend/app/rcon_admin_log_storage.py`
- existing AdminLog ingestion/materialization tests
- Add a parser for profile-like `MESSAGE` content only.
- Store extracted snapshots in a table such as `rcon_player_profile_snapshots`.
- Include fields for target, player id/name, source server time, event timestamp, sessions, matches played, total kills/deaths, teamkills done/received, K/D, favorite weapons JSON, victims JSON, nemesis JSON, averages JSON, sanctions JSON and raw content.
- Deduplicate by `target_key + player_id + source_server_time`.
- Validate Spanish labels including `bajas`, `muertes`, `Víctimas`, `Némesis`, `Armas favoritas`, `Promedios` and `Sanciones`.
## Validation Commands
- `python -m compileall backend/app`
- `python -m pytest backend/tests/<new_or_relevant_profile_message_tests>.py`
## Manual Verification Steps
- Confirm tests use anonymized MESSAGE examples.
- Confirm non-profile `MESSAGE` entries are ignored.
- Confirm duplicate snapshots are not inserted twice.
- Confirm `/health` still works.
- Confirm `git diff --name-only` matches the allowed scope.
## Git Requirements
- Create a dedicated branch for this task, for example `codex/task-129-profile-message-snapshots`.
- Run relevant validation before committing.
- Stage only intended files.
- Commit the completed implementation.
- Push the branch to origin.
## Outcome
- Added profile MESSAGE parsing for anonymized long-term player snapshot fields.
- Added `rcon_player_profile_snapshots` storage with idempotent upsert by target, player id and source server time.
- Verified non-profile MESSAGE entries are ignored.
- Validation: `python -m compileall backend/app` passed.
- Validation blocked: `python -m pytest backend/tests/test_rcon_admin_log_parser.py backend/tests/test_rcon_admin_log_storage.py` could not run because `pytest` is not installed in this environment.
- Supplemental check: direct Python execution of the new parser/storage checks passed.