Implement trusted scoreboard origins, persisted scoreboard links, RCON-to-scoreboard correlation, match link UX priority, enriched internal match details, and historical UI regression validation.
7.4 KiB
id, title, status, type, team, supporting_teams, roadmap_item, priority
| id | title | status | type | team | supporting_teams | roadmap_item | priority | |||
|---|---|---|---|---|---|---|---|---|---|---|
| TASK-116 | Correlate RCON windows with scoreboard matches | done | backend | Backend Senior |
|
historical | high |
TASK-116 - Correlate RCON windows with scoreboard matches
Goal
Resolve external scoreboard URLs for RCON competitive-window synthetic matches only when there is strong evidence.
Context
RCON competitive-window matches can have synthetic IDs such as 31:2026-04-12T16:28:55.761810Z. Those IDs must stay internal and must never be used to fabricate external scoreboard URLs.
Known validation reference from the user:
- Internal RCON match:
- server: Comunidad Hispana #01
- synthetic match id:
31:2026-04-12T16:28:55.761810Z - map shown: St. Mere Eglise
- UI start/end around 12/4/26 18:28 to 18:43 local time
- players: 94 average / 98 peak
- Equivalent real scoreboard game known by the user:
- game id:
1561515 - external scoreboard page exists under the server #01 scoreboard origin
- game id:
This task must use that example as a fixture/reference without hardcoding a one-off special case.
Use branch:
plan/scoreboard-match-linking-tasks
Steps
- Work from this task only after moving it to
ai/tasks/in-progress/. - Inspect the listed files before changing anything.
- Build a resolver that takes server, synthetic session key, map,
started_at,ended_at, duration and player counts. - Search existing persisted scoreboard data first.
- If existing provider code can query recent scoreboard data without credentials, use it carefully; otherwise document the limitation and keep the resolver local-only.
- Match by server, normalized map and time proximity at minimum.
- Use additional evidence such as duration and player counts when available.
- Avoid false positives; return no URL when confidence is low.
- Return only URLs that pass trusted origin validation.
- Ensure the match detail endpoint exposes
match_urlfor RCON matches only when resolver confidence is sufficient. - Add a focused unit or fixture test for the correlation logic if feasible.
- Validate the result.
- Move this task to
ai/tasks/done/only after validation is complete and document the outcome in this file. - Commit and push the completed implementation branch.
Files to Read First
ai/architecture-index.mdai/repo-context.mdai/orchestrator/backend-senior.mdai/orchestrator/analyst.mdbackend/app/rcon_historical_read_model.pybackend/app/rcon_historical_storage.pybackend/app/historical_storage.pybackend/app/historical_snapshots.pybackend/app/routes.pybackend/app/providers/public_scoreboard_provider.py- backend trusted scoreboard origin helper/config from TASK-114
backend/tests/if presentscripts/run-integration-tests.ps1
Expected Files to Modify
- likely a new or existing backend resolver module
- possibly
backend/app/rcon_historical_read_model.py - possibly
backend/app/historical_storage.py - possibly
backend/app/routes.py - possibly backend tests or fixtures
- this task file, moved to
ai/tasks/done/
If additional files become necessary, explain why in the task outcome and commit message.
Expected Files Not to Modify
frontend/**- local
.env - database migrations unless absolutely required and justified
- persisted data
- Docker/Compose config
- Elo/MMR implementation files
- historical ingestion policy/config
Constraints
- Do not reintroduce Comunidad Hispana #03.
- Do not reintroduce paused MVP/Elo UI.
- Do not change historical ingestion policy.
- Do not add real credentials.
- Do not modify local
.env. - Do not delete persisted data, migrations, backend endpoints or historical ingestion code.
- Do not use the public word "snapshot" in user-facing UI.
- Do not fabricate unsafe URLs from synthetic RCON IDs.
- Prefer no link over a low-confidence or ambiguous link.
Validation
Before completing the task, run and document:
git status- Python compile checks for touched backend modules
powershell -ExecutionPolicy Bypass -File scripts/run-integration-tests.ps1- focused unit or fixture test for correlation logic if feasible
- endpoint check confirming
match_urlappears only when confidence is sufficient - negative test/check confirming low-confidence or ambiguous candidates return no URL
- check using the user reference example when data or fixture setup allows it
- check confirming generated/exposed URLs pass trusted origin validation
git diff --name-onlyand confirmation that changed files match the expected scope
If a configured validation command cannot be run, document the exact reason in the outcome.
Commit And Push Requirements
- Run validation before committing.
- Run
git status. - Stage only intended files.
- Commit with message:
feat: correlate rcon matches with scoreboard links - Push the branch to origin.
- Do not leave completed work only in local.
Outcome
Completed.
Implementation decisions:
- Added
backend/app/rcon_scoreboard_correlation.pyas a local-only resolver over already persisted public-scoreboard matches. - The resolver does not query the public provider or network during request handling. It searches persisted
historical_matchesfirst and returns no URL when no strong local match exists. backend/app/rcon_historical_read_model.pynow calls the resolver for RCON match-detail payloads and keeps the synthetic RCON session key internal.- No URL is built from a synthetic RCON ID. Returned URLs must come from persisted
raw_payload_refand pass the trusted origin validation from TASK-114.
Confidence rules chosen:
- Required evidence: same server, normalized map match, parseable RCON and scoreboard time windows, and a trusted persisted
raw_payload_ref. - Scored evidence: time overlap, RCON midpoint inside the scoreboard match, endpoint proximity, duration compatibility, and optional player-count compatibility.
- Minimum score:
5. - Ambiguity handling: if two candidates tie for the best score, the resolver returns no URL.
- Preference: no link over a low-confidence or ambiguous link.
Validation performed:
git status --short --branchconfirmed branchplan/scoreboard-match-linking-tasks.$env:PYTHONPATH='backend'; python -m unittest backend.tests.test_scoreboard_match_linkspassed.- The focused test includes the user reference shape:
comunidad-hispana-01, RCON synthetic session1:2026-04-12T16:28:55.761810Z, mapSt. Mere Eglise, and correlated scoreboard game1561515. - The focused test confirms
match_urlappears only with strong evidence. - The focused test confirms low-confidence/wrong-map candidates return no URL.
- The focused tests confirm exposed URLs pass trusted origin validation because only persisted trusted
raw_payload_refvalues are returned. python -m compileall backend/app backend/testspassed.powershell -ExecutionPolicy Bypass -File scripts/run-integration-tests.ps1passed.git diff --name-onlyandgit status --shortwere reviewed. Changed files match the expected scope: new resolver module, RCON read model integration, focused backend tests and this task file.
Note:
- The focused unittest still emits existing SQLite
ResourceWarningmessages from the repository connection helper pattern during forced cleanup, but all assertions pass and cleanup is not blocked.
Change Budget
- Prefer fewer than 5 modified files.
- Prefer changes under 200 lines when feasible.
- Split follow-up work into a new task if the scope grows.