Skip to content

Report the error screen's owner, not whether Tracy is installed - #12

Merged
mambax7 merged 3 commits into
XoopsModules27x:mainfrom
mambax7:main
Aug 10, 2026
Merged

mambax7 merged 3 commits into
XoopsModules27x:mainfrom
mambax7:main

Conversation

@mambax7

@mambax7 mambax7 commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

The Diagnostics page answered "is Tracy installed?" and presented it as the error screen row. That was never quite the question, and on XOOPS 2.7.3 it is the wrong one: the site declares an owner, core publishes who actually holds the handlers, and the two can differ — which is the case most worth showing.

The row now reads XOOPS_ERROR_SCREEN_OWNER, _SOURCE and _STATUS and reports what core says, including the statuses that mean something is wrong: dormant, missing, disabled, contested, error.

On a core without the seam the constants are absent and the row falls back to its previous behaviour.

Requires the seam from XOOPS 2.7.3 (XOOPS/XoopsCore27 feat/error-screen-provider) to show anything new.

Summary by Sourcery

Update the diagnostics module to report the actual PHP error screen owner and status, aligned with the XOOPS 2.7.3 error-screen seam, and bump the module version for the release.

New Features:

  • Add a dedicated Diagnostics row for the error screen owner that reports XOOPS_ERROR_SCREEN_* metadata when available.

Enhancements:

  • Separate the Tracy package presence check from error-screen ownership reporting so each is shown independently.
  • Introduce user-facing labeling for the new error screen diagnostics row in the admin UI.

Documentation:

  • Document the new error screen ownership reporting and related behaviours in the changelog for version 1.4.1.

Chores:

  • Increment the module version to 1.4.1 with an updated release date in xoops_version.php.

Summary by CodeRabbit

  • New Features

    • System diagnostics now identify the PHP error-screen owner, source, message, and status.
    • Added a separate Tracy package availability check.
    • Tracy toolbar settings preserve existing runtime diagnostic data when updated.
  • Bug Fixes

    • Improved compatibility with legacy cores and unknown error-screen states.
    • Improved error-handler ownership detection across supported providers.
  • Documentation

    • Added release notes for version 1.4.1.
  • Chores

    • Updated the module version to 1.4.1.

The Diagnostics page answered "is Tracy installed?" and presented it as the error
screen row. That was never quite the question, and on XOOPS 2.7.3 it is the wrong
one: the site declares an owner, core publishes who actually holds the handlers,
and the two can differ — which is the case most worth showing.

The row now reads `XOOPS_ERROR_SCREEN_OWNER`, `_SOURCE` and `_STATUS` and reports
what core says, including the statuses that mean something is wrong: `dormant`,
`missing`, `disabled`, `contested`, `error`.

On a core without the seam the constants are absent and the row falls back to its
previous behaviour.

Requires the seam from XOOPS 2.7.3 (XOOPS/XoopsCore27 `feat/error-screen-provider`)
to show anything new.
Copilot AI lite review requested due to automatic review settings August 10, 2026 10:13
@sourcery-ai

sourcery-ai Bot commented Aug 10, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Diagnostics now reports the actual error-screen owner and status via XOOPS 2.7.3 core seam constants, adds a dedicated row label for it, keeps Tracy as a plain package check, and bumps module version/changelog for the release.

File-Level Changes

Change Details Files
Diagnostics uses core error-screen seam to show handler ownership instead of Tracy-specific status and keeps a separate Tracy package check.
  • Replaced tracyBootstrapRow() with errorScreenRow() that reads XOOPS_ERROR_SCREEN_* constants when available.
  • Changed diagnostics collect() to add a generic Tracy packageRow and a new errorScreenRow entry.
  • Implemented status-to-display mapping for core, active, dormant, disabled, suppressed, unclaimed, contested, error, missing, incompatible, and arbitrary provider-defined statuses.
  • Added fallback behaviour for cores without XOOPS_ERROR_SCREEN_* constants, showing an informational row about predating the seam.
class/Analysis/SystemDiagnostics.php
Admin UI labels now include a dedicated label for the error screen owner diagnostics row.
  • Added 'error_screen' key to the diagnostics row label map.
  • Defined _AM_DEBUGBAR_DIAG_ERROR_SCREEN language string as 'Error screen owner'.
admin/diagnostics.php
language/english/admin.php
Module metadata and changelog updated for 1.4.1 release documenting the new error-screen diagnostics and related fixes.
  • Bumped module version to 1.4.1 and release_date to 2026/08/07.
  • Added 1.4.1 entry to CHANGELOG.md describing the new error screen diagnostics behaviour and Tracy toolbar toggle fix.
  • Updated docs/changelog.txt to reflect the new release (content not shown in diff).
xoops_version.php
CHANGELOG.md
docs/changelog.txt

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

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 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 hardcoded status labels in errorScreenRow() (e.g. 'Dormant', 'Disabled', 'Failed to start') make the diagnostics UI non-localizable; consider moving these user-facing strings into language constants similar to _AM_DEBUGBAR_DIAG_ERROR_SCREEN.
  • In errorScreenRow() you special-case only when $source !== '' && $owner !== 'core'; if $source is empty but $owner is non-core you lose potentially useful context, so you may want to always append the owner when it differs from 'core', and conditionally add the source only when available.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The hardcoded status labels in `errorScreenRow()` (e.g. 'Dormant', 'Disabled', 'Failed to start') make the diagnostics UI non-localizable; consider moving these user-facing strings into language constants similar to `_AM_DEBUGBAR_DIAG_ERROR_SCREEN`.
- In `errorScreenRow()` you special-case only when `$source !== '' && $owner !== 'core'`; if `$source` is empty but `$owner` is non-core you lose potentially useful context, so you may want to always append the owner when it differs from 'core', and conditionally add the source only when available.

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 10, 2026 •

Copy link
Copy Markdown

Greptile Summary

The PR updates Diagnostics to report the active error-screen owner while retaining compatibility with legacy Tracy status reporting.

  • Adds error-screen owner, source, status, and message diagnostics.
  • Keeps Tracy package availability as a separate diagnostic row.
  • Preserves unrelated runtime override data when toggling Tracy.
  • Updates the module version and release documentation.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains; the previously reported loss of legacy Tracy bootstrap status is fixed by mapping XOOPS_TRACY_STATUS whenever the newer error-screen seam is absent.

Important Files Changed

Filename Overview
class/Analysis/SystemDiagnostics.php Adds provider-neutral error-screen diagnostics and correctly restores the legacy XOOPS_TRACY_STATUS fallback raised in the previous review.
admin/diagnostics.php Adds the localized label for the new error-screen diagnostics row.
admin/index.php Changes Tracy runtime updates from wholesale replacement to merge-preserving writes with a locked legacy fallback.
language/english/admin.php Defines the user-facing label for the error-screen diagnostics row.
xoops_version.php Bumps the module release metadata to version 1.4.1.
CHANGELOG.md Documents the provider-neutral diagnostics behavior, legacy compatibility, and runtime override preservation.
docs/changelog.txt Mirrors the 1.4.1 release notes in the packaged changelog.

Reviews (3): Last reviewed commit: "fix(admin): fail closed when debug-runti..." | Re-trigger Greptile

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

coderabbitai Bot commented Aug 10, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 945eee4b-7b15-4907-bc20-b2dc07f43f20

📥 Commits

Reviewing files that changed from the base of the PR and between 888986b and f3b1bfb.

📒 Files selected for processing (1)
  • admin/index.php
🚧 Files skipped from review as they are similar to previous changes (1)
  • admin/index.php

📝 Walkthrough

Walkthrough

Diagnostics now report XOOPS error-screen ownership, status, source, and message. Tracy has a separate package check. Tracy runtime toggles preserve existing debug-runtime data. Release metadata identifies version 1.4.1.

Changes

Diagnostics and Runtime Updates

Layer / File(s) Summary
Provider-independent error-screen diagnostics
class/Analysis/SystemDiagnostics.php, admin/diagnostics.php, language/english/admin.php
Diagnostics read XOOPS error-screen metadata, support legacy Tracy fallback, normalize handler ownership, and display the new error-screen label.
Merged Tracy runtime-state updates
admin/index.php, CHANGELOG.md
Tracy toggles preserve existing runtime keys through the core writer or a locked atomic fallback.
Release metadata and notes
CHANGELOG.md, docs/changelog.txt, xoops_version.php
The module is marked as version 1.4.1. Changelogs document the diagnostic and runtime-state changes.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Admin
  participant CoreRuntimeWriter
  participant DebugRuntimeFile
  Admin->>CoreRuntimeWriter: update tracy_enabled
  CoreRuntimeWriter->>DebugRuntimeFile: merge and write runtime data
  DebugRuntimeFile-->>Admin: preserve existing runtime keys
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 summarizes the primary change: diagnostics now reports the error screen owner instead of Tracy installation status.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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.

@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: 3

🤖 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 `@CHANGELOG.md`:
- Line 15: Update admin/index.php around the Tracy toggle logic to preserve
existing debug-runtime keys: use xoops_writeDebugRuntimeOverride() when
available, otherwise merge the existing JSON before writing through a temporary
file and atomic rename. Verify the toggle retains metadata such as error-screen
ownership, then keep the documented claims unchanged in CHANGELOG.md:15-15 and
docs/changelog.txt:8-8.

In `@class/Analysis/SystemDiagnostics.php`:
- Around line 336-342: In class/Analysis/SystemDiagnostics.php lines 336-342,
update errorScreenRow() to evaluate and return the legacy Tracy status before
producing the unsupported-state row when XOOPS_ERROR_SCREEN_STATUS is absent.
Update CHANGELOG.md line 11 and docs/changelog.txt line 5 to describe the
restored legacy Tracy fallback.

In `@xoops_version.php`:
- Around line 25-26: Standardize the version 1.4.1 release date across the
release records, including the $modversion['release_date'] assignment in
xoops_version.php and both changelogs. Choose the intended date, August 8, 2026
based on the changelogs, and update every 1.4.1 entry to match.
🪄 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: 33f1467e-c3d3-40df-81ad-532f8cb48aa7

📥 Commits

Reviewing files that changed from the base of the PR and between 675b562 and 8868ccd.

📒 Files selected for processing (6)
  • CHANGELOG.md
  • admin/diagnostics.php
  • class/Analysis/SystemDiagnostics.php
  • docs/changelog.txt
  • language/english/admin.php
  • xoops_version.php

Comment thread CHANGELOG.md Resolved
Comment on lines +336 to +342
if (! defined('XOOPS_ERROR_SCREEN_STATUS')) {
return $this->row(
'error_screen',
'Unknown',
'info',
'This XOOPS predates the error-screen seam, so nothing publishes who owns the handlers.'
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Restore the pre-seam diagnostic fallback.

When XOOPS_ERROR_SCREEN_STATUS is absent, errorScreenRow() returns Unknown. This removes the prior Tracy-specific diagnostic instead of preserving the fallback required by this PR. Restore the legacy status path on supported older cores. Update the release notes to describe the actual fallback.

  • class/Analysis/SystemDiagnostics.php#L336-L342: evaluate the legacy Tracy status before returning an unsupported-state row.
  • CHANGELOG.md#L11-L11: describe the restored legacy fallback.
  • docs/changelog.txt#L5-L5: describe the restored legacy fallback.
📍 Affects 3 files
  • class/Analysis/SystemDiagnostics.php#L336-L342 (this comment)
  • CHANGELOG.md#L11-L11
  • docs/changelog.txt#L5-L5
🤖 Prompt for 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.

In `@class/Analysis/SystemDiagnostics.php` around lines 336 - 342, In
class/Analysis/SystemDiagnostics.php lines 336-342, update errorScreenRow() to
evaluate and return the legacy Tracy status before producing the
unsupported-state row when XOOPS_ERROR_SCREEN_STATUS is absent. Update
CHANGELOG.md line 11 and docs/changelog.txt line 5 to describe the restored
legacy Tracy fallback.

Comment thread xoops_version.php Resolved
@mambax7

mambax7 commented Aug 10, 2026

Copy link
Copy Markdown
Contributor Author

Reads the constants published by XOOPS/XoopsCore27#157. Safe to merge first: on a core
without the seam the constants are absent and the Diagnostics row falls back to its previous
behaviour. It simply shows nothing new until #157 lands.

…mpare like with like

The 1.4.1 changelog credited the Tracy toggle with merging debug-runtime.json,
but the code still wrote it wholesale -- so one press dropped the recorded
error-screen owner core keeps in that file and the site fell back to core error
handling. The toggle now writes through xoops_writeDebugRuntimeOverride() when
core provides it, and on an older core does a locked read-modify-write through a
temporary file and rename, so neither path loses another key.

The error-handler drift row compared a detected library name (whoops, tracy)
against a declared module dirname (xwhoops, xtracy) and so warned of drift on
every healthy install. Both sides are normalised to the canonical dirname,
legacy spellings accepted, and xWhoops-owner-with-core-holding-the-error-handler
is recognised as the designed outcome rather than drift.

The pre-seam Diagnostics fallback maps a legacy XOOPS_TRACY_STATUS when present
instead of a blank "Unknown". Release date aligned with the changelogs.

@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 `@admin/index.php`:
- Around line 175-181: Update the runtime data loading logic around $existing,
$decoded, and $current to reject malformed JSON and valid JSON values that are
not arrays before writing. Fail the debug toggle without replacing the file when
json_decode fails or returns a non-array, preserving existing runtime state and
error-screen ownership metadata.
🪄 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: c723fe0b-c559-4c8e-8294-0445205e5b89

📥 Commits

Reviewing files that changed from the base of the PR and between 8868ccd and 888986b.

📒 Files selected for processing (4)
  • CHANGELOG.md
  • admin/index.php
  • class/Analysis/SystemDiagnostics.php
  • xoops_version.php
🚧 Files skipped from review as they are similar to previous changes (2)
  • xoops_version.php
  • class/Analysis/SystemDiagnostics.php

Comment thread admin/index.php Resolved
@greptile-apps

greptile-apps Bot commented Aug 10, 2026

Copy link
Copy Markdown

Want your agent to iterate on Greptile's feedback? Try greploops.

The older-core fallback that toggles tracy_enabled read the shared
debug-runtime.json, and on malformed or non-array JSON it silently reset
its working copy to [] and then overwrote the file -- dropping whatever
the file held, including the core's error_screen_owner record kept in the
same file since 2.7.3. The preferred path (xoops_writeDebugRuntimeOverride)
already merges safely; make the hand-rolled fallback match by failing the
toggle and leaving the file untouched when its contents will not decode to
an array, so a corrupt file is preserved for inspection rather than
replaced blind.
@mambax7
mambax7 merged commit 04f4d29 into XoopsModules27x:main Aug 10, 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