Skip to content

Conversation

@tangrufus
Copy link
Member

No description provided.

@codecov
Copy link

codecov bot commented Oct 25, 2025

Codecov Report

❌ Patch coverage is 26.15385% with 48 lines in your changes missing coverage. Please review.
✅ Project coverage is 44.65%. Comparing base (ca634ea) to head (d6b48f8).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/MarkClosedPluginAsAbandoned.php 0.00% 21 Missing ⚠️
src/Plugin.php 0.00% 20 Missing ⚠️
src/WpOrg/Api/Client.php 0.00% 7 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main       #8      +/-   ##
============================================
- Coverage     49.50%   44.65%   -4.85%     
- Complexity       61       75      +14     
============================================
  Files             8       10       +2     
  Lines           202      262      +60     
============================================
+ Hits            100      117      +17     
- Misses          102      145      +43     
Flag Coverage Δ
feature 17.17% <0.00%> (-5.11%) ⬇️
unit 27.48% <26.15%> (+0.25%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@tangrufus tangrufus changed the title Implement in-memory cache Implement in-memory cache; Rename Cache -> FileCache Oct 25, 2025
@tangrufus tangrufus marked this pull request as draft October 25, 2025 02:56
@tangrufus tangrufus changed the title Implement in-memory cache; Rename Cache -> FileCache Warm in-memory cache; Rename Cache -> FileCache Oct 25, 2025
@tangrufus tangrufus changed the title Warm in-memory cache; Rename Cache -> FileCache Preload results in in-memory cache; Rename Cache -> FileCache Oct 25, 2025
Comment on lines +26 to +31
$promises = array_map(
fn (string $slug) => $this->isClosedAsync($slug),
$slugs,
);

$this->loop->wait($promises);
Copy link
Member Author

@tangrufus tangrufus Oct 25, 2025

Choose a reason for hiding this comment

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

Help wanted!

  1. How to assert the promises (to be exact, the underlying HTTP requests) are performed concurrently?
  2. Should I assert they are performed concurrently?
  3. How to refactor it for easiler testing?

Copy link
Member Author

@tangrufus tangrufus Oct 25, 2025

Choose a reason for hiding this comment

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

Manually install ~100 wp.org plugins and look at the cache generation, it feels like the promises are performed concurrently.

Still don't have a way to assert it pragmatically

@tangrufus tangrufus marked this pull request as ready for review October 25, 2025 19:43
@tangrufus tangrufus requested a review from Copilot October 25, 2025 20:17
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the caching architecture by introducing a cache interface abstraction and implementing a two-tier caching strategy. The main changes include:

  • Renaming Cache to FileCache to better reflect its file-based implementation
  • Introducing CacheInterface with ArrayCache (in-memory) and CacheProxy (two-tier) implementations
  • Adding a warmCache mechanism to preload plugin status results into the in-memory cache

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/WpOrg/Api/CacheInterface.php Defines the cache interface contract with read/write methods
src/WpOrg/Api/FileCache.php Renames Cache to FileCache and implements CacheInterface
src/WpOrg/Api/ArrayCache.php Implements in-memory cache using an array
src/WpOrg/Api/CacheProxy.php Implements two-tier caching with fast (array) and slow (file) backends
src/WpOrg/Api/Client.php Adds warmCache method to preload multiple plugin statuses
src/MarkClosedPluginAsAbandoned.php Integrates CacheProxy and adds warmCache support for batch operations
src/Plugin.php Registers warmCache event handlers before markClosedAsAbandoned
tests/Unit/WpOrg/Api/FileCacheTest.php Updates test to reflect CacheFileCache rename
tests/Unit/WpOrg/Api/ArrayCacheTest.php Tests for the new ArrayCache implementation
tests/Unit/WpOrg/Api/CacheProxyTest.php Tests for the new CacheProxy two-tier caching logic
tests/Feature/WpOrg/Api/ClientTest.php Updates mocks to use CacheInterface instead of concrete Cache class

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings October 26, 2025 11:29
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings October 26, 2025 14:01
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@tangrufus tangrufus merged commit fbd3ee2 into main Oct 27, 2025
32 checks passed
@tangrufus tangrufus deleted the memory branch October 27, 2025 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

2 participants