Skip to content

fix(diagnostics): look on disk before reporting a package not installed - #13

Merged
mambax7 merged 2 commits into
XoopsModules27x:mainfrom
mambax7:fix/whoops-row-checks-disk
Aug 11, 2026
Merged

mambax7 merged 2 commits into
XoopsModules27x:mainfrom
mambax7:fix/whoops-row-checks-disk

Conversation

@mambax7

@mambax7 mambax7 commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

Composer\InstalledVersions answers 'is this autoloaded in this request', not 'is this installed'. The difference is invisible for DebugBar's own dependencies and decisive for filp/whoops, which lives in xwhoops's vendor and is required lazily -- so on any request where xwhoops stood down, this page reported 'Whoops library: Not installed' on a site where it was installed and working, sending the administrator to composer for a problem composer cannot fix. packageRow() now takes an optional dirname => package map and checks the module vendor before saying no. Also records in AccessPolicy that XOOPS 2.7.3 widened the developer gate to any non-zero debug_mode, closing one of the two axes on which isRuntimeAllowed() diverges; the group-membership axis stays open and is not a defect.

Summary by Sourcery

Improve system diagnostics and access policy behavior around lazily loaded debug packages and XOOPS debug modes.

New Features:

  • Detect debug packages that are present in module vendor directories even when not autoloaded in the current request.

Bug Fixes:

  • Prevent the diagnostics page from incorrectly reporting filp/whoops as not installed when it is present but not autoloaded in the current request.

Enhancements:

  • Extend package diagnostics to optionally check module-specific vendor directories before reporting a package as not installed.
  • Clarify AccessPolicy documentation to reflect XOOPS 2.7.3 changes to debug_mode gating and the intentional difference between toolbar and diagnostics access checks.

Summary by CodeRabbit

  • Bug Fixes

    • Improved package diagnostics to recognize installations provided through module-specific vendor locations.
    • Diagnostics now distinguish between packages that are installed and packages that were not loaded during the current request.
    • Updated Whoops package detection for more accurate reporting.
  • Documentation

    • Clarified access behavior for administrator pages, toolbar actions, delegated administrators, history views, request endpoints, and supported debug modes.

Composer\\InstalledVersions answers 'is this autoloaded in this request', not 'is this installed'. The difference is invisible for DebugBar's own dependencies and decisive for filp/whoops, which lives in xwhoops's vendor and is required lazily -- so on any request where xwhoops stood down, this page reported 'Whoops library: Not installed' on a site where it was installed and working, sending the administrator to composer for a problem composer cannot fix. packageRow() now takes an optional dirname => package map and checks the module vendor before saying no. Also records in AccessPolicy that XOOPS 2.7.3 widened the developer gate to any non-zero debug_mode, closing one of the two axes on which isRuntimeAllowed() diverges; the group-membership axis stays open and is not a defect.
Copilot AI lite review requested due to automatic review settings August 11, 2026 04:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@sourcery-ai

sourcery-ai Bot commented Aug 11, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Diagnostics now check module-specific vendor directories on disk before reporting packages as not installed, and access policy documentation is updated to reflect XOOPS 2.7.3’s widened debug_mode gate while clarifying the intended divergence between toolbar and diagnostics access checks.

Sequence diagram for updated diagnostics packageRow fallback to module vendor

sequenceDiagram
    participant SystemDiagnostics
    participant ComposerInstalledVersions
    participant Filesystem

    SystemDiagnostics->>SystemDiagnostics: collect(xoopsConfig)
    SystemDiagnostics->>SystemDiagnostics: packageRow(whoops,[filp/whoops],false,{xwhoops:filp/whoops})

    loop check_packages
        SystemDiagnostics->>SystemDiagnostics: packageInstalled(package)
        SystemDiagnostics->>ComposerInstalledVersions: packageInstalled(package)
        ComposerInstalledVersions-->>SystemDiagnostics: installed/not_installed
    end

    alt any_package_installed
        SystemDiagnostics->>SystemDiagnostics: row(id,Installed,info,detail)
    else no_package_installed
        loop check_moduleVendors
            SystemDiagnostics->>Filesystem: is_dir(rootPath/modules/xwhoops/vendor/filp/whoops)
            Filesystem-->>SystemDiagnostics: exists/does_not_exist
        end

        alt module_vendor_found
            SystemDiagnostics->>SystemDiagnostics: row(whoops,Installed,info,detail_with_not_loaded_note)
        else none_found
            SystemDiagnostics->>SystemDiagnostics: row(whoops,Not installed,info)
        end
    end
Loading

File-Level Changes

Change Details Files
Diagnostics package detection now falls back to checking module vendor directories on disk to avoid false "Not installed" reports for lazily-loaded packages.
  • Extended packageRow() to accept an optional map of module directory names to package names for on-disk checks when Composer\InstalledVersions reports a package as not autoloaded.
  • Implemented filesystem-based detection that inspects modules//vendor/ directories and reports packages found there as Installed but not loaded in the current request, without treating this as an error.
  • Updated the diagnostics collection to pass the xwhoops=>filp/whoops mapping so that Whoops installed under the xwhoops module is correctly recognized even when its autoloader is not active.
class/Analysis/SystemDiagnostics.php
Access policy inline documentation now reflects the current XOOPS behavior and clarifies why diagnostics and toolbar access gates intentionally differ.
  • Reworded isRuntimeAllowed() documentation to describe the previously divergent axes between the strict developer gate and the toolbar gate.
  • Documented that XOOPS 2.7.3 widened the debug_mode requirement to any non-zero value, closing that axis of divergence.
  • Clarified that the group-membership difference between diagnostics and toolbar access remains intentional and should not be collapsed without an explicit decision on delegated module admin capabilities.
class/Admin/AccessPolicy.php

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai

coderabbitai Bot commented Aug 11, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

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

Next review available in: 2 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: 486e5e67-a597-4a12-ad15-002a4eb5029b

📥 Commits

Reviewing files that changed from the base of the PR and between b1b79bc and a8065d9.

📒 Files selected for processing (1)
  • class/Analysis/SystemDiagnostics.php
📝 Walkthrough

Walkthrough

The change clarifies isRuntimeAllowed() behavior and extends Whoops diagnostics with module-vendor fallback detection when Composer does not report a package.

Changes

Access policy documentation

Layer / File(s) Summary
Runtime access policy documentation
class/Admin/AccessPolicy.php
The isRuntimeAllowed() documentation describes raw module-admin access, delegated-admin gates, site-wide history separation, and support for all non-zero debug modes.

Package diagnostics fallback

Layer / File(s) Summary
Whoops package fallback detection
class/Analysis/SystemDiagnostics.php
Whoops diagnostics pass the xwhoops mapping to packageRow(). The method checks mapped module vendor directories after Composer lookup and reports installed-but-not-loaded packages.

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

🚥 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 summarizes the main change: diagnostics now check the filesystem before reporting a package as not installed.
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 unit tests (beta)
  • Create PR with unit tests

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.

@sourcery-ai sourcery-ai 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.

Hey - I've left some high level feedback:

  • The new packageRow signature is getting a bit parameter-heavy; consider introducing a small value object or dedicated options array to clarify the meaning and ordering of bool $active vs $moduleVendors.
  • The logic for checking module-specific vendor directories in packageRow duplicates path construction; extracting a small helper for building modules/<dirname>/vendor/<package> paths would improve readability and reduce future maintenance overhead.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new `packageRow` signature is getting a bit parameter-heavy; consider introducing a small value object or dedicated options array to clarify the meaning and ordering of `bool $active` vs `$moduleVendors`.
- The logic for checking module-specific vendor directories in `packageRow` duplicates path construction; extracting a small helper for building `modules/<dirname>/vendor/<package>` paths would improve readability and reduce future maintenance overhead.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@greptile-apps

greptile-apps Bot commented Aug 11, 2026 •

Copy link
Copy Markdown

Greptile Summary

The PR improves diagnostics for lazily loaded Whoops installations and documents the updated XOOPS debug-mode access behavior.

  • Falls back to the xwhoops vendor tree when Composer metadata does not include filp/whoops.
  • Documents why runtime and site-wide diagnostics use different administrator gates.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
class/Analysis/SystemDiagnostics.php Adds an on-disk fallback for detecting filp/whoops when its Composer autoloader is not registered.
class/Admin/AccessPolicy.php Updates documentation describing debug-mode and administrator-gate behavior.

Reviews (2): Last reviewed commit: "Fixes" | Re-trigger Greptile

Comment thread class/Analysis/SystemDiagnostics.php Resolved

@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 `@class/Analysis/SystemDiagnostics.php`:
- Around line 116-120: Update the documentation around $moduleVendors to
describe the fallback as detecting packages present on disk but absent from
current Composer metadata, based on is_dir($path); remove wording that
characterizes Composer\InstalledVersions or the fallback in terms of whether
classes were autoloaded in the request.
🪄 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: 4f1ad562-055b-4c42-a90c-b99db278d4d2

📥 Commits

Reviewing files that changed from the base of the PR and between 04f4d29 and b1b79bc.

📒 Files selected for processing (2)
  • class/Admin/AccessPolicy.php
  • class/Analysis/SystemDiagnostics.php

Comment thread class/Analysis/SystemDiagnostics.php Resolved
@mambax7

mambax7 commented Aug 11, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 11, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@mambax7
mambax7 merged commit 9511945 into XoopsModules27x:main Aug 11, 2026
10 checks passed
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.

2 participants