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

Alan-Jowett / CoPilot-For-Consensus / 20728592266 / 26
78%
main: 78%

Build:
DEFAULT BRANCH: main
Ran 05 Jan 2026 08:48PM UTC
Files 12
Run time 1s
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

05 Jan 2026 08:43PM UTC coverage: 34.81%. Remained the same
20728592266.26

push

github

web-flow
Defer JWKS fetch to background thread to prevent service startup blocking (#746)

* Initial plan

* Make JWKS fetch non-blocking during middleware initialization

- Add defer_jwks_fetch parameter (default: True) to avoid blocking service startup
- Start background thread to fetch JWKS asynchronously during init
- Add thread-safe lock for JWKS cache updates
- Implement emergency on-demand JWKS fetch if request arrives before background fetch completes
- Wait up to 5 seconds for background thread if JWKS not yet loaded during first request
- Maintains backward compatibility with defer_jwks_fetch=False for synchronous behavior

Co-authored-by: Alan-Jowett <20480683+Alan-Jowett@users.noreply.github.com>

* Add tests for deferred JWKS fetch and update existing tests

- Add test_middleware_deferred.py with comprehensive tests for deferred loading
- Test non-blocking initialization behavior
- Test emergency on-demand fetch when request arrives before background completes
- Test backward compatibility with defer_jwks_fetch=False
- Test thread-safe cache updates
- Update all existing tests to use defer_jwks_fetch=False for deterministic behavior
- All tests pass successfully

Co-authored-by: Alan-Jowett <20480683+Alan-Jowett@users.noreply.github.com>

* Fix factory function to pass through defer_jwks_fetch parameter

- Add defer_jwks_fetch parameter to create_jwt_middleware factory function
- Default to True for deferred loading but allow override
- Pass parameter through to JWTMiddleware constructor
- Update docstring to document new parameter
- Addresses code review feedback

Co-authored-by: Alan-Jowett <20480683+Alan-Jowett@users.noreply.github.com>

* Fix race condition and test issues from code review

- Add thread-safe locking to _fetch_jwks_with_retry for cache updates
- Remove unused imports (jwt, TestClient) from test_middleware_deferred.py
- Fix unused variable warning in test_deferred_jwks_fetch_emergency_on_demand
- Remove incorrect middleware usag... (continued)

275 of 790 relevant lines covered (34.81%)

0.35 hits per line

Source Files on job copilot_events_integration - 20728592266.26
  • Tree
  • List 12
  • Changed 0
  • Source Changed 0
  • Coverage Changed 0
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 20728592266
  • 1b678dad on github
  • Prev Job for on main (#20728319907.7)
  • Next Job for on main (#20735671210.24)
  • Delete
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