You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Delivered to main through #1446, commit 8bd5925377facea34de26ce268c41f22f0ee3a97. The retained R2 implementation is unchanged in that combined release.
Expired edge entries could fetch GitHub content and rewrite R2 even when another location had already refreshed the shared object. Refreshes now check R2 before fetching content or rebuilding artifacts.
Publishing and invalidation use conditional writes and content revisions so an older refresh cannot overwrite a push invalidation. Whole-ref invalidation covers inherited docs and raw cache paths. Existing freshness windows, outage fallback, and repair of corrupt entries remain covered by regression tests.
Adds sampled operation counts by cache action and repository, plus a read-only script for comparing R2 operations over matching time windows.
Validation: type checks, lint, 661 unit tests, 2,270 chat tests, 20 desktop tests, and the production build passed. The exact Cloudflare preview serves the homepage, Query/Router/Start docs, Markdown, and the admin shell, and rejects unsigned webhooks and unauthenticated chat requests. GitHub's PostgreSQL runtime checks also passed.
The PR adds ETag-based cache revalidation and conditional writes for GitHub content and documentation artifacts. It also measures blob-storage operations across cache and invalidation paths, adds cache race and edge-refresh tests, and provides a script to query Cloudflare R2 operation analytics.
Changes: Blob Cache Reliability
Layer / File(s)
Summary
Cache reads and edge revalidation src/utils/github-content-cache.server.ts, tests/github-cache-edge-refresh.test.ts, tests/github-cache-corruption.test.ts, tests/github-content-cache.test.ts
Cache reads can revalidate against R2, preserve ETags, and return placeholders for malformed stored values. Tests cover edge-cache reuse, stale refreshes, failed reads, and corrupted entries.
Conditional refresh and invalidation src/utils/github-content-cache.server.ts, tests/github-cache-invalidation-operations.test.ts, tests/github-cache-r2-runtime.test.ts, tests/github-cache-refresh-race.test.ts, tests/github-cache-test-utils.ts
Refreshes and invalidations use ETag conditions. Tests cover invalidation scope, concurrent refreshes, and preservation of stale markers during races.
Blob Storage Operation Metrics
Layer / File(s)
Summary
Operation recording and storage wrapper src/server/runtime/blob-storage-metrics.server.ts, src/server/runtime/blob-storage.server.ts, tests/blob-storage-metrics.test.ts
Measurement contexts count named blob-storage operations. Nested measurements share counts, and the test checks that counts are logged when an inner operation fails.
Cache and invalidation measurement src/utils/github-content-cache.server.ts, src/utils/npm-download-cache.server.ts, src/routes/api/github/webhook.ts, src/utils/docs-admin.server.ts
Cache reads, writes, pruning, and invalidation calls run within measurement contexts. Webhook and admin stale-marking calls are also measured.
No issue identified in this review currently blocks merging. The investigated cache-repair and Cloudflare compatibility concerns do not establish a failure.
Pre-merge checks: 4 · 1
Failed checks: 1 warning
Check name
Status
Explanation
Resolution
Docstring Coverage
Docstring coverage is 5.88% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed checks: 4 passed
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title "Reduce duplicate R2 cache refresh writes" matches the main change. The objectives say cache refreshes now check R2 before fetching GitHub content or rebuilding artifacts, and the conditiona…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title "Reduce duplicate R2 cache refresh writes" matches the main change. The objectives say cache refreshes now check R2 before fetching GitHub content or rebuilding artifacts, and the conditional writes and ETag checks in github-content-cache.server.ts and the test utilities prevent stale overwrites. The title is specific and short. The PR also adds metrics and a measurement script, but those are supporting work and need not appear in the title.
Full details: Docstring Coverage
Explanation
Docstring coverage is 5.88% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 17 functions across 15 files.
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
Finishing Touches
📝 Generate docstrings
Commit to this branch
Create a new PR
🧪 Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Delivered to main through #1446, commit
8bd5925377facea34de26ce268c41f22f0ee3a97. The retained R2 implementation is unchanged in that combined release.Expired edge entries could fetch GitHub content and rewrite R2 even when another location had already refreshed the shared object. Refreshes now check R2 before fetching content or rebuilding artifacts.
Publishing and invalidation use conditional writes and content revisions so an older refresh cannot overwrite a push invalidation. Whole-ref invalidation covers inherited docs and raw cache paths. Existing freshness windows, outage fallback, and repair of corrupt entries remain covered by regression tests.
Adds sampled operation counts by cache action and repository, plus a read-only script for comparing R2 operations over matching time windows.
Validation: type checks, lint, 661 unit tests, 2,270 chat tests, 20 desktop tests, and the production build passed. The exact Cloudflare preview serves the homepage, Query/Router/Start docs, Markdown, and the admin shell, and rejects unsigned webhooks and unauthenticated chat requests. GitHub's PostgreSQL runtime checks also passed.