fix(cloudflare): retry catalog load after failure - #255
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (1)
Summary by CodeRabbit
WalkthroughCloudflare initialization now uses 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches✨ Simplify code
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/server/cloudflare.test.ts`:
- Around line 28-63: Reset the module-scoped catalogPromise before each test so
the concurrent app-creation test always initializes its catalog from the
supplied env.ASSETS binding. Add a beforeEach reset in the test setup or use an
existing catalog-cache reset hook, preserving the retry assertions and avoiding
reuse of a resolved cache from earlier tests.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: c159e20a-1c57-4a7e-8c64-ea042e4c6902
📒 Files selected for processing (2)
src/server/cloudflare.test.tssrc/server/cloudflare.ts
6751cda to
a4b5c30
Compare
The app and catalog fixes each open-coded the same slot: memoize a promise, then drop it if it rejects so the isolate self-heals. A third slot in the same file, `cachedSecretCodec`, kept the original memoize-the-rejection shape, so a codec failure still poisons the isolate for its lifetime even though the app around it now retries. Route all three through `IsolatePromiseCache`, which memoizes one promise per key, hands the in-flight promise to concurrent callers, and clears the slot on rejection. Net effect: the third slot is fixed and the invariant lives in one place instead of being restated per caller. Unit-test the cache directly. The worker-level regression test cannot reach the guard that lets only the owning entry clear the slot, since that path needs an older promise to reject after a newer key replaced it; dropping the guard leaves `cloudflare.test.ts` green.
Summary
worker.fetchFixes #246
Validation
npx vitest run src/server/cloudflare.test.ts(5 tests)npm run fix-checknpm test(66 files, 704 tests)npm run lintnpm run formatgit diff --check