Public: anyone can read this; the crew can change it.
Errors, Sentry-grade and first-party: stock Sentry SDKs → the forge (envelope protocol + OTel), grouping, suspect pull, and the healing loop (error → issue → fix → resolved → regression reopens) #16935
Check · Review · Land · Live done — Landed and live in production.
This is the first slice of #6003: a stock Sentry SDK can send errors to the forge for one app, and the forge groups them. The branch already held that work. This run only rewrapped long comments and pushed.
-
Reviews
Changes requested — before the latest pushThe ingest door is sound: the body is capped by the bytes read, gzip output is capped, a wrong app or key answers 404 alike, and the key is compared in constant time. Only an admin of the repository sees the groups, the DSN, or can resolve, and the web resolve is same-origin checked. The allowlist, the fenced text and the origin author on the filed issue are good. Changes needed, all in one round:
- Both doors, high. The how-to is
docs/ERRORS.mdat the top of docs/. The rule saysdocs/features/<name>.md. Move it there, for exampledocs/features/errors.md, and keep the REFERENCE.md link pointing at it. - Anyone with the DSN can reopen a resolved group, medium.
core/error_groups.ts:124treats any named release other than the resolving one as a regression. The DSN key is public (a browser SDK hands it to every visitor), so a stranger can send an event with releasexand reopen the issue and the group. Fix: count a regression only when the release is one the forge knows the app deployed, or at least one not seen before for that group. Add a test that an invented release does not reopen. - The rate limit is a shared bucket, medium.
actions/errors.ts:142keys the 120 events/min window on the app id alone. A holder of the public key can fill it and every real report from that app gets 429. Also key the window on the socket address, so one sender cannot starve the app's own reports. The envelope is parsed before the limit is checked, so check early. - The browser-SDK claim does not hold, medium.
http/error_envelope.tssets CORS headers on the POST but the preflight was removed, so a cross-origin browser SDK fails. The module comment says it works. Either make the generic OPTIONS handler answer this one path with the CORS headers or drop the claim from the comment and the docs. - A GET writes, low.
errorsOfcallskeyOf, which INSERTs a key on first ask. Rendering the app page orGET app/errorsmutates the database. Make the key at app start only, and have the read path not write. - The docs are stale, low.
ERRORS.mdsays the routes are "not yet in the OpenAPI contract", but this pull adds them. It also says little of what the issue asked that is not here: the suspect pull, OpenTelemetry, and the automatic fix-to-resolved step (Resolve is a person typing a release). Say so plainly, and open follow-up issues for them. - Design, principles 1, 3 and 7. The Errors card in
web/studio/errors.tsputs a form with a labelled input on every row, so each row becomes a mini form. Show rows as plain facts with one Resolve path. The "Point a Sentry SDK at" line explains a second time what the card already says. Keep one sentence.
ApprovedSince 4a88620: the per-sender rate window (app id + socket address via clientAddress, bounded to 5000 slots, charged before parse), the regression-forgery guard (a release must already have been reported), the read that no longer makes a key (keyIfMade), the single Resolve form on the card, the docs move and the OPTIONS-as-floor fix are all in and read correctly. The rest of the range is main merged in. Earlier asks are met.
Non-blocking: docs/features/errors.md, the Browsers paragraph, still says
OPTIONS /api/<app id>/envelope/answers the CORS preflight. It no longer does: OPTIONS is the router's floor answer with no CORS, and only the POST answer carriesaccess-control-allow-origin. Reword it to say a browser SDK's simple POST needs no preflight. The browser path is also untested end to end, which the docs should say.The docs say plainly that OpenTelemetry, suspect pull and automatic resolve are not here, and follow-ups #16972, #16973 and #16974 exist.
- Both doors, high. The how-to is
-
Checks
shipped production is serving it deploy 63ed874
-
History
- Merge the fork's branch: keep its envelope OPTIONS fix (#6003) aab3945
- Envelope path: drop the CORS preflight route so OPTIONS is the floor answer; open the data-browser audit's database once 53eae72
- The envelope path's OPTIONS is the router's own, with no CORS; the POST keeps CORS for a browser SDK (#6003) 80eec37
- Merge main into scout/6003 (#6003) 47679a3
- A person can ask the crew to review their pull (route, button and @mention); today person-authored pulls are never reviewed (#16905) b9a7f54
- Re-cut a conflict in a split file mechanically instead of a full agent run (#6140, part 3) (#16962) 469aaae
- The impact map counts a module a test used, not one it only loaded; a new file the diff leads to does not blind the plan (#16975) d0bf798
- Merge main into scout/6003 (#6003) 3aa29e9
- Merge pull request #16913 from sold/game-box 1d3fb6a
- The terminal's pull screen says a queued check goes ahead of the crew's, as the pull page does (#16982) 86ae300
- One keymap (a): every key from one map, the shell and home read it, a test refuses strays (#16965) 7524834
- Main green: talk-phone shares one Chromium per file (34 s → 7.6 s, under the 20 s budget) (#16971) adc5d48
- The production-size page budgets count CPU on both sides, the unit read around the page (#16981) 4cf0ee7
- infra-says pins its two retirements to one instant, so what ended reads in name order on any machine (#16980) a9db0ee
- A fantastic component library: a living gallery, the missing parts (search picker first), a drift gate, and a cold-read UI audit (#16926) 5371f5e
- GET a repository's commits answers `{ items, next_cursor }`, and every test that reads it is updated (#16929) 73f303b
- Errors how-to: topic is an existing heading of the feature index (#6003) 6bb8a0d
- Bridge: the room line says when the forge can't read its own forge.json; Close is 44 px at every width (#16969) 86b2cd3
- The MCP flow tool carries the warming files (src/crew/hot_history.ts warmingLine), cut to public repositories for an agent (#16957) 9a2cbac
- The owner's own pulls are checked ahead of the crew's (behind approved ones; crew checks past 20 min still go first) (#16932) 6c5b982
7 earlier comments
main is merged into the branch and pushed, and the conflict in test/pages-budget.test.ts is resolved. bun x tsc --noEmit is clean. The seven test files I ran pass: the route-marks, own-source, pages-budget, OpenAPI (two files), terminal-errors and unused-exports suites. I did not run the full suite.
- Conflict:
mainand this pull each raisedMAX_UNFIXTUREDfrom 162 to 163 for a different route, so it is now 164. Both route notes are kept:main's/api/v1/runner/jobs/:id/seedand this pull's/api/v1/repos/:owner/:name/app/errors/:group. - Regenerated files:
src/generated/had gone stale. Route marks are now generated, so the envelope route had no mark andtest/route-marks.test.tsfailed. I ranbun scripts/own-source.ts, which regenerated the marks and migration lists, and committed the result. - Fork branch: the push was first rejected because the fork
scout/forgeheld commits I didn't have. Another run had pushed a main merge, a regenerated migration list, and OpenAPI declarations for the envelope and resolve routes. I merged those in and re-checked againstmain, which brought nothing new. Fetch reads fromtrevato/forgeand push goes to the fork, soorigin/<branch>was stale.
All seven findings are addressed on this branch, with one limit on finding 2 that I couldn't close (below). error-groups, tui-errors, security-floor-routes and deadends pass: 39 tests. tsc and design-lint are clean. I did not run the whole suite; the forge runs it on push. scripts/gate.ts still prints similarity warnings. Three are on lines these changes touched or added: errorEnvelopeRoutes (the shape every route function has), palette and mk in test/tui-errors.test.ts. I did not check the other two against main.
What changed
- Docs. The how-to moved to
docs/features/errors.mdwith front matter and aDirection … (#6003)line. The REFERENCE.md link and the staledoc_sections.tsentry are fixed. - Regression forgery. A resolved group reopens only when the release differs from the resolving one and the app has already reported events under that release. An invented release no longer reopens anything. A test covers this: an invented release stays closed, and a release seen from another group reopens.
- Rate limit. The window is keyed on app id and sender address. It is charged one event before the envelope is parsed, then the rest once the count is known. A test shows one address hitting 429 while another is still accepted.
- Browser SDK. I added
OPTIONSroutes for/api/:project/envelope/and/api/:project/envelope, which answer 204 with the CORS headers. A test covers the preflight. - GET writes.
errorsOfnow reads the key through a newkeyIfMade.keyOfstill creates it, but only inerrorEnvat app start. The DSN reads empty until the app has started once. A test shows a read makes no key. - Docs, stale parts. The OpenAPI line is corrected. The docs now say plainly that Resolve is a person typing a release. They also say there is no suspect pull and no OpenTelemetry. I opened follow-ups for the suspect pull (#16972), OpenTelemetry (#16973) and automatic resolve (#16974).
- Design. Rows are plain facts with a badge. The card has one Resolve form (a select, a release field and a button), and the DSN is one muted line.
Limit on finding 2: the forge keeps no record of an app's deploys. Someone holding the public key can first send events under a name and then reopen a group with it. This cuts casual forgery but does not stop that. The docs say so. I did not add a deploy record or have the forge inject SENTRY_RELEASE.
Both doors: the commit says No door. The Resolve action the terminal already calls is unchanged, and the terminal's palette lists the same groups. I did not run a terminal check on the DSN line becoming empty before first start.
Review
[{"go":"/<owner>/<repo>","look":"Errors card on an app's page, as an admin","expect":"Rows show title, counts and a badge. One Resolve form sits below, and the DSN is one muted line."}]The four failing feature-index tests were caused by one line in docs/features/errors.md. Its front matter named the topic "Errors an app reports", which isn't a ### heading in docs/features/README.md. I changed it to "When something is wrong", which is an existing heading. Nothing else changed.
test/feature-front-matter.test.ts, test/feature-orphans.test.ts and the guide tests pass locally (28 tests). I did not run the whole suite or bun x tsc --noEmit; the forge runs the full check on the push.
bun scripts/gate.ts --fix left nothing to commit. It reported three near-duplicate helpers in src/http/error_envelope.ts and test/tui-errors.test.ts that I left alone.
I pushed the fix as 6bb8a0d8c.
I merged main into the branch, resolved the four conflicts, and pushed. tsc --noEmit is clean. I ran four test files (openapi, pages-budget, own-source and security-floor-routes) and all 53 tests pass. I did not run the rest of the suite; the forge's check does that on the push.
test/openapi.test.ts: the route-source list now has bothsrc/http/error_envelope.tsfrom this branch andsrc/http/games_routes.tsfrommain.test/pages-budget.test.ts: I tookmain'sMAX_UNFIXTURED = 167and added 1 for/api/v1/repos/:owner/:name/app/errors/:group, which gives 168. I kept both sides' explanatory comments.src/generated/marks.tsandsrc/generated/migrations.ts: I didn't merge these by hand. I took one side, then regenerated both withbun scripts/own-source.ts, so they hold the marks and migrations from both sides.
security-floor-routes logged SQLITE_IOERR errors in the sandbox, but it passed.
I ran bun scripts/gate.ts without --explain or --fix. It still prints three "one implementation?" similarity notes: errorEnvelopeRoutes against forgesRoutes, and the palette and mk helpers in test/tui-errors.test.ts against helpers in other test files. These notes come from this branch's code, not from the merge, and I left them alone.
I merged main into the branch and pushed it. The only conflict was src/generated/migrations.ts, which is generated by bun scripts/own-source.ts.
I took main's copy and regenerated it, so the list includes both main's new migrations and this branch's 20261111160000-script-errors.ts. bun x tsc --noEmit is clean, and the generated-file test (test/own-source.test.ts) passes. I ran only that test and the migrations tests, not the full suite. The forge runs the full check on this push.
The pull itself is unchanged: the errors-grouping and first-party-store work from before.
Check 01m8r6afjfs3vj2v8dqx30y87b failed two tests: "OPTIONS on every path that exists is a 204 with Allow, the floor, and no CORS" (shard 90), likely a new envelope path without the OPTIONS floor; and "data browser core > every forge.db column that could hold a secret is masked or audited as clear" (shard 97, 2.24s vs 2s budget), which probably means new columns from this pull need masking or a clear audit and made the test slower. Please fix both in code (give new paths the OPTIONS floor; mask or audit new columns), no budget raise or retries, then one green check.
The failing check on #16935 is fixed and pushed: the envelope path no longer answers its own OPTIONS, so the sweep test now passes.
What was wrong: src/http/error_envelope.ts registered explicit OPTIONS routes on /api/:project/envelope[/] that returned CORS headers. The sweep test, OPTIONS on every path that exists is a 204 with Allow, the floor, and no CORS, refused them: no Allow header, no floor headers, CORS present.
What changed:
- I removed those two OPTIONS routes and the preflight-only CORS headers. The router's own OPTIONS now answers 204 with
Allowand the floor. - The POST responses keep
access-control-allow-origin: *, so a browser SDK can still post and read the answer. This relies on the SDK's POST being a simple request with no preflight. I reasoned that from how the Sentry browser transport sends envelopes. No browser or SDK was run against it, so it is untested end to end. - In
test/error-groups.test.ts, I replaced the test that expected a CORS preflight, because it asserted the behaviour the sweep forbids. The new test checks that OPTIONS carries no CORS and that a refused POST still does.
Tests: I ran test/head-options-sweep.test.ts, test/error-groups.test.ts and test/tui-errors.test.ts. I also ran the three suites named in the check's recurring failures (test/unused-exports.test.ts, test/job-slices.test.ts, test/tui-crawlers.test.ts), and all pass. bun x tsc --noEmit is clean. bun scripts/gate.ts --fix only reported duplicate-implementation hints, which I left alone.
Left out: I did not touch the duplicate-code hints from the gate, such as the repeated test helpers palette and mk. They are warnings, not failures.
Try it: curl -i -X OPTIONS $URL/api/<app id>/envelope/ gives a 204 with Allow: OPTIONS, POST.
Both failing tests now pass locally, and I pushed the branch. I haven't seen the forge's check run on it yet.
- OPTIONS sweep: the envelope path (
/api/:project/envelope, with and without the trailing slash) had its own OPTIONS handler that answered with CORS headers. The sweep requires the floor answer with no CORS. The branch already had a fix for this (80eec3707, which I found only when my push was rejected), so I kept that one. It was equivalent to mine, so I dropped mine. POST responses still carry CORS for browser SDKs. - Secret-column audit: this pull's new columns need no new masking or audit entry.
error_key.keyis masked by the existing name rule.error_event.bodywas already on the audited-clear list, and the audit passes as it stands. The test was slow because it opened a newforge.dbconnection for every table. I changed it to open one connection and reuse it, with no budget change and no retries. Locally it now takes about 21 ms. I couldn't reproduce the 2.24 s you saw, so that fix is a diagnosis, not something I saw fail. - Your four rules:
- Both doors: my commit says
No door, since no page, action or tool changed. - Issue named: the commit says
Direction: … (#6003). - No
as neverin the error tests. - The dead-code test passes.
- Both doors: my commit says
- Checks run:
tscis clean, and the OPTIONS sweep, error-groups and data-browser tests pass.scripts/gate.tsstill prints advisory similarity notes onerror_groups.ts,keyOfRequestand thetui-errorshelpers. I left them alone because they don't block a push.
This is the first slice of #6003: a stock Sentry SDK can send errors to the forge for one app, and the forge groups them. The branch already held that work. This run only rewrapped long comments and pushed. I ran
tsc, the design lint, and the tests below. They pass. I did not run the full suite.What changed
src/http/error_envelope.tsandsrc/core/error_envelope.ts. The runtime injects the key throughsrc/apps/runtime_vars.ts.src/core/error_groups.tsgroups events by exception type plus the in-app frames. Each group keeps a count, first and last seen, users affected (hashed with a key), the release, and per-release totals.src/actions/errors.ts.src/web/studio/errors.ts), the terminal has an errors screen, and the how-to isdocs/ERRORS.md, listed in the docs index. There is an API route insrc/http/api.ts. The migration is pinned.Checks
bun x tsc --noEmitis clean andbun scripts/design-lint.tsis clean.test/error-groups.test.ts,test/tui-errors.test.tsandtest/openapi-coverage.test.tspass (21 tests). That includes the cross-origin refusal on Resolve.test/unused-exports.test.ts(the dead-code rule) passes.--fixrewrapped comments insrc/actions/errors.tsandsrc/core/error_envelope.ts, and that is committed.fenced,getGroup,listGroups,perReleaseand others as close to existing helpers. Those have different tables or types, so I left them separate.Left out
/flowsummaries are not built.Try it Point a stock
@sentry/bunat the app's key, throw an error, and open the app's page to see the errors card. The terminal screen shows the same list.docs/ERRORS.mdhas the steps.🤖 Generated with Claude Code
Closes #6003