Skip to content

Fix failing CI: Phan, PHPUnit and test matrix - #20

Merged
Zippybonzo merged 6 commits into
mainfrom
claude/laughing-mccarthy-lbx7td
Oct 23, 2026
Merged

Zippybonzo merged 6 commits into
mainfrom
claude/laughing-mccarthy-lbx7td

Conversation

@Zippybonzo

@Zippybonzo Zippybonzo commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Fixes everything currently failing CI on main.

Phan / taint-check

  • FandomImportManager: User::newSystemUser() can return null; throw (caught and logged by the existing catch) instead of passing null to ManualLogEntry::setPerformer().
  • SpecialFandomImport: escape each list item before commaList() instead of htmlspecialchars()-ing its output, which taint-check flags as double escaping (commaList() is annotated as escaped output).
  • UpgradeGroups: cast the cache directory to string before rtrim() (WikiOasisFunctions is undeclared in CI so Phan can't infer its return type).
  • FandomImportPrepare: check json_decode() returned an array before indexing it.
  • UpgradeWiki: read child output buffers through a local with a '' default; behaviour unchanged.

PHPUnit

  • ExperimentStateStore: with the database backend disabled (non-Database PHPUnit tests), getReplicaDatabase() throws a plain RuntimeException, not DBError, so the config-only fallback never kicked in and the ApiCheckCanExecute tracker hook broke AbuseFilter's API integration tests on REL1_46. The replica lookup now falls back the same way.

Test matrix

  • CreateWiki, ManageWiki and ImportDump on main now require MediaWiki >= 1.46.0, so REL1_45 can't install. REL1_46 is now the stable job, REL1_47 the alpha one, and extension.json requires >= 1.46.0.

🤖 Generated with Claude Code

https://claude.ai/code/session_01QMd95YdRQKdi4HkzoMBjHj

Summary by CodeRabbit

  • Bug Fixes
    • Improved import and upgrade reliability when background processes or system-user creation fail.
    • Corrected progress messages to safely display extension and namespace names.
    • Improved handling of replica database errors so experiment state remains unavailable rather than causing an unhandled failure.
    • Prompt features now correctly skip printable views.
  • Compatibility
    • The extension now requires MediaWiki 1.46 or later.
  • Tests
    • Updated the tested MediaWiki versions to 1.46 stable and 1.47 alpha.

- FandomImportManager: newSystemUser() can return null, throw (caught
  and logged) instead of passing null to setPerformer()
- SpecialFandomImport: escape list items before commaList() rather than
  escaping its output, which taint-check flags as double escaping
- UpgradeGroups: cast the cache directory to string for rtrim()
- FandomImportPrepare: check json_decode() returned an array before
  indexing it
- UpgradeWiki: read output buffers through a local with a default

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QMd95YdRQKdi4HkzoMBjHj
@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

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: ASSERTIVE
  • Plan: Advanced
  • Run ID: fea2d37b-6c47-40d9-8f5a-72ba8b7dd043
📥 Commits

Reviewing files that changed from the base of the PR and between 2e250cf and 5a76a43.

📒 Files selected for processing: 12
  • .github/workflows/mediawiki-tests.yml
  • bundlesize.config.json
  • extension.json
  • includes/Experiments/ExperimentStateStore.php
  • includes/FandomImport/FandomImportManager.php
  • includes/HookHandlers/EditPrompt.php
  • includes/HookHandlers/WikiPrompt.php
  • includes/Specials/SpecialFandomImport.php
  • maintenance/FandomImportPrepare.php
  • maintenance/UpgradeWiki.php
  • tests/phpunit/unit/HookHandlers/EditPromptTest.php
  • tests/phpunit/unit/HookHandlers/WikiPromptTest.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

The changes update Fandom import validation and progress output, experiment-state replica loading, prompt request checks, upgrade buffering, and MediaWiki compatibility and bundle-size settings.

Changes: Fandom import handling

Layer / File(s) Summary
Import validation and progress output
maintenance/FandomImportPrepare.php, includes/FandomImport/FandomImportManager.php, includes/Specials/SpecialFandomImport.php
Namespace discovery rejects non-array decoded JSON and uses the existing fallback. Logging checks system-user creation before setting the performer. Progress output escapes each name before formatting the list.

Upgrade command handling

Layer / File(s) Summary
Cache directory and child output handling
includes/UpgradeGroups.php, maintenance/UpgradeWiki.php
The cache-directory value is cast to a string before trimming. Child output is appended to a local buffer initialized from the existing buffer entry or an empty string.

Prompt request eligibility

Layer / File(s) Summary
Printable request checks
includes/HookHandlers/EditPrompt.php, includes/HookHandlers/WikiPrompt.php, tests/phpunit/unit/HookHandlers/*PromptTest.php
Both prompt handlers now reject requests when the raw printable parameter is yes. Tests use the request parameter instead of mocking OutputPage::isPrintable().

Experiment state loading

Layer / File(s) Summary
Replica loading error handling
includes/Experiments/ExperimentStateStore.php
getAll() delegates replica loading to a helper. If replica database acquisition throws RuntimeException, the helper logs a warning and returns null.

MediaWiki compatibility and bundle size

Layer / File(s) Summary
MediaWiki versions and bundle-size setting
extension.json, .github/workflows/mediawiki-tests.yml, bundlesize.config.json
The minimum MediaWiki version is now 1.46. The test matrix uses REL1_46 as stable and REL1_47 as alpha. The configuration sets a 2.5 kB maximum for ext.wikioasismagic.consoleMessage.

Priority: ➖ Normal

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

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 5a76a

The compatibility and handling changes have no identified issue that needs correction before merge; proceed with 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 53.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 15 functions across 10 files. (3 skipped:… 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 clearly summarizes the pull request’s main purpose: fixing Phan, PHPUnit, and test-matrix CI failures.
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: Docstring Coverage

Explanation

Docstring coverage is 53.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 15 functions across 10 files. (3 skipped: 3 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

✨ 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
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Some tools did not complete. Review the errors below.

🔧 PHPStan (2.3.0)

PHPStan reported 5 non-file analysis error(s); analysis is incomplete

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.

getReplicaDatabase() throws a plain RuntimeException rather than DBError
when the database backend is disabled, as it is for PHPUnit tests outside
the Database group. The ApiCheckCanExecute experiment tracker hook then
broke AbuseFilter's API integration tests on REL1_46.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QMd95YdRQKdi4HkzoMBjHj

Copy link
Copy Markdown
Member Author

REL1_45 | PHP 8.4 fails at MediaWiki install, not in this PR's code:

ManageWiki is not compatible with the current MediaWiki core (version 1.45.6), it requires: >= 1.46.0.
ImportDump  ... requires: >= 1.46.0.
CreateWiki  ... requires: >= 1.46.0.

The workflow pulls those from miraheze main, which now require 1.46, so no REL1_45 job can install regardless of this diff (on main it never got that far because Phan failed first). Phan, npm-test and composer-test pass on REL1_45 here.

Fixing it means dropping REL1_45 from the matrix (moving composer-test: true to REL1_46) and probably raising extension.json to >= 1.46.0. That's a support-policy call, so it's with the repo owner rather than pushed here.


Generated by Claude Code

CreateWiki, ManageWiki and ImportDump on main now require MediaWiki
>= 1.46.0, so the REL1_45 job could no longer install. REL1_46 becomes
the stable job and REL1_47 the alpha one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QMd95YdRQKdi4HkzoMBjHj
@Zippybonzo Zippybonzo changed the title Fix Phan and taint-check CI failures Fix failing CI: Phan, PHPUnit and test matrix Oct 23, 2026
It's a no-op returning false in 1.47 and the deprecation warning failed
CentralAuth's session provider tests on REL1_47. Check printable=yes on
the request instead, which is what 1.46 sets printable mode from.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QMd95YdRQKdi4HkzoMBjHj
It loads on every page view, so core's PerformanceBudgetTest fails
without a budget. It's about 1.5 kB gzipped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QMd95YdRQKdi4HkzoMBjHj
@Zippybonzo
Zippybonzo merged commit d653b20 into main Oct 23, 2026
7 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