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

Unleash / unleash / 22951360660
86%
master: 91%

Build:
Build:
LAST BUILD BRANCH: main
DEFAULT BRANCH: master
Ran 11 Mar 2026 12:04PM UTC
Jobs 1
Files 1162
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

11 Mar 2026 11:56AM UTC coverage: 86.104% (-0.007%) from 86.111%
22951360660

push

github

web-flow
chore: provide an alternative to conditional middleware (#11523)

## Summary
This change introduces a clearer feature-gating API:
`requireFeatureEnabled(flagResolver, flagName)` for route-level
middleware, and deprecates `conditionalMiddleware` for feature-flag
gating.

## Why
The previous pattern made feature gating less ergonomic and encouraged
custom per-controller middleware functions for a common behavior.
We want a single explicit helper that:

- keeps route registration/discovery stable
- evaluates flags at request time
- is easy to apply directly in `this.route({ middleware: [...] })`

This improves readability and consistency across controllers while
avoiding broad mount-path gating pitfalls.

## What changed
- Added new middleware helper: `requireFeatureEnabled(flagResolver,
flagName)`.
- Deprecated `conditionalMiddleware` for feature-flag route gating
(still available for generic conditional middleware use cases).
- Added function-level guidance in middleware docs/comments.
- Expanded test coverage to focus on the new helper while keeping
compatibility coverage for deprecated `conditionalMiddleware`.

## Migration guidance
### Before (main branch)
`app.use(path, conditionalMiddleware(() =>
config.flagResolver.isEnabled('myFlag'), router));`

### After
`this.route({ method: 'get', path: '/:projectId/actions', handler:
this.getActions, middleware: [requireFeatureEnabled(config.flagResolver,
'myFlag'), openApiService.validPath({...})] });`

## Validation
Tests run and passing:

- `src/test/e2e/api/admin/conditional-middleware.e2e.test.ts`
  - enabled flag allows guarded route
  - disabled flag returns 404 for guarded route
  - disabled guarded subpath does not block sibling/base routes
  - middleware ordering behavior remains predictable
  - deprecated `conditionalMiddleware` compatibility still works
  - guarded routes remain discoverable in OpenAPI when flag is disabled
- `src/lib/middleware/conditional-middleware.test.ts`
  - `conditionalMi... (continued)

1759 of 1986 branches covered (88.57%)

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

3 existing lines in 2 files now uncovered.

14691 of 17062 relevant lines covered (86.1%)

933.95 hits per line

Uncovered Existing Lines

Lines Coverage ∆ File
1
89.58
-2.08% src/lib/features/frontend-api/client-feature-toggle-read-model.ts
2
82.73
-0.91% src/lib/features/playground/feature-evaluator/constraint.ts
Jobs
ID Job ID Ran Files Coverage
1 22951360660.1 11 Mar 2026 12:04PM UTC 1162
86.1
GitHub Action Run
Source Files on build 22951360660
  • Tree
  • List 1162
  • 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 #22951360660
  • 9707355d on github
  • Prev Build on main (#22946492824)
  • Next Build on main (#22951811314)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc