• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Unleash / unleash / 39934505532
88%
master: 91%

Build:
Build:
LAST BUILD BRANCH: main
DEFAULT BRANCH: master
Ran 23 Oct 2026 09:53AM UTC
Jobs 1
Files 1245
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

23 Oct 2026 09:47AM UTC coverage: 88.167% (-0.007%) from 88.174%
39934505532

push

github

web-flow
fix(api-tokens): fail v2 token expiry update and delete when the transaction rolls back

## Summary
Updating a v2 API token's expiry or deleting it answers 200 even when
the change rolls back. Both routes run the token change and its audit
event in one transaction. A failed event write or any database error
rolls that transaction back. The routes wrap the transaction in a
`catch` that drops any error, so the caller still sees a success. For a
delete, that's the worst case: someone revokes a leaked token, the API
says it's gone, and the token keeps working. This is
[EG-4865](https://linear.app/unleash/issue/EG-4865/updating-a-v2-api-tokens-expiry-or-deleting-it-returns-200-when-the).

This PR drops the `catch` from both routes, so the error fails the
request. The project-scoped token delete already fails the request the
same way.

The `catch` says it falls through to legacy storage. The legacy call
only runs for v1 tokens, so for a v2 token nothing falls through.

## Key points
- `PUT` and `DELETE` on `/api/admin/api-tokens/:token` now answer 500
instead of 200 when the transaction that saves a v2 token's change
fails.

## Testing
A new route test updates and deletes a v2 token while the event writes
in both requests fail. Both answer 500, where `main` answers 200. The
test builds the app on fake stores. I fail the write with a fake instead
of a spy on the real event store, since `oss/AGENTS.md` prefers fakes
over mocking.

4076 of 5178 branches covered (78.72%)

5 of 5 new or added lines in 1 file covered. (100.0%)

2 existing lines in 1 file now uncovered.

16504 of 18719 relevant lines covered (88.17%)

790.95 hits per line

Coverage Regressions

Lines Coverage ∆ File
2
80.56
-0.51% src/lib/metrics.ts
Jobs
ID Job ID Ran Files Coverage
1 39934505532.1 23 Oct 2026 09:53AM UTC 1245
88.17
GitHub Action Run
Source Files on build 39934505532
  • Tree
  • List 1245
  • Changed 3
  • Source Changed 1
  • Coverage Changed 3
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #39934505532
  • e5d0973b on github
  • Prev Build on main (#39932136824)
  • Next Build on main (#39945916296)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc