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

Unleash / unleash / 32377185107
87%
master: 91%

Build:
Build:
LAST BUILD BRANCH: main
DEFAULT BRANCH: master
Ran 20 Aug 2026 02:01PM UTC
Jobs 1
Files 1210
Run time 2min
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

20 Aug 2026 01:56PM UTC coverage: 87.447% (-0.02%) from 87.465%
32377185107

push

github

web-flow
feat(metrics): add token cache watermark

### Issue

Our plan for the cache validation on API tokens is to introduce initial
metrics that check in production before we build on it.
This PR is [on top
of](https://github.com/bricks-software/unleash-enterprise/pull/1529)
that introduces some of these metrics.

Maybe the most important metric is to validate that every token change
_actually_ writes an event. So, we can drop the fetchActiveTokens() (60'
refresh) and drive invalidation off the events table instead.

We want to introduce this metric on this PR.

### The idea

We add an event watermark for tokens, polled by max(id) of the
api-token- events. We reload only when this moves.

And after the 60'' refresh, we already have, we can check: 
-"did the _token_ set change?"
-and "did the _event watermark_ move?"
If the two disagree, it means something changes tokens without an event,
and if a cache trusting events would give out old tokens.
When only the watermark has moved, we mark it as a
token_revision_advance_total counter.
If only the set has changed, as a missed_changed counter.

Before, we build anything on top, we need to make sure this
"missed_changed" is zero.
If we've many "advanced" counters, we better know it now than laters :p
(might be a mark to redesign and avoid full reloads?)

We already suspect two paths that currently can give us cache misses:

- the `deleteSystemCreatedTokensNotSeen` calls the store directly,
deletes tokens of Edge, but does not emit any storeEvent
- v2's env ... the ON DELETE CASCADE deletes tokens, but nothing in our
code observes it

we might miss others too. But, now we can find them out ;)

### How we do this

- Add new metric event `token_revision_probe`
- added `getMaxTokenRevisionId`() on the event store. Separate from
getMaxRevisionId on purpose, token changes must not advance the
configuration revision or they'd invalidate feature ETags
- scheduleServices adapts to take stores as a third arg so the probe ca... (continued)

3858 of 5021 branches covered (76.84%)

0 of 6 new or added lines in 1 file covered. (0.0%)

3 existing lines in 1 file now uncovered.

15904 of 18187 relevant lines covered (87.45%)

791.87 hits per line

Uncovered Changes

Lines Coverage ∆ File
6
79.0
-2.44% src/lib/features/events/event-store.ts

Coverage Regressions

Lines Coverage ∆ File
3
82.2
-1.69% src/lib/features/playground/feature-evaluator/constraint.ts
Jobs
ID Job ID Ran Files Coverage
1 32377185107.1 20 Aug 2026 02:01PM UTC 1210
87.45
GitHub Action Run
Source Files on build 32377185107
  • Tree
  • List 1210
  • Changed 4
  • Source Changed 1
  • Coverage Changed 4
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #32377185107
  • ac3bd781 on github
  • Prev Build on main (#32375756713)
  • Next Build on main (#32378987277)
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