WIP: feat(website): a report inbox for the launcher, filing reports as issues #251
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/renderer
area/saves
area/upscaling
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
testing wanted
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!251
Loading…
Reference in a new issue
No description provided.
Delete branch "TrashPanda/Longshot:feat/report-inbox"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
The launcher's Send report (LongshotLauncher #42) has nowhere to send to: its inbox is unset, so crash and build reports never reach us. This makes the website's Worker that inbox. Each report becomes a Longshot issue, the same crash from many PCs collects on one issue, and players need no account.
What changed
worker/report.ts(new) answersPOST /report. It checks the report (format 1, a kind the launcher knows, at most 256 KB of text and a 4 MB PNG, signature and version cut to one line,@mentionsbroken, control characters removed). Then it files the report through the Forgejo API as a bot account.file()searches for an open issue whose title starts with[report <key>]and comments there; if there is none, it opens a new issue with the labels inREPORT_LABELS. The picture is attached to whichever it filed. The answer is{"id": "#123", "url": ...}, whichReportSendershows the player.keyOf).worker/index.tsroutes/reportto it. Inwrangler.jsonc:/reportinrun_worker_first, two rate limiters (REPORT_LIMIT3 a minute per address,REPORT_LIMIT_ALL20 a minute in total), and the varsREPORT_REPOandREPORT_LABELS.{"id": "dry-run"}without filing it. Without the secretREPORT_FORGEJO_TOKEN, or withREPORTS_OFF=1, it answers503, which the launcher already treats as "not sent, copy it instead".website/README.md, "The report inbox" (how it behaves, the limits, setup, turning it off, the token and previews); the header of.forgejo/workflows/website.ymlnames the new secret and why previews must stay reviewed.website/tests/report.test.ts(9 tests, a stand-in Forgejo and rate limiter, no network).Flags and settings
REPORT_FORGEJO_TOKEN(Worker secret)REPORTS_OFF(Worker secret)1turns the inbox off at once, no deployREPORT_REPO,REPORT_LABELS(vars)MagicBeanDev/Longshot,kind/bug,source/reportMeasurements
No performance change: a new route on the Worker.
/downloadand the site are untouched (still302/200underwrangler dev).Testing
Tested: On Linux (Node 24, wrangler 4.160.1, workerd), on
feat/report-inbox:node --test website/tests/*.test.ts: the 9 new tests anddownload.test.tspass. The 7 failures ingraphics-settings.test.tsfail the same way onmain(the README names no condition for the HDR tone mapper).npx wrangler deploy --dry-run: the config is valid, and the bindings show both rate limiters and the vars.npx wrangler dev, real requests: a GET gets405, an unknown kind400, a report with no token503, the 4th request in a minute from one address429, and/download/launcher/nightlyis still a302.file()fromreport.ts, filing on my fork with issues turned on for the test): the first report opened an issue with the label andframe.pngattached and shown in it. The same crash again was a comment on that issue, and another signature opened a second issue. The@mention showed broken. I deleted the test issues and the label afterwards, and turned issues off again.python -I -B tests/run_all.py: 510 passed, 18 skipped, 1 failed.test_lift_cache.pyneeds numpy, which this PC's isolated Python lacks; it fails the same way onmain.Not tested: the deployed Worker. The secret isn't set until after merge, and the rate limiters only run for real on Cloudflare (they are also counted locally under
wrangler dev, as above). Not run with the launcher itself: #42'sDefaultInboxis still unset (see the launcher PR).Needs other testers:
LONGSHOT_REPORT_URL=https://longshot.magicbean.dev/reportwith a launcher from #42, and a Send report, expecting an issue[report …]on Longshot (request to open)Screenshots
Nothing on screen (the issues it files are plain Forgejo issues).
Risk and rollback
Spam, or a flood of issues. Each address is limited to 3 a minute and everyone together to 20; one problem is one issue; and
REPORTS_OFF=1(a secret, no deploy needed) turns it off. A leaked token can only write issues; revoke it in the bot's settings. Previews share the Worker's secrets, so the existing preview review is what protects the token. Reverting the commit removes the route.Reviewer notes
Read
worker/report.tsfirst. Setup left to a maintainer: the bot account (Triage role on Longshot, or Forgejo files the issues without labels), its token as a Worker secret, and the labelsource/report.Issues
See LongshotLauncher #42.
Checklist
For everyone
type(scope): description).main.python -I -B tests/run_all.pyrun and passing (any failure that also fails onmainis named above).third_party/untouched (a new folder with aPROVENANCE.mdinstead).View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.