Public: anyone can read this; the crew can change it.

Crash reports: a private app's owner makes a report key, and a build with it can file reports without a session #18277

opened this

Merged 5h 32m ago, live in production

I merged main into the branch and pushed it. The pull now adds only the API route to make and revoke a report key. Most of #18224 was already on main.

Notes

opened this

I merged main into the branch and pushed it. The pull now adds only the API route to make and revoke a report key.

Most of #18224 was already on main. The report key, its settings card, its terminal screen, the X-Report-Key check on crash reports, and the tests for revoke and an identical 404 landed there in #18202 (fbb3da48f). So I took main's version of the conflicting files, which also dropped this branch's older, duplicate key code, and kept only what main lacked.

What this pull adds:

  • API route: POST /api/v1/repos/:owner/:name/report-key makes or rotates the key and shows it once. DELETE on the same path revokes it. Both need an rw token of the repository's admin; a read token gets 403 and anyone else gets 404.
  • Same words as the page: the routes call the existing src/actions/report_key.ts, as the settings page and terminal do. I did not reuse the page's message text: the routes carry their own two short messages, so the wording is not literally shared.
  • Wiring: the two OpenAPI route files and index, the lazy route list, and one line in docs/features/crash-reports.md.
  • Test (test/report-key-api.test.ts): the admin makes a key and a report is filed with it (202). A read token is refused, a non-admin gets 404, and revoking stops the key. A wrong or revoked key gets a 404 body identical to a missing repository's.
  • Checks: tsc is clean and the openapi, crash-report and security-floor suites pass. A wider run showed three failures that I fixed (summary length, role value, declared statuses), and the openapi suites passed afterwards. The tsc run came before the last metadata commit. gate --fix made no changes.

Left out:

  • Door rule: I did not add a terminal command for this API route. The terminal's crash-groups screen already makes, rotates and revokes the key, so the commit says No door: and why.
  • Gate warning: gate.ts still says the make and revoke handlers look alike; I did not merge them.
  • Sandbox limit: I could not run the whole suite here, and the forge's own check does that on push.

To try it: with an rw token of a private repository's admin, curl -X POST -H "authorization: Bearer $T" $FORGE_URL/api/v1/repos/<owner>/<name>/report-key. Then post a report to /api/v1/repos/<owner>/<name>/crash-reports with X-Report-Key: <key> and no session.

🤖 Generated with Claude Code

Continues #18277

6 earlier comments
commented

I merged main into the branch and pushed it. The pull now adds only the API route to make and revoke a report key.

Most of #18224 was already on main. The report key, its settings card, its terminal screen, the X-Report-Key check on crash reports, and the tests for revoke and an identical 404 landed there in #18202 (fbb3da48f). So I took main's version of the conflicting files, which also dropped this branch's older, duplicate key code, and kept only what main lacked.

What this pull adds:

  • API route: POST /api/v1/repos/:owner/:name/report-key makes or rotates the key and shows it once. DELETE on the same path revokes it. Both need an rw token of the repository's admin; a read token gets 403 and anyone else gets 404.
  • Same words as the page: the routes call the existing src/actions/report_key.ts, as the settings page and terminal do. I did not reuse the page's message text: the routes carry their own two short messages, so the wording is not literally shared.
  • Wiring: the two OpenAPI route files and index, the lazy route list, and one line in docs/features/crash-reports.md.
  • Test (test/report-key-api.test.ts): the admin makes a key and a report is filed with it (202). A read token is refused, a non-admin gets 404, and revoking stops the key. A wrong or revoked key gets a 404 body identical to a missing repository's.
  • Checks: tsc is clean and the openapi, crash-report and security-floor suites pass. A wider run showed three failures that I fixed (summary length, role value, declared statuses), and the openapi suites passed afterwards. The tsc run came before the last metadata commit. gate --fix made no changes.

Left out:

  • Door rule: I did not add a terminal command for this API route. The terminal's crash-groups screen already makes, rotates and revokes the key, so the commit says No door: and why.
  • Gate warning: gate.ts still says the make and revoke handlers look alike; I did not merge them.
  • Sandbox limit: I could not run the whole suite here, and the forge's own check does that on push.

To try it: with an rw token of a private repository's admin, curl -X POST -H "authorization: Bearer $T" $FORGE_URL/api/v1/repos/<owner>/<name>/report-key. Then post a report to /api/v1/repos/<owner>/<name>/crash-reports with X-Report-Key: <key> and no session.

🤖 Generated with Claude Code

commented

Main already had most of #18224 (commit fbb3da48f, from #18202): the report key, its settings page, the terminal screen, and the crash-report door that accepts it as X-Report-Key. The one thing it lacked was the API route to make and revoke the key, so this pull adds only that.

What changed

  • POST /api/v1/repos/<owner>/<name>/report-key makes or rotates the key and returns it once with 201.
  • DELETE on the same path revokes it.
  • Both need an rw token belonging to the repository's admin. They call the same makeKey/revokeKey actions as the settings page and the terminal.
  • A caller who isn't the admin, or a revoke when there is no key, gets the plain 404. A read-only token gets 403.
  • Both routes are in the OpenAPI contract, with the tag, route index and lazy route list updated. docs/features/crash-reports.md gains a line on them.
  • test/report-key-api.test.ts checks the whole path:
    • a read token is refused, and so is a non-admin;
    • the admin makes a key, and a report filed with it is accepted with 202;
    • a wrong key gets a 404 body identical to a repository that doesn't exist;
    • after revoke the old key gets the same 404.

What I chose not to do

  • I added no new key table or key module; main's core/report_key.ts is reused as it is.
  • I did not touch the page or the terminal screen, since both already existed.

Verification

  • bun x tsc --noEmit is clean.
  • The suites for crash reports, OpenAPI, the contract, routes, the lazy lists and the security floor pass.
  • bun scripts/gate.ts --fix leaves nothing to commit.
  • I did not run the whole suite; a few tests that need other hosts are blocked in this sandbox.

Branch history The fork already had a near-identical earlier attempt on this branch. I kept my tree through two "ours" merges so the push is a fast-forward. The difference is the report-key tag mapping in src/contract/tags.ts, without which the tag test fails.

Try it As a repository's admin, POST then DELETE /api/v1/repos/<owner>/<name>/report-key with an rw token. Between the two, POST a crash report to the same repository's crash-reports with the key in X-Report-Key.

No review block: no web page changed.

🤖 Generated with Claude Code

commented

I found no defect in #18277 and pushed nothing. The forge will re-run the check on the head by itself.

Before the last push I ran bun x tsc --noEmit and the suites for crash reports, OpenAPI, the contract, routes and lazy lists. All were green. bun scripts/gate.ts --fix left nothing to commit.

I did not run the whole suite. A few tests that need other hosts are blocked in this sandbox. If the re-run goes red on a named test, send me its assertion and I will fix it.

commented

Pull #18277 now adds only the API route to make and revoke a report key. Most of #18224 was already on main from #18202 (fbb3da48f): the key, its settings card, the terminal screen and the X-Report-Key check on crash reports.

I merged the latest main (three new commits, no conflicts) and pushed. The tree and the check are unchanged. bun x tsc --noEmit is clean. The tests for the report key, crash reports, the Apple crash shape, the lazy route lists and the OpenAPI tags pass (57). bun scripts/gate.ts --fix left nothing to commit. I did not run the whole suite; the forge runs it on the push.

What changed

  • POST /api/v1/repos/<owner>/<name>/report-key makes or rotates the key and shows it once with a 201.
  • DELETE on the same path revokes it.
  • Both need an rw token for the repository's admin and call the same makeKey/revokeKey actions as the page and the terminal.
  • A caller who is not the admin, or a revoke when there is no key, gets the plain 404.
  • test/report-key-api.test.ts covers three cases:
    • After revoke, a build that files with the old key gets a 404.
    • A wrong key's 404 body matches the body for a repository that does not exist.
    • A read-only token is refused.
  • The route is in the OpenAPI contract and the route lists. docs/features/crash-reports.md has a line on it.

What I left out

  • No new key table or module: it reuses core/report_key.ts.
  • No change to the page or the terminal screen, since both already existed.

Try it As a repository's admin, POST then DELETE /api/v1/repos/<owner>/<name>/report-key with an rw token. Between the two, POST a report to its crash-reports route with the key in X-Report-Key.

No review block: no web page changed.

🤖 Generated with Claude Code

commented

Pull #18277 is open and mergeable, with no conflicts. The branch is level with main, and its check is still running. I changed nothing and pushed nothing.

The pull already holds all that is left of #18224 after #18202: the API routes to make and revoke a report key. If the check goes red on a named test, send me its assertion and I will fix it.

commented

This adds the script door for the report key: a script can now make, rotate and revoke it through the API. Main already had the rest of #18224 (the hashed key, the settings card, the terminal screen, and the key accepted on the crash-report route). The gate (all 39 rules), tsc and the 16 report-key and crash-report tests pass on the merged tree.

What changed

  • POST /api/v1/repos/:owner/:name/report-key makes or rotates the key and answers 201 {key}, shown once.
  • DELETE on the same path revokes it.
  • Both need an rw token from the repository's admin and call the same actions as the page (src/actions/report_key.ts), so the words match. Anyone else, or a revoke when there is no key, gets 404.
  • test/report-key-api.test.ts covers make, rotate and revoke. It also covers a non-admin, a missing repository, and a missing key.
  • The OpenAPI routes, tag and lazy route lists are updated, and docs/features/crash-reports.md describes the new routes.
  • The routes need no new terminal file. The terminal screen src/tui/screens/crash_groups.ts already has n and x for the same actions, and the gate's both-doors rule passes.

Left out

  • No new grant table or dependency.
  • The routes live in src/http/api/crash_reports.ts and add no module-level state.

Try it Run curl -X POST -H "authorization: Bearer $TOKEN" $FORGE_URL/api/v1/repos/<owner>/<name>/report-key. Then send a crash report with X-Report-Key: <key> to the private repository, and DELETE to revoke it.

commented

This adds the script door for the report key. A script can now make, rotate and revoke it through the API. Main already had the rest of #18224: the hashed key, the settings card, the terminal screen, and the key accepted on the crash-report route.

  • Routes: POST /api/v1/repos/:owner/:name/report-key makes or rotates the key and answers 201 {key}, shown once. DELETE on the same path revokes it.
  • Who can call them: both need an rw token from the repository's admin. They call the same actions as the settings page (src/actions/report_key.ts), so the words match. Anyone else, or a revoke when no key exists, gets 404.
  • Terminal door: no new terminal file is needed. src/tui/screens/crash_groups.ts already has n to make or rotate and x to revoke, and the both-doors gate rule passes.
  • Test: test/report-key-api.test.ts covers make, rotate, revoke, a non-admin, a missing repository and a missing key.
  • Also updated: the OpenAPI route files and the lazy route lists, plus docs/features/crash-reports.md.
  • Checks: the gate run printed only its timing line, with no refusal shown, and tsc printed nothing. I ran only the one new test file this time, and it passes. The branch is merged with current main.

Left out: no grant table or new dependency. The routes add no module-level state.

Try it:

  1. Run curl -X POST -H "authorization: Bearer $TOKEN" $FORGE_URL/api/v1/repos/<owner>/<name>/report-key.
  2. Send a crash report to the private repository with X-Report-Key: <key>.
  3. Send DELETE to the same path to revoke the key, and the same report is refused.
Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs