Skip to content

Team-game ladder support: opponents lists, opposing-team head-to-head, live metadata shape - #306

Merged
amrtgaber merged 3 commits into
mainfrom
team-game-support
Jul 26, 2026
Merged

Team-game ladder support: opponents lists, opposing-team head-to-head, live metadata shape#306
amrtgaber merged 3 commits into
mainfrom
team-game-support

Conversation

@amrtgaber

Copy link
Copy Markdown
Contributor

Summary

Implements #292 — team boards become supported tournament ladders — and fixes two real integration bugs found by verifying every assumption against the live upstream API first (payloads fetched 2026-07-25; test players from docs/data-sources.md).

Ground-truth findings (drove the design)

  1. Upstream schema drift, latent since 2026-06-01: leaderboard entries carry their matchtype ids in leaderboardmap: [{matchtype_id, statgroup_type, ...}] — the matchtypes key the parser read no longer exists. That silent key move was the real cause of the June 1 empty-map incident; since then the derived map has been empty every cycle and only the {6: 3} floor kept 1v1 RM matches attributed — every other board's matches have been written with leaderboard_id = NULL. The parser now reads leaderboardmap with the legacy key as fallback (_leaderboard_matchtype_ids).
  2. The Reject non-1v1 leaderboards at tournament create/edit #302 guard's name check was wrong against live data: real leaderboard names use the SOLO_*/TEAM_* taxonomy (SOLO_RM_RANKED), not "1v1 …" — the token check would have 422'd every create in production. Fixtures had drifted from the payload. (No live impact: prod is dormant.) Replaced by an id allowlist, and fixtures across the suite now mirror the real payload shape.
  3. All team boards are statgroup_type: 1 — AoE2 team ladders rate players individually with solo statgroups, so the existing personal-stat parsing is already correct for TG; no poller stat changes needed. A live 3v3 match confirmed per-player teamid/outcome/old|newrating, all of which the match_players model already stores for every participant.

Changes

  • Guard (SUPPORTED_TOURNAMENT_LEADERBOARD_IDS = {1, 2, 3, 4, 13, 14}): the six classic ranked solo + team boards (DM/RM/EW), transcribed from the live payload. Excluded until verified: SOLO_BR (FFA breaks two-team reads), CO_*, POM/RBW customs. Create/PATCH message updated.
  • Matchtype floor extended from {6: 3} to all seven public ranked boards' mappings (transcribed, not guessed), with the corrected incident history in the comment.
  • Opponents as lists (RecentMatchup.opponents: list[MatchupOpponent]): the old limit(1) correlated subqueries — which silently reported one arbitrary opponent on team boards — are replaced by one batched participants query over the capped matchups. The legacy scalar opponent_* fields keep their exact pre-Team-game ladder support: multi-opponent matchups, full statgroups, verified matchtype floor #292 contract: populated iff exactly one opponent (1v1), null otherwise — 1v1 consumers are byte-identical.
  • Head-to-head on team boards: candidates now require rostered entrants on ≥2 distinct teams (allies queuing together is not a head-to-head; equivalent condition on 1v1), and each entrant carries team_id (additive) so the consumer can group sides. Only rostered entrants are listed, as before.
  • docs/data-sources.md records the schema drift + taxonomy so the next integration reads the current truth.

Tests

588 passed. New: leaderboardmap + legacy parser shapes; extended-floor merge behavior; guard allow/deny matrix (team board 201, BR 422, unranked 422, unknown 422, EW 201); TG matchup opponents list with allies excluded + scalar nulling; 1v1 scalar byte-compatibility; allies-vs-opposed head-to-head with team_id. Consumers regenerate orval clients (additive fields only).

Closes #292 (and supersedes the #302 name check).

@amrtgaber
amrtgaber merged commit 3ca772d into main Jul 26, 2026
3 checks passed
@amrtgaber
amrtgaber deleted the team-game-support branch July 26, 2026 02:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Team-game ladder support: multi-opponent matchups, full statgroups, verified matchtype floor

1 participant