Skip to content

PM-6577: Reconcile Marathon Match totals with restored history - #165

Merged
jmgasper merged 1 commit into
developfrom
PM-6577
Oct 16, 2026
Merged

jmgasper merged 1 commit into
developfrom
PM-6577

Conversation

@jmgasper

Copy link
Copy Markdown
Contributor

What was broken

The earlier restoration made wata's missing Marathon Match/TCO competitions visible. QA confirmed the additional cards but reported that the API still returned 5 challenges and 1 win. This follow-up preserves the restored history and corrects the summary counters.

Local history, local/remote branches, and GitHub PR references were searched for PM-6577; no ticket-specific earlier branch or PR was found. The existing history filtering and reconciliation changes were reviewed, and this fresh branch starts from current develop.

Root cause

Member stats used persisted challenge/win counters independently of the visible history pipeline. The existing win hydration only filled missing values, leaving stale nonzero totals unchanged. A read-only check of the dev API also showed a mismatch: 20 visible competitions with five first-place finishes, but four aggregate wins.

What was changed

  • src/services/StatisticsService.ts: raise public Marathon Match totals to the minimum established by the existing visible history response, reusing its completion, placement, and legacy/canonical deduplication rules. Preserve larger totals when historical data is partial.
  • Apply the same adjustment to Data Science/overall totals and the MM submission fallback before response field filtering. Preserve ratings, ranks, and private-group totals.
  • ReadMe.md: document the reconciliation behavior.
  • test/unit/StatisticsService.test.js: add nine regression cases. The screenshot-based fixture now returns 20 challenges and 6 wins instead of 5 and 1.

Any added/updated tests

Nine new cases cover restored TCO rounds, stale and zero counters, partial and empty history, merged Development/MM aggregates, duplicate and cancelled rounds, winner-derived history/placements, and private groups. Assertions also cover parent totals, submissions, field selection, unchanged SRM stats, and preserved ratings/ranks/volatility.

Validation used Node 26.5.1 via nvm use, existing local dependencies, and an isolated PostgreSQL 16 database:

  • NODE_ENV=test pnpm exec mocha -t 20000 --require ts-node/register/transpile-only test/unit/StatisticsService.test.js --exit: 51 passing.
  • pnpm lint, pnpm build, and git diff --check: passed.
  • pnpm test: 240 passing, 22 failing. A clean develop worktree has 231 passing and the identical 22 failing tests. Four failures need skills-table fixtures, one needs Auth0/bus test configuration, and 17 are existing validation-message assertions. No new full-suite failures were introduced; the full suite is not green.
  • Before the fix, the new restored-history and stale-win regressions failed against the old counters.

No UI change or rating replay is required. This adds a public MM history read when returning MM aggregates; other subtracks and private-only reads skip the reconciliation.

What was broken
Restored Marathon Match and TCO competitions appeared in profile history while
wata's summary still reported 5 challenges and 1 win, as reported by QA.

Root cause
The summary trusted persisted aggregate counters even when visible history
contained additional competitions and first-place finishes. The existing
missing-win fallback did not repair nonzero stale totals.

What was changed
Reconcile public Marathon Match totals with the existing visible history read
path, preserving its completion, placement, and duplicate-handling rules.
Retain larger stored totals when history is partial. Update Data Science and
overall totals and the MM submission fallback before selecting response fields.
Preserve ratings and private-group totals. Document the read behavior.

Any added/updated tests
Add nine regressions for restored rounds, zero/stale counters, partial/empty
history, merged MM aggregates, duplicate and cancelled rounds, winner-derived
history, private groups, field filtering, and rating preservation.
All 51 statistics tests, pnpm lint, pnpm build, and git diff --check pass.
The full pnpm test run has 240 passing and 22 existing failures; clean develop
has 231 passing and the same 22 failures. These require skills DB fixtures,
Auth0/bus test configuration, and updates to existing validation assertions.
@jmgasper
jmgasper merged commit a3c2f5c into develop Oct 16, 2026
5 checks passed
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.

1 participant