Skip to content

9 [4/4]. Name the member every report is made from - #76

Merged
nikolaystrikhar merged 1 commit into
mainfrom
62-one-shape-for-the-report
Aug 25, 2026
Merged

9 [4/4]. Name the member every report is made from#76
nikolaystrikhar merged 1 commit into
mainfrom
62-one-shape-for-the-report

Conversation

@nikolaystrikhar

@nikolaystrikhar nikolaystrikhar commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

What: one shape for _doing_it_wrong()'s first argument across every report site in the library — Class::method, never a bare class name — with the rule stated in AGENTS.md and enforced by WithIncorrectUsage.

Usage: a host reading a debug log now gets

Function Nexcess\PluginAbsorber\Loader::load was called incorrectly:
The bundled plugin file for "give-recurring" is missing or unreadable: …

instead of Function Nexcess\PluginAbsorber\Loader was called incorrectly, which read identically whether the load pass abandoned a sub-plugin or the file gate refused one.

Why this way:

The member is the only thing separating two reports from one class. Absorber reports from two static trampolines and Loader from two methods; a bare class name collapses all four into one attribution, and the message is then the only way to tell them apart.

self::class . '::method', not __METHOD__. __METHOD__ inside a trait method names the trait, so the prefix guard would attribute to Traits\Guards_Hook_Prefix rather than to the class that actually stood down.

The too-late boot still names Absorber::boot. Every other site names where the sentence was written; that one names the call the host got wrong, because moving that call is the fix.

The suite pins the shape, not the name. One assertion that a report contains :: refuses a bare class at any new site while leaving method renames free.

Summary by CodeRabbit

  • Bug Fixes

    • Improved diagnostic messages by identifying the specific class and method responsible for incorrect usage reports.
    • Made developer-facing warnings more precise and easier to trace to their source.
  • Tests

    • Added validation ensuring diagnostic identifiers include both a class and method name.

`_doing_it_wrong()`'s first argument came in two shapes: `Class::method` at the
facade's two trampolines and at the too-late boot, and a bare class name at the
six other sites. WordPress prints it as "Function %s was called incorrectly", so
it is the only part of a report that says where in the library the sentence came
from -- and a bare class cannot separate two reports made by the same class,
which is exactly what `Absorber::render_notices` and
`Absorber::filter_activation_error_markup` are, and what `Loader::load_all` and
`Loader::load` are. `Class::method` everywhere.

Written as `self::class . '::method'` rather than `__METHOD__`, because
`Traits\Guards_Hook_Prefix` is reported through by four classes and `__METHOD__`
inside a trait method names the trait rather than the class using it -- a host
would be sent to the trait instead of to the facade, the load pass or the
conflict pass that actually stood down. The too-late boot keeps naming
`Absorber::boot`: the mistake there is in a call the host made, and that is the
call it has to move.

`AGENTS.md` states the rule under Conventions, so the next report site has one
shape to copy rather than two to choose from, and
`WithIncorrectUsage::assert_the_library_reported_incorrect_usage()` enforces it
across the suite -- the shape, not the member name, so a rename still passes.
@coderabbitai

coderabbitai Bot commented Aug 24, 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: Enterprise

Run ID: 45e09bc0-ad8d-45d7-86db-7e32a71e45ae

📥 Commits

Reviewing files that changed from the base of the PR and between aa7fd99 and 231b9d8.

📒 Files selected for processing (7)
  • AGENTS.md
  • src/Boot/Scheduler.php
  • src/Conflict/Resolver.php
  • src/Loader.php
  • src/Registry/Reader.php
  • src/Traits/Guards_Hook_Prefix.php
  • tests/_support/Traits/WithIncorrectUsage.php

Included review availability: Your plan provides up to 12 included reviews per hour; 5 remain after this review.


📝 Walkthrough

Walkthrough

The change updates _doing_it_wrong() caller identifiers from class names to Class::method names across library components. It adds a convention for this format and strengthens test assertions to require the :: separator.

Changes

Diagnostic identifier consistency

Layer / File(s) Summary
Class::method identifiers and enforcement
AGENTS.md, src/Boot/Scheduler.php, src/Conflict/Resolver.php, src/Loader.php, src/Registry/Reader.php, src/Traits/Guards_Hook_Prefix.php, tests/_support/Traits/WithIncorrectUsage.php
Diagnostics now identify their originating methods. The convention documents self::class . '::method', and test support requires each report identifier to include ::.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Merge Risk: ⚪ Minimal · up to 231b9

The PR standardizes incorrect-usage reports to identify the specific class member that emitted each message; no actionable merge-blocking risk remains beyond normal checks and review.

Suggested reviewers: d4mation

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 6 files. (1 skipped: 1 …
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: identify the member responsible for each report. The progress marker does not prevent understanding.
Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 6 files. (1 skipped: 1 unsupported.)

✨ 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 62-one-shape-for-the-report

Comment @coderabbitai help to get the list of available commands.

@nikolaystrikhar
nikolaystrikhar force-pushed the 47-lifecycle-actions branch 2 times, most recently from 09d2af7 to 752553f Compare August 25, 2026 08:32
@nikolaystrikhar
nikolaystrikhar force-pushed the 62-one-shape-for-the-report branch from c71c933 to fb9503c Compare August 25, 2026 08:34
@nikolaystrikhar
nikolaystrikhar changed the base branch from 47-lifecycle-actions to 39-registry-survives-a-collision August 25, 2026 08:34
@nikolaystrikhar nikolaystrikhar changed the title 14. Name the member every report is made from 12. Name the member every report is made from Aug 25, 2026
@nikolaystrikhar nikolaystrikhar changed the title 12. Name the member every report is made from 10. Name the member every report is made from Aug 25, 2026
@nikolaystrikhar
nikolaystrikhar force-pushed the 39-registry-survives-a-collision branch from 6d543f7 to aa7fd99 Compare August 25, 2026 09:53
@nikolaystrikhar
nikolaystrikhar force-pushed the 62-one-shape-for-the-report branch from fb9503c to 231b9d8 Compare August 25, 2026 10:23
@nikolaystrikhar nikolaystrikhar changed the title 10. Name the member every report is made from 5 [4/4]. Name the member every report is made from Aug 25, 2026
@nikolaystrikhar nikolaystrikhar changed the title 5 [4/4]. Name the member every report is made from 9 [4/4]. Name the member every report is made from Aug 25, 2026
@nikolaystrikhar
nikolaystrikhar force-pushed the 39-registry-survives-a-collision branch from aa7fd99 to 39a2196 Compare August 25, 2026 13:03
@nikolaystrikhar
nikolaystrikhar force-pushed the 62-one-shape-for-the-report branch from 231b9d8 to 1b94db1 Compare August 25, 2026 14:13
Base automatically changed from 39-registry-survives-a-collision to main August 25, 2026 14:15
@nikolaystrikhar
nikolaystrikhar merged commit cf05aa2 into main Aug 25, 2026
6 checks passed
@nikolaystrikhar
nikolaystrikhar deleted the 62-one-shape-for-the-report branch August 25, 2026 14:45
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