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

ThePalaceProject / web-patron / 26306709530
88%

Build:
DEFAULT BRANCH: main
Ran 22 May 2026 07:06PM UTC
Jobs 1
Files 14
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

22 May 2026 07:04PM UTC coverage: 87.976% (-0.3%) from 88.281%
26306709530

push

github

web-flow
Reduce excessive registry and auth doc fetches (PP-4342) (#140)

## Description

Two related fixes for redundant network fetches during page generation:

- **Registry cache shared across bundle contexts.** Next.js bundles each
page and API route independently, so module-level Maps in
`libraryRegistry.ts` were not shared — the instrumentation pre-warm
populated one bundle's cache while ISR handlers each held their own
empty copy. The fix stores registry state on `global.__cpwRegistryState`
so all bundle contexts in the same process share a single cache. The
instrumentation hook now also calls `getLibraries()` to pre-warm the
registry before any requests are served.

- **Authentication document cache added.** Each ISR route rebuild for
the same library (index, loans, book detail, etc.) was fetching the
library's authentication document independently. A new server-side cache
(also on `global`) stores fetched auth documents with default and
configurable TTL (like registry). Concurrent requests for the same URL
are coalesced into one in-flight fetch; sequential requests are gated by
`refreshMinInterval` (minimum gap between attempts) and
`refreshMaxInterval` (staleness threshold), mirroring the semantics
already used for registry refresh intervals.

A new `authentication_documents` config section exposes both interval
settings. README and `community-config.yml` are updated accordingly.

## Motivation and Context

During ISR page generation, multiple routes are rendered in rapid
succession. Without shared caching, each route issued independent
fetches to both the library registry and the library's auth document
endpoint. This produced redundant network traffic and, in the registry
case, could cause spurious (I can use big words, too) 404s on the very
first page load when a second simultaneous request saw an empty cache
before the first request had finished populating it.

[Jira PP-4342]

## How Has This Been Tested?

- Manual testing and log observation in ... (continued)

223 of 258 branches covered (86.43%)

Branch coverage included in aggregate %.

11 of 12 new or added lines in 4 files covered. (91.67%)

355 of 399 relevant lines covered (88.97%)

31.75 hits per line

Uncovered Changes

Lines Coverage ∆ File
1
96.71
-1.32% src/server/appConfig.ts
Jobs
ID Job ID Ran Files Coverage
1 26306709530.1 22 May 2026 07:06PM UTC 14
87.98
GitHub Action Run
Source Files on build 26306709530
  • Tree
  • List 14
  • Changed 6
  • Source Changed 0
  • Coverage Changed 6
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • f5ab3206 on github
  • Prev Build on main (#26247524636)
  • Next Build on main (#26458582144)
  • 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