Skip to content

Rebuild the package manifest when retrying provider loading - #265

Merged
LukeTowers merged 2 commits into
developfrom
fix/package-manifest-retry
Oct 23, 2026
Merged

LukeTowers merged 2 commits into
developfrom
fix/package-manifest-retry

Conversation

@LukeTowers

@LukeTowers LukeTowers commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

clearPackageCache() reset PackageManifest::$manifest to [], but Laravel's getManifest() short-circuits on ! is_null(), so the retry in registerConfiguredProviders() never rebuilt the manifest. With app.loadDiscoveredPackages enabled it boots with no discovered providers and swallows the original exception instead of reporting it. Resetting to null, the unbuilt state, fixes both.

phpstan flags the assignment because Laravel annotates the untyped $manifest as @var array; corrected in tests/stubs/PackageManifest.stub rather than suppressed.

Tests: tests/Foundation/PackageCacheTest.php, three tests, all failing without the fix. Two of them need #255 to run on wip/1.3.

Broken since 6eef811 (octobercms/library#492). app.loadDiscoveredPackages defaults to false, so only opt-in installs are affected.

`clearPackageCache()` reset `PackageManifest::$manifest` to an empty array, but `getManifest()` short-circuits on `! is_null()`, so the retry ran against an empty manifest instead of rebuilding it from the installed packages. With `app.loadDiscoveredPackages` enabled that dropped every discovered provider, and swallowed the original exception along with it, so a genuinely broken provider looked like a clean boot.
@coderabbitai

coderabbitai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Warning

Review limit reached

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

Next included review available in 54 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 6d19ae71-a40e-4941-a49e-eab2957c1b11
📥 Commits

Reviewing files that changed from the base of the PR and between 8779917 and 7b76152.

📒 Files selected for processing: 3
  • phpstan.neon
  • src/Foundation/Application.php
  • tests/stubs/PackageManifest.stub

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: bff2b437-58a3-42e8-bdb3-8af9704b5f0a
📥 Commits

Reviewing files that changed from the base of the PR and between d6e5607 and 8779917.

📒 Files selected for processing: 2
  • src/Foundation/Application.php
  • tests/Foundation/PackageCacheTest.php

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

Walkthrough

clearPackageCache() now sets the package manifest to null after deleting cached files. New tests check manifest rebuilding, provider registration after a loading retry, and error propagation when a provider remains unavailable.

Estimated code review effort

Priority: ➖ Normal

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

Merge Risk: ⚪ Minimal · up to 87799

The change appears to restore provider discovery after cache clearing. No actionable issue remains before normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 55.56% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed 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 states the main change: the package manifest is rebuilt during a provider-loading retry. The raw summary says clearPackageCache() now sets the manifest to null instead of an empty array, and…
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.
Full details: Title check

Explanation

The title states the main change: the package manifest is rebuilt during a provider-loading retry. The raw summary says clearPackageCache() now sets the manifest to null instead of an empty array, and the new tests cover the rebuild-on-retry behavior. The objectives describe the same fix, where an empty manifest was treated as already loaded, so the retry did not rebuild it. The title is specific and accurate, and it is concise.

✨ 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

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.

…essing

Laravel annotates `$manifest` as `array`, but the property is untyped, defaults to null, and `getManifest()` treats null as "not built yet".
@LukeTowers
LukeTowers merged commit 08ddc6a into develop Oct 23, 2026
13 checks passed
@LukeTowers
LukeTowers deleted the fix/package-manifest-retry branch October 23, 2026 05:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant