Skip to content

Pass only the page name to the SpecialPage constructor of the Designer - #123

Open
alistair3149 wants to merge 3 commits into
mainfrom
fix/special-page-constructor-args
Open

alistair3149 wants to merge 3 commits into
mainfrom
fix/special-page-constructor-args

Conversation

@alistair3149

@alistair3149 alistair3149 commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

On MediaWiki 1.47, SpecialPage::__construct() throws a BadMethodCallException when it gets more than the page name; 1.46 accepts the extra arguments but reports a deprecation. SpecialKnowledgeGraphDesigner passed an empty restriction and $listed = true, so on 1.47 Special:KnowledgeGraphDesigner and Special:SpecialPages, which constructs every special page, failed with a 500 for every user. The Designer now passes only its name; both arguments were the defaults, so it stays unrestricted and listed.

Human input

Goal and shape: goal set by @alistair3149: "Do an audit to check all of our extension repo to see if StarCitizenTools/mediawiki-extensions-Thumbro#112 applies to us", then "So we only need to patch PageApprovals, WikibaseExport, SemanticCite, SemanticWatchlist, and KnowledgeGraph". The audit and the change are Claude's.

Outcome: not reviewed by a human yet. Left for you: the two-line production diff and whether the 1.47 follow-up below gets its own issue.

Claude's calls

  • Not discussed with @alistair3149: dropping the arguments instead of following Semantic MediaWiki's SpecialAdmin, which passes its restriction to the constructor only below MediaWiki 1.46, since this page has no restriction to keep; the new test loads the page through the special page factory by its registered name, as a request does; testExecuteSetsHeadersAndOutput now expects the title from the knowledgegraphdesigner message rather than from the page's own description, so a constructor that lost the name fails it; the changelog entry sits in its own commit so it can link the fix commit like the existing Unreleased entry, which a squash or rebase merge would orphan.
  • Considered by Claude, omitted: adding MediaWiki 1.47 to the CI matrix, as the suite still has unrelated failures there (see below).
  • Not verified in CI: the regression itself. On the 1.43 and 1.46 legs the new test passes on main too, because 1.46 only reports a deprecation; it fails only on 1.47, which was run locally.

Not in this PR

On 1.47, Special:KnowledgeGraphDesigner still fails once MediaWiki:KnowledgeGraphOptions exists, which the extension creates on the first page view: KnowledgeGraph::getWikipageContent() calls Content::getNativeData(), which 1.47 removed. The parser function's graph-options and property-options go through the same method, so this needs its own fix.

Verification evidence
  • MediaWiki 1.47 (REL1_47, SQLite, SMW 7.2.0, which needs $wgCachePrefix = false there): testDesignerIsListedOnSpecialPages errors on main with the BadMethodCallException from SpecialPageFactory::getPage() (checked with the setUp() construction disabled, so the error came from the test body) and passes with the fix. SpecialKnowledgeGraphDesignerTest (8 existing tests plus the new one): 9 errors on main, OK (9 tests) with the fix while MediaWiki:KnowledgeGraphOptions does not exist.
  • Over HTTP on 1.47: on main, Special:KnowledgeGraphDesigner and Special:SpecialPages return 500 with the BadMethodCallException. With the fix, the Designer returns 200, then 500 on the next load (getNativeData()), and Special:SpecialPages returns 200 and links the Designer.
  • Full suite on 1.47: main 149 tests, 16 errors, 16 failures; fix 150 tests, 8 errors, 16 failures. The difference is exactly the 8 existing SpecialKnowledgeGraphDesignerTest errors; the rest fail on main too (getNativeData() and SMW-backed fixtures).
  • MediaWiki 1.43 (REL1_43, SQLite, SMW 7.2.0): full suite OK (150 tests, 239 assertions); composer analyze, composer phan and composer minus-x pass. Passing $listed = false makes the new test fail.
  • MediaWiki 1.47: with parent::__construct() given no name, testExecuteSetsHeadersAndOutput fails ("Failed asserting that two strings are identical").
  • CI: all four checks pass, before and after the title-assertion commit (run, run). The 1.46 leg no longer prints the SpecialPage constructor deprecation that it printed on main (run).

AI-authored — Claude Code, Opus 5.5, on a Professional Wiki account

alistair3149 and others added 2 commits November 12, 2026 10:53
MediaWiki 1.47 removed the SpecialPage constructor parameters after the
name and throws a BadMethodCallException when any is passed; 1.46 still
accepts them but reports a deprecation. The Designer passed an empty
restriction and $listed = true, both the defaults, so it now passes only
its name. It stays unrestricted and listed on Special:SpecialPages.

On 1.47 the exception broke Special:KnowledgeGraphDesigner and also
Special:SpecialPages, which constructs every registered special page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@alistair3149 alistair3149 added the php Pull requests that update php code label Nov 12, 2026
@codecov

codecov Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.67%. Comparing base (e7df7b6) to head (68d0a7c).

Additional details and impacted files
@@             Coverage Diff              @@
##               main     #123      +/-   ##
============================================
- Coverage     80.68%   80.67%   -0.02%     
  Complexity      186      186              
============================================
  Files            18       18              
  Lines          1807     1806       -1     
  Branches        216      216              
============================================
- Hits           1458     1457       -1     
  Misses          197      197              
  Partials        152      152              

☔ View full report in Codecov by Harness.
📢 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

The title was compared with the page's own description, which comes from
the same page name, so a constructor that lost the name still passed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@alistair3149
alistair3149 marked this pull request as ready for review November 12, 2026 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

php Pull requests that update php code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant