feat(webapp,core): add a public HTTP API for errors#4005
Conversation
Adds an environment-scoped HTTP API over the Errors feature, mirroring the runs API: list error groups (filter by task, version, status, search and time range, with cursor pagination), retrieve a single group, and change its state with resolve, ignore, and unresolve. A new filter[error] option on the runs list returns the runs behind a group. Request and response schemas are exported from @trigger.dev/core/v3 for the SDK to reuse, and the endpoints are documented in the API reference. State changes record who made them. A plain environment API key has no user, so the attribution stays null. When the request uses an environment JWT obtained by exchanging a personal access token or a delegated user token, that exchange now stamps an act claim and the write endpoints read it to attribute the change to the acting user.
🦋 Changeset detectedLatest commit: e6d780a The changes in this PR will be included in the next version bump. This PR includes changesets to release 27 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📜 Recent review details⏰ Context from checks skipped due to timeout. (37)
WalkthroughThis PR introduces a public HTTP Errors API for trigger.dev's v3 environment. Five new Remix API routes are added for listing error groups, retrieving a single group, and mutating state (resolve, ignore, unresolve). New Zod schemas for these operations are defined in 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
Use hasOwnProperty instead of `in` when validating filter[status] so inherited Object properties (e.g. toString) can't pass validation and map to a non-status value.
Summary
Adds an environment-scoped HTTP API over the Errors feature, mirroring the runs API. Task-run failures are grouped by a fingerprint into "error groups," and this exposes everything you can do with them in the dashboard:
GET /api/v1/errorslists error groups, withfilter[taskIdentifier],filter[version],filter[status](unresolved/resolved/ignored),filter[search], a time range, and cursor pagination.GET /api/v1/errors/{errorId}retrieves a single group (summary, lifecycle state, affected versions).POST /api/v1/errors/{errorId}/{resolve,ignore,unresolve}changes its state.GET /api/v1/runs?filter[error]={errorId}lists the runs behind a group.Request and response schemas are exported from
@trigger.dev/core/v3so the SDK can reuse them, and all endpoints are documented in the API reference (OpenAPI).errorIdis theerror_<fingerprint>friendly id.Attribution
State changes record who made them. A plain environment API key has no user, so
resolvedBy/ignoredByUserIdstay null. When the caller uses an environment JWT obtained by exchanging a personal access token or a delegated user token atPOST /api/v1/projects/:ref/:env/jwt, that exchange now stamps anactdelegation claim, and the write endpoints readact.subto attribute the change to the acting user. This is the first endpoint to consume theactclaim, so two small pieces of plumbing ride along: the exchange stampsactfor personal-access-token subjects too (it was delegated-token-only), and the public-JWT bearer-auth path surfacesact.subto the handler.Built on the delegated-token work in #3997.