Skip to content

PM-4151: guard MM final score fallback#110

Merged
jmgasper merged 2 commits into
developfrom
PM-4151-5
Jun 22, 2026
Merged

PM-4151: guard MM final score fallback#110
jmgasper merged 2 commits into
developfrom
PM-4151-5

Conversation

@jmgasper

Copy link
Copy Markdown
Collaborator

What was broken
Previous PM-4151 fixes added Marathon Match finalScore/finalRank behavior, suppressed active challenge final columns, and filtered negative failed-run scores. The remaining fallback path could still expose a stale submission.finalScore when a final review row existed but did not contain a valid non-negative score.

Root cause
The final review lateral subqueries only projected aggregateScore. The scoring CASE used that nullable value to decide whether to fall back, so it could not distinguish no final review row from an unusable final review row.

What was changed
Projected has_final_review from the final review lateral subqueries in the submitter, valid submitter, and winner export SQL.
Changed the Marathon Match final score CASE to fall back to submission.finalScore only when no final review row exists. Existing final review rows with negative or unusable scores now export null instead of stale fallback scores.

Any added/updated tests
Updated src/reports/challenges/challenge-export-sql.spec.ts to require the final review presence guard across submitter, valid submitter, and winner SQL.

Validation
pnpm lint passed.
pnpm test -- --runInBand src/reports/challenges/challenge-export-sql.spec.ts src/reports/challenges/challenges-reports.service.spec.ts passed.
pnpm build passed.
The full pnpm test -- --runInBand suite still fails in unrelated existing SFDC DTO/service specs and report-directory access coverage on the current develop base.

jmgasper added 2 commits June 19, 2026 10:26
What was broken
Marathon Match submitter exports could show negative failed-run scores, finalScore values while a challenge was still in submission, and a finalRank column before the challenge was completed.

Root cause
The challenge export SQL treated any final score field as exportable regardless of challenge status, used negative review summation scores as normal scores, and always emitted Marathon Match final columns from the formatter.

What was changed
Changed the submitter, valid submitter, and winner SQL to ignore negative Marathon Match scores, only expose finalScore/finalRank data for completed challenges, and avoid falling back to submission.finalScore when a final review row explicitly failed.
Updated the challenge report formatter so Marathon Match finalScore and finalRank columns are only emitted when at least one row has those values.
Updated report descriptions and DTO documentation to match the completed-only final data behavior.

Any added/updated tests
Updated the challenge SQL regression spec for completed-only final scores, negative score filtering, and completed-only final ranks.
Added a service regression test that verifies active Marathon Match exports omit finalScore and finalRank columns when final scoring is unavailable.
What was broken
The previous PM-4151 follow-up suppressed active Marathon Match final columns and negative scores, but the final score fallback still depended on final_review.aggregateScore being non-null. If a final review row exists without a valid non-negative score, the query could still fall back to stale submission.finalScore.

Root cause
The final review lateral subquery only projected aggregateScore, so the scoring CASE could not distinguish no final review row from a final review row that exists but is not usable for export.

What was changed
Projected a has_final_review flag from the final review lateral subqueries for submitter, valid submitter, and winner exports. The Marathon Match final score CASE now falls back to submission.finalScore only when no final review row exists, while existing final review rows with negative or otherwise unusable scores export null.

Any added/updated tests
Updated the challenge export SQL regression spec to require the final review presence guard across submitter, valid submitter, and winner SQL.
@jmgasper jmgasper merged commit f9caad4 into develop Jun 22, 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