feat(stats): host match-report review flow, pinned to db-v1.20.0 - #265
Merged
Conversation
The host match-report review flow calls RPCs that were added to the canonical database after this branch was cut, but the vendored types were still pinned to db-v1.17.0 (migration head 20260809220000). This is the pin commit the branch anticipated in its rollout notes. Advances db-contract.lock.json to released db-v1.20.0 at 508f267470030e8daf9108fc5162c2a407ef848e (migration head 20260823130000) and re-vendors src/types/database.types.ts via `npm run sync:db-contract`, which fetches the generated types from the release tag rather than editing them by hand. The types change is purely additive — 702 insertions, no deletions. It brings in the host-review surface this branch depends on (match_report_host_tokens, issue_match_report_host_token, consume_match_report_host_token, submit_match_report_host_review, revise_match_report_extraction, create_match_result_action_with_report, ensure_match_report_for_pending_action, match_report_extraction_diagnostics) along with the roster trade, roster drop, and scoped role contracts that landed in the same window and are unused here. Verification: - npx tsc --noEmit — clean; the route handlers typecheck against the real RPC signatures rather than the v1.17.0 types that lacked them - npx vitest run — 772 passed, 26 skipped (121 files), unchanged from the pre-pin run on this branch - npx eslint . --quiet, npm run check:bem - npm run check:db-contract — verified db-v1.20.0 (20260823130000) - npm run build — succeeds under the CI build environment (E2E_TEST_MODE=1, empty Supabase vars) Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MxSTraGzCWDmpCS4h6tCYC
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 39a4810504
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…ports Addresses two Codex review findings on this branch. P1 — admin review dropped host-validated player identities (MatchReportClient.tsx). toReviewGames re-resolved every player by IGN and overwrote the persisted playerId. That was harmless while reports only reached "review" from admin OCR, where no identity had been validated yet, but this branch routes host_review reports through the same function. A host has already bound each row to a roster identity by then, so an IGN change since submission silently dropped the id, and a duplicate or recycled IGN could bind the row to a different player before official stats were written. The persisted playerId now wins; IGN lookup remains the fallback for extractions that were never host-validated. P2 — cancelled reports could be resurrected (MatchReportCard/upload route). This branch gave cancelled reports a status badge, making them ordinary selectable cards, but openExistingReport only special-cased done, review, and host_review; cancelled fell through to the editable upload step, and the admin upload route unconditionally wrote status "pending". An admin opening a cancelled report and attaching a screenshot would revive it. The client now treats cancelled as read-only, and the upload route rejects terminal reports with 409 — covering "done" as well, since the same unguarded write would have reopened a report whose stats are published. Also drops the hostReviewRow cast in the match-reports list route. It existed only to keep the branch type-safe against the v1.17.0 contract that predated these columns; the db-v1.20.0 pin makes revision and host_submitted_at properly typed. Verification: - new upload route test covers both terminal statuses and the still- accepted pending case; confirmed it fails (200 instead of 409) with the guard removed and passes with it restored - npx vitest run — 775 passed, 26 skipped (122 files), up from 772 - npx tsc --noEmit, npx eslint . --quiet, npm run check:bem - npm run check:db-contract — db-v1.20.0 (20260823130000) - npm run build — succeeds under the CI build environment Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MxSTraGzCWDmpCS4h6tCYC
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Carries the full contents of #262 and adds the database contract pin that its rollout notes said was still outstanding.
#262 deliberately stayed locked to released
db-v1.17.0whiledb-v1.18.0was pending, and asked for "a small generated-types/contract-lock pin commit before integration or deployment." That release has since shipped and been superseded — production is now ondb-v1.20.0— so this branch advances the lock to the current release and re-vendors the generated types.This supersedes #262. Close it in favor of this branch, or cherry-pick
39a4810onto it — whichever you prefer. No other change: the review page, session exchange, upload/extract/revise/submit routes, and admin queue integration are exactly as reviewed on #262.The pin
db-contract.lock.jsonmoves to releaseddb-v1.20.0at508f267470030e8daf9108fc5162c2a407ef848e(migration head20260823130000), andsrc/types/database.types.tsis re-vendored withnpm run sync:db-contract— which fetches the generated types from the release tag rather than editing them by hand.The types change is purely additive: 702 insertions, zero deletions. It brings in the host-review surface this branch depends on:
match_report_host_tokensissue_match_report_host_token,consume_match_report_host_tokensubmit_match_report_host_review,revise_match_report_extractioncreate_match_result_action_with_report,ensure_match_report_for_pending_actionmatch_report_extraction_diagnosticsplus the roster trade, roster drop, and scoped role contracts that landed in the same window and are unused here.
Worth noting for review: the route handlers now typecheck against the real RPC signatures instead of the
v1.17.0types that predated them, andtsc --noEmitcomes back clean. That is the substantive value of the pin, not just a version bump.Dependencies and rollout
issueMatchReportHostReviewLinkposts to/api/internal/match-reports/[id]/host-token, which only exists here. lab-salbot#96 is green and mergeable, waiting on this.MATCH_REPORT_HOST_SESSION_SECRET(at least 32 characters).INTERNAL_SERVICE_TOKENto match the bot'sSAL_SITE_INTERNAL_TOKEN.No production deployment or database write was performed from this branch.
Verification
npx tsc --noEmit— cleannpx vitest run— 772 passed, 26 skipped (121 files, 1 skipped); identical to feat(stats): add host match-report review flow #262's pre-pin numbers, so the pin is behaviorally inertnpx eslint . --quietnpm run check:bemnpm run check:db-contract— verifieddiese-tech/sal-database db-v1.20.0(20260823130000)npm run build— succeeds under the CI build environment (E2E_TEST_MODE=1, empty Supabase vars)Full Discord → deployed site → database verification still requires the secrets above and lab-salbot#96 deployed.
Generated by Claude Code