Skip to content

[Web] Cache offline assets only from the Playground origin - #4391

Merged
adamziel merged 1 commit into
trunkfrom
codex/offline-cache-origin-scope
Oct 7, 2026
Merged

adamziel merged 1 commit into
trunkfrom
codex/offline-cache-origin-scope

Conversation

@adamziel

@adamziel adamziel commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator

Cache offline assets only from the Playground's own origin.

Two servers can share a hostname but run on different ports. Matching only the hostname let a live WordPress site's API response enter the Playground asset cache. Compare the full origin, including scheme and port.

This is PR 7 extracted from #4373. Targets trunk directly; no dependency on the other split PRs.

Testing

Review the same-origin, different-port, and different-scheme cases. Rely on CI for the remote package tests.

Summary by CodeRabbit

  • Bug Fixes
    • Offline caching now only includes assets served from the exact same origin, preventing content from other ports or protocols from being cached.

@coderabbitai

coderabbitai Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5f324530-4730-4f0c-862f-ab3f7ba2399e
📥 Commits

Reviewing files that changed from the base of the PR and between 769e72b and 489fbfc.

📒 Files selected for processing (2)
  • packages/playground/remote/src/lib/offline-mode-cache.spec.ts
  • packages/playground/remote/src/lib/offline-mode-cache.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 1 remain after this review.


📝 Walkthrough

Walkthrough

shouldCacheUrl now caches a URL only when its origin matches the current origin. Tests cover URLs with different ports and protocols.

Changes

Offline cache eligibility

Layer / File(s) Summary
Origin check and test coverage
packages/playground/remote/src/lib/offline-mode-cache.ts, packages/playground/remote/src/lib/offline-mode-cache.spec.ts
shouldCacheUrl now checks for an exact origin match. Tests expect a same-origin HTTPS asset to be cacheable and API-query URLs with a different port or protocol not to be cacheable.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 489fb

Offline caching now excludes assets from different ports or schemes, and the tests detect a regression to hostname-only matching. No actionable merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: offline assets are cached only from the Playground origin.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@adamziel
adamziel merged commit b35aaca into trunk Oct 7, 2026
@adamziel
adamziel deleted the codex/offline-cache-origin-scope branch October 7, 2026 10:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant