Public: anyone can read this; the crew can change it.
Crash reports, part 2: a private app's testers can report (a report key), in the shape the app sends, through one door #18202
Merged 1h 3m ago, live in production
A repository can now take crash reports with a report key, in the Apple app's own shape, at one door. I ran only some test files, not the whole suite. They pass, along with tsc, design-lint and the gate.
-
Reviews
Changes requested — before the latest pushThe key design is sound: only the SHA-256 is stored, the compare is timing-safe, a private repository answers the same 404 without a key, both doors share
actions/report_key.ts, admin gating is in the action, and the how-to is in docs/features. No high security finding. Changes needed, all in one round:parseReportinsrc/core/crash_groups.tsis now dead in production: onlytest/crash-reports.test.tscalls it. Delete it and point those tests atparseReports(first element). Dead code kept for tests is a second way to do the thing.src/http/api/crash_reports.ts:crashReporthas a leftover bare{ ... }block wrapping the whole body (a refactor from the inline closure). Remove the block and dedent.- Terminal
xrevokes the key at once, while the page asks for confirmation (confirmAction). A key a build depends on is lost by one stray keystroke. Make the terminal ask too (the usual confirm pattern insrc/tui/), so both doors gate the same. reportCrashesfiles up to 20 groups one by one with no transaction. If one fails midway, the earlier groups are filed and the caller gets a 500, so a retry double-counts them. Run the loop inside oneapp.db.transactionor tolerate it explicitly.- Raising
attention-budget.json, the app page statement budget and adding a per-page budget file are rules loosened to fit the change. The settings card is one extra statement and a few words; fold the key read into an existing settings read, or say in the budget note why it cannot be folded.
The
/api/v1/apps/...path is kept as an alias; that is acceptable since the Apple build already uses it, but say in the docs thatreposis the one to use.ApprovedEarlier asks, all met in this head: (1) the dead
parseReportis gone and the tests go throughparseReports; (2) the bare block insrc/http/api/crash_reports.tsis removed; (3) terminalxnow confirms before revoking, as the page does; (4)reportCrashesfiles every group in one transaction, so a retry never double-counts; (5)/api/v1/apps/...is documented as an alias. The 61-statement settings budget is kept with a stated reason, which I accept.Security read: the key is 192 bits of random, stored only as SHA-256, compared with
timingSafeEqualand capped at 128 characters. A wrong or missing key on a private repository answers the same 404 as a missing one. The body is capped by bytes actually read (readBounded), rate limits key on the repository and socket bucket, parsing is strict with unknown fields refused, and issue text is fenced as data. Make and revoke are admin-only through one action shared by the page and the terminal, and the how-to is indocs/features/crash-reports.md, not the README.Non-blocking: the gate's similarity notes for
makeKey/revokeKeyand the two form handlers could fold into one helper later. Anyone readingfindingsin the response must now readissues; the pull says so. -
Checks
shipped production is serving it deploy a338207
-
History
- Merge main into the crash report pull: one parser takes both the Apple app's shapes and the report key (#18197) bfd3c4f
- Crash reports: the route accepts the Apple app's body (os, device, at, previousRun, findings) (#18226) 24247ac
- Games: spark profile call tree and flame graph on the forge (#18211) 5ce50ab
- Crash reports: the terminal test answers the revoke question (#18197) fa80da7
- Crash reports: review round: one reader, one transaction, the terminal confirms a revoke (#18197) 172e7f5
- Stop and Delete a cloud machine or volume from the cost row, each confirmed only by typing its name (#18187) bcce730
- Access 5c: a linked game player mints the visitor principal (#18209) d46f453
- A changes-requested review with only a body is invisible: the pull's API, its reviews list and a repeat review request all say nothing (#18184) 1b94cba
- Full suite red: 3 files in check run 01m90cxa10vb1wxr16pmrhnt09 (#18225) 831c98f
- Game door: plain questions go to Talk at once, and continue until /forge clear (#18055) b5161cb
- Spend 3: the same cost reads and planned stop/delete as MCP tools and a terminal screen (#18206) c30e6bb
- Games: host the spark profiler viewer and its uploads in the forge (#18096) beabbda
- Games: a day after a mod set is installed, the games page says whether it helped, with take-back one tap away (#18201) 2243020
- Crash reports: the report key card reads once; the settings page budget says one over (#18197) 9200d64
- Crash reports: the report key's card moves to the settings page; the repository page reads one statement more, budgets say so 715aa93
- Games: installing the quality set ships Essential Commands' config with only /home, /spawn and /tpa on (#18199) 7b84b2c
- Connections on an account: verified identities the person controls, each with its own uses, and a lookup that answers only on opt-in (#18120) 314f4eb
- A granted app's two-page print comes out as one sheet, printed on both sides (#18194) e2e7eb4
- Traces 5c: the trace list and one trace read through MCP tools and a terminal screen compare (#18183) cc38920
- Access 5a: a visitor principal is minted only when a visitor creates something, signed, with a role in may() and per-visitor limits (#18174) e261ee9
5 earlier comments · 1 event
A repository can now take crash reports with a report key, in the Apple app's own shape, at one door. I ran only some test files, not the whole suite. They pass, along with tsc, design-lint and the gate. The forge runs the full check on this push.
What changed
- Route:
POST /api/v1/repos/:owner/:name/crash-reportsis the handler, and/api/v1/apps/...is the same handler. A hosted app is no longer required, so a native repository with noforge.jsonapp entry works. - Access: a public repository is open. A private one takes a signed-in writer or a build sending
X-Report-Key. Everyone else gets the same plain 404, which now reads "no repository by that name". - Report key: a new
report_keytable keeps only the SHA-256 of the key.- Web: the crash card on the repository's page (a repo page, or the app page) gives admins "Make report key" (it also rotates, and shows the key once on the flash) and "Revoke report key" (asks first). The card shows while the repository is private or has a key, and now also appears on a repository that is not an app.
- Terminal: the existing "Crash groups of a repository" screen gets
n(make or rotate) andx(revoke). Both doors go throughactions/report_key.ts.
- Body: the app's
{v, kind, app, os, device, at, previousRun, findings}is accepted, and the first shape still works.- Grouping: each finding files or counts one group, with the previous run's breadcrumbs. With no finding, the previous run is one group per kind with no frames.
- Issue contents:
os,device, signal, exception and termination go in the issue. No field can hold a person's name. - Limits: at most 20 findings per report. The body cap rose from 64 KB to 128 KB so a full report fits.
- Response: 202
{issue, count, opened, reopened}for the first group, plusissues[]with one entry per group.
- One door:
/api/v1/telemetry/applestays the usage summary. A crash posted there gets 422crash_reportsaying to send it to the repository'scrash-reportsroute withX-Report-Key. I did not touch #18018. - Docs: the OpenAPI rows for both paths carry the app's real payload as an example, and
docs/features/crash-reports.mdis updated. - Tests:
test/crash-report-key.test.tsposts the real payload for a private repository with no app entry, using the key and no session. It gets 202 and finds twobugissues, one per finding. It also covers the no-key 404, rotate and revoke, the admin-only forms, the terminal keys and the usage-door redirect. - Reused:
parseReport,reportCrash, the crash card,adminForm,flashTowithcode,confirmActionandRateLimiter.
Left out
- There is no JSON API or MCP tool for making the key, only the page and the terminal.
- With both
previousRunandfindings, only the findings are filed, not a separate sentinel. The app can change this by sending the sentinel alone. - I changed one existing test:
deviceis now a valid field, so it no longer proves the shape is strict. I swapped it for an unknown field and moved the oversize body to 140 KB.
Try it
Make a private repository, open its page as the owner and press "Make report key". Then curl -X POST -H 'X-Report-Key: <key>' -d @report.json $FORGE_URL/api/v1/repos/<owner>/<name>/crash-reports. Without the header it is a 404.
The route index was out of date, and I regenerated it and pushed. This should clear the one failing check.
- Cause:
postApiV1ReposOwnerNameCrashReportswas listed in the wrong place insrc/contract/openapi/routes/index.ts.bun scripts/openapi-routes.tsmoves it to sit afterpostApiV1ReposOwnerNameCopies, where the test expects it. - Tests: I ran
test/openapi: 694 pass, 0 fail. I did not re-run the full suite. The forge's check does that on the push. - Change: the only diff is that one line moving in the generated index. No page, action or tool changed, so the commit says
No door:for the terminal and docs rule.
The two failing checks are fixed and pushed. The tests that cover the change pass locally, and so does tsc. I did not run the full suite; the forge runs that on the push.
What changed in this fix
- Report key controls moved. Make, rotate and revoke now sit in a "Report key" card on
/:owner/:name/settings, not on the repository page. They made the repository first view too heavy: 120 words against a budget of 116, and 21 blocks against 18. The make and revoke actions now redirect back to the settings page. The how-to and the OpenAPI text say where the key is made. - Crash groups card. The repository page counts crash groups in one statement, and only for a repository with no app page. A repository with an app page, and the studio, read nothing extra.
- OpenAPI tag.
crash-reportsnow maps to therepostag, which fixescontract-openapi-tags. - SQL budgets raised.
src/perf/page_budgets/app.tsgoes from 58 to 59 statements, with a note.test/did-you-mean.test.tspinsFOUND_QUERIESat 37, up from 36.- The card was costing 3 extra statements before this fix; it now costs 1.
- Attention budget raised. The
crewentry goes up by 3 words and 2 blocks, for the report key card on/settings/crew. The note indocs/design/attention-budget.jsonsays why. - Test edited.
test/crash-report-key.test.tsnow looks for the card on the settings page, because the card moved. The test was wrong about the place, not the behaviour.
Left as is
- The gate still prints similarity warnings between
makeKey/revokeKeyand between the two key form handlers. They come from earlier commits on this pull, and I did not merge them.
No door: the terminal side already has the key, on n and x in the crash groups screen, so only the how-to changed.
Try it
Make a private repository and open its settings. Make a key, send a report with X-Report-Key, then rotate and revoke it.
[
{"go":"/<owner>/<name>/settings","look":"Report key card above Branch and gates","expect":"Make report key button; after it, the key shows once on the flash and the card offers Rotate and Revoke"},
{"go":"/<owner>/<name>","look":"A repository with no app page and open crash groups","expect":"Open crash groups card, with no key controls on the page"}
]This push fixes the budget failure on /:owner/:name/settings, which was 62 SQL statements against a limit of 60.
- Cause: the report key card on the settings page read the key's made-at date twice, once for the buttons and once for the words.
- Fix: it now reads once. The new
keyWords(at)insrc/actions/report_key.tsbuilds the words from a date already read, andkeyLinestill calls it for the terminal and the flash messages. The card useskeyWords. - Budget: the page still costs 61, one over the default of 60. I added
test/budgets/pages/owner-name-settings.jsonwith a stated reason for that one statement. I did not find a way to fold it into an existing read. - Checks that failed before:
test/pages-budget.test.tspasses.tsc --noEmitis clean.test/page-budget.test.tsand the dead-code and process-state tests pass.- The gate prints only similarity hints, none of which blocks the push.
- Door: the commit says
No door:. The terminal already shows the samekeyLinewords, so nothing changes there. - Left out: the page has no change that needs a
reviewblock, since the markup is unchanged.
This round answers @sentinel's five points. Four are changed; the budget one I kept, and say why below.
I ran tsc, test/crash-reports.test.ts, test/crash-report-key.test.ts and test/pages-budget.test.ts, and all pass. I did not rerun the gate's --explain or the other guard tests after the final edits. The first gate.ts --fix listed four similarity notes ("one implementation?") that I did not act on, and I pushed without rerunning it.
Changes
- I deleted
parseReportfromsrc/core/crash_groups.ts. The tests intest/crash-reports.test.tsnow go throughparseReportsvia a small local helper that takes the first element. - I removed the leftover bare
{ }block insrc/http/api/crash_reports.tsand dedented the handler. - Terminal
xnow opens a confirm screen ("Revoke the report key?", Cancel or Revoke), the sameconfirmScreenpattern the other terminal screens use. Nothing is revoked until Revoke is chosen. The terminal test now checks thatxalone keeps the key and that answering the confirm revokes it. reportCrashesfiles all groups in one transaction. If one group fails, none of the earlier ones are filed, so a retry cannot double-count.- I docs-noted
/api/v1/apps/...as an alias kept for builds already using it, and said to userepos.
What I left as it was
- Budgets (point 5): I did not fold the settings key read into an existing read, so the
owner-name-settings.jsonbudget stays at 61 statements. The key lives in its ownreport_keytable, which has no row until a key is made, so it cannot join the settings-record read. I added that reason to the budget'swhy. - App page budget: the app page statement budget stays at 59. A repository without an app page needs one
groupCountread that the page never made before, and there is no existing read to fold it into. attention-budget.json: I did not touch it this round. The earlier raise of 3 words and 2 blocks for the Report key card remains.
I merged main into the branch, resolved the six conflicts and pushed. tsc --noEmit and gate.ts are clean, and the crash-report, openapi, report-key and terminal tests pass (720 across 37 files). I did not run the full suite; the forge's check does that on the push.
What the conflicts were. main (#18226) had added its own parser for the Apple app's body, and it disagreed with this pull's on several points. I kept this pull's structure (parseReports returns a list, reportCrashes takes a list, the repos path and report key stay) and made it accept main's spellings as well:
app: text of up to 64 characters, or{version, build}.previousRun:true, or the object form.- Findings: a finding can carry its own
breadcrumbs. - No build:
buildmay be absent when findings are sent. Such a report counts but never reopens a closed group, and no build is invented for it. - Mixed body: a top-level
framestogether withfindingsfiles all of them. - Same group twice: two findings of one group count once.
main's new behaviours carried over: the title and "Seen again" comment leave the build out when there is none, the issue says the report came from the run after the one that failed, and a post with several findings is filed whole or not at all.
Where the two sides disagreed and I picked this pull's. The limit is 20 findings and 128 KB, not main's 8 and 64 KB. os and device are refused over 64 characters. The answer lists the groups under issues, not findings.
Tests changed on main's side. main's tests are in test/crash-reports.test.ts, adapted to the list-based parser, and its assertions on findings in the response now read issues. If any client already reads findings, that key is gone.
Docs. docs/features/crash-reports.md and the openapi route text say what the parser now accepts.
Not done. The route no longer requires the repository to be a hosted app; main's check for that was dropped, which is what the native-app reports in this pull need.
The gate prints its usual "one implementation?" similarity notes for the report-key files; it exits 0.
A repository can now take crash reports with a report key, in the Apple app's own shape, at one door. I ran only some test files, not the whole suite. They pass, along with
tsc,design-lintand the gate. The forge runs the full check on this push.What changed
POST /api/v1/repos/:owner/:name/crash-reportsis the handler, and/api/v1/apps/...is the same handler. A hosted app is no longer required, so a native repository with noforge.jsonapp entry works.X-Report-Key. Everyone else gets the same plain 404, which now reads "no repository by that name".report_keytable keeps only the SHA-256 of the key.n(make or rotate) andx(revoke). Both doors go throughactions/report_key.ts.{v, kind, app, os, device, at, previousRun, findings}is accepted, and the first shape still works.os,device, signal, exception and termination go in the issue. No field can hold a person's name.{issue, count, opened, reopened}for the first group, plusissues[]with one entry per group./api/v1/telemetry/applestays the usage summary. A crash posted there gets 422crash_reportsaying to send it to the repository'scrash-reportsroute withX-Report-Key. I did not touch #18018.docs/features/crash-reports.mdis updated.test/crash-report-key.test.tsposts the real payload for a private repository with no app entry, using the key and no session. It gets 202 and finds twobugissues, one per finding. It also covers the no-key 404, rotate and revoke, the admin-only forms, the terminal keys and the usage-door redirect.parseReport,reportCrash, the crash card,adminForm,flashTowithcode,confirmActionandRateLimiter.Left out
previousRunandfindings, only the findings are filed, not a separate sentinel. The app can change this by sending the sentinel alone.deviceis now a valid field, so it no longer proves the shape is strict. I swapped it for an unknown field and moved the oversize body to 140 KB.Try it Make a private repository, open its page as the owner and press "Make report key". Then
curl -X POST -H 'X-Report-Key: <key>' -d @report.json $FORGE_URL/api/v1/repos/<owner>/<name>/crash-reports. Without the header it is a 404.Closes #18197