Skip to content

fix(marketing): skip the API read for a malformed fight handle - #8817

Merged
superset-home merged 1 commit into
mainfrom
sentry/marketing-6c-fight-invalid-handle
Oct 23, 2026
Merged

superset-home merged 1 commit into
mainfrom
sentry/marketing-6c-fight-invalid-handle

Conversation

@superset-home

@superset-home superset-home commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Problem

/fight?a=…&b=… failed to render when a query value was not a valid leaderboard handle, for example a handle with a trailing ) from a pasted link. The server render threw an unhandled tRPC input-validation error.

Root cause

resolveFighter sent the raw query value to leaderboard.public.participant. That procedure's handleSchema refuses anything outside HANDLE_PATTERN, or a reserved handle, with BAD_REQUEST. fetchParticipant returns null only for NOT_FOUND and rethrows all other errors, so the render failed. #7295 fixed the same problem for profile routes: there the proxy routes to a profile only when isProfileHandle passes. The fight page had no such check.

Fix

Use the same isProfileHandle check in resolveFighter before the API read. If the handle is not valid, that slot is empty, which is what a missing profile already shows.

Verification

$ bunx biome check "src/app/[lang]/fight/page.tsx"
Checked 1 file in 32ms. No fixes applied.

$ cd apps/marketing && bun run typecheck
$ tsc --noEmit
(no errors)

$ bun test "src/app/[lang]/fight"
 11 pass
 0 fail
Ran 11 tests across 1 file.

Refs MARKETING-6C


Summary by cubic

Fixes the /fight page render failing when a query value is not a valid leaderboard handle. resolveFighter sent the raw value to leaderboard.public.participant, which rejects malformed handles (like pasted links with a trailing )) with BAD_REQUEST; fetchParticipant rethrows everything except NOT_FOUND, so the page crashed.

The page now uses the same isProfileHandle check used for profile routes before the API read. Invalid handles render as an empty slot, matching the missing-profile state.

Written for commit a102ea1. Summary will update on new commits.

View guided diff Turn on auto-fix

Summary by CodeRabbit

  • Bug Fixes
    • Invalid fighter profile handles are now rejected before participant details load, preventing malformed handles from appearing as valid fighters.
    • House fighters continue to be resolved first.

The fight page sent the raw ?a= and ?b= values to leaderboard.public.participant.
A value the handle schema refuses came back as BAD_REQUEST, which fetchParticipant
rethrows, so the page render failed. Check the handle with isProfileHandle, the
same check the proxy uses for profile routes, and show an empty slot.

Refs MARKETING-6C
@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 93107686-3267-4998-81dc-68ee26d3583f
📥 Commits

Reviewing files that changed from the base of the PR and between cf94352 and a102ea1.

📒 Files selected for processing: 1
  • apps/marketing/src/app/[lang]/fight/page.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

📝 Walkthrough

Fighter resolution now rejects normalized handles that fail isProfileHandle before participant lookup. House fighters are still checked first.

Changes: Fighter resolution

Layer / File(s) Summary
Validate normalized handles
apps/marketing/src/app/[lang]/fight/page.tsx
resolveFighter imports isProfileHandle and returns null for invalid normalized handles after checking house fighters.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~5 minutes

Change: Bug fix

Suggested reviewers: kitenite

Merge Risk: ⚪ Minimal · up to a102e

Malformed fight handles now avoid the failing API request and render with an empty slot; no merge-blocking risk remains.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title follows conventional commit format and names the primary change: the fight page now skips the API read for a malformed handle. It matches the raw summary, which shows resolveFighter rejectin…
Description check Passed The description covers the problem, root cause, fix, and verification. It gives a clear account of the failure path and the change. It does not fill the template's 'How I tested it' section with scree…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title follows conventional commit format and names the primary change: the fight page now skips the API read for a malformed handle. It matches the raw summary, which shows resolveFighter rejecting handles that fail isProfileHandle before loading a participant. The title is specific and accurate.

Full details: Description check

Explanation

The description covers the problem, root cause, fix, and verification. It gives a clear account of the failure path and the change. It does not fill the template's 'How I tested it' section with screenshots, and the checklist items are not marked. The 'What & why' section does not link an issue, but it references MARKETING-6C and #7295. Those gaps are minor, so the description is mostly complete.

✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The PR appears safe to merge.

Summary

The fight page now checks query handles before fetching a participant.

  • Invalid fight handles leave their fighter slots empty.

Reviews (1) · Last reviewed commit: "fix(marketing): skip the API read for a ..." · Reviewed by Greptile

@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

🧹 Preview Cleanup Complete

The following preview resources have been cleaned up:

  • ✅ Neon database branch

Thank you for your contribution! 🎉

@superset-home
superset-home merged commit 60d38e2 into main Oct 23, 2026
17 checks passed

This branch was previously deployed

1 inactive deployment
preview — a102ea10 Deployed Oct 23, 2026 by superset-home via Deploy Marketing #12641
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