Skip to content

perf: cache product version archive inspection - #37

Open
superdav42 wants to merge 2 commits into
mainfrom
perf/cache-product-version-inspection
Open

perf: cache product version archive inspection#37
superdav42 wants to merge 2 commits into
mainfrom
perf/cache-product-version-inspection

Conversation

@superdav42

@superdav42 superdav42 commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • cache product version lists and remote archive metadata in the dedicated WordPress object-cache group
  • cache failed archive inspections for one hour so unavailable or malformed archives are not downloaded on every page request
  • retain transient-based cross-request caching when no persistent object-cache backend is active
  • preserve product cache invalidation and privacy-safe hashed remote cache keys

Verification

  • composer test
  • ../../../../vendor/bin/phpcs inc/class-product-versions.php tests/product-versions-remote-download-regression.php
  • git diff --check origin/main...HEAD

aidevops.sh v3.32.250 plugin for OpenCode v1.18.9 with gpt-5.6-sol spent 5m and 200,459 tokens on this with the user in an interactive session.

Summary by CodeRabbit

  • Bug Fixes

    • Improved product version checks by reducing repeated remote lookups and improving response times.
    • Product download metadata is now cached more reliably, including unavailable or failed checks.
    • Cache invalidation is handled more consistently when product information changes.
    • Added fallback behavior to preserve reliable version checking when enhanced caching is unavailable.
  • Tests

    • Expanded coverage for product downloads, cache behavior, failure handling, and cache invalidation.

@superdav42 superdav42 added the origin:interactive Created by interactive user session label Aug 10, 2026
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@superdav42, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 23 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: ed8ba6b9-be97-49c6-bed9-45f215c0bbf0

📥 Commits

Reviewing files that changed from the base of the PR and between 5d3ad38 and 2ce7838.

📒 Files selected for processing (2)
  • inc/class-product-versions.php
  • tests/product-versions-remote-download-regression.php
📝 Walkthrough

Walkthrough

Product version caching now uses shared WordPress object caching with transient fallback. Remote archive metadata supports positive and negative cache entries with separate expiration periods. Regression tests cover cache hits, failures, invalidation, and fallback behavior.

Changes

Product Version Caching

Layer / File(s) Summary
Shared cache abstraction
inc/class-product-versions.php
Product version cache reads, writes, and deletion use the wu_product_versions object-cache group with transient fallback. Cached empty arrays remain distinguishable from cache misses.
Remote metadata caching
inc/class-product-versions.php
Remote archive inspection caches successful metadata and failures. Invalid or unreadable files receive one-hour negative cache entries.
Cache regression coverage
tests/product-versions-remote-download-regression.php
Regression fixtures and assertions cover grouped object caching, transient fallback, negative caching, product-version invalidation, and remote download failures.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Product_Versions
  participant SharedCache
  participant RemoteArchive
  Product_Versions->>SharedCache: Read remote metadata
  alt Cache hit
    SharedCache-->>Product_Versions: Return positive or negative result
  else Cache miss
    Product_Versions->>RemoteArchive: Inspect archive
    RemoteArchive-->>Product_Versions: Return metadata or failure
    Product_Versions->>SharedCache: Store result with expiration
  end
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: caching product version archive inspection.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch perf/cache-product-version-inspection

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.

@superdav42
superdav42 marked this pull request as ready for review August 10, 2026 21:00

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 `@inc/class-product-versions.php`:
- Line 791: Update clear_cache() around self::delete_cached_value('versions_' .
$product_id) to also invalidate the current product’s remote_version_* download
metadata keys, ensuring archive replacements with unchanged identifiers do not
reuse stale remote metadata. Use the existing product download metadata key
scheme and preserve the current versions cache invalidation.
🪄 Autofix

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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: bea13144-0e21-419d-8c9e-af16548b5cde

📥 Commits

Reviewing files that changed from the base of the PR and between 515ca0f and 5d3ad38.

📒 Files selected for processing (2)
  • inc/class-product-versions.php
  • tests/product-versions-remote-download-regression.php

Comment thread inc/class-product-versions.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

origin:interactive Created by interactive user session

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant