Skip to content

Stop guarding every entry point against missing tables - #21

Merged
JeroenDeDauw merged 1 commit into
masterfrom
remove-missing-schema-guards
Aug 25, 2026
Merged

Stop guarding every entry point against missing tables#21
JeroenDeDauw merged 1 commit into
masterfrom
remove-missing-schema-guards

Conversation

@JeroenDeDauw

Copy link
Copy Markdown
Member

Follows-up to #14, which had every entry point ask
whether the tables were there and go inert when they were not.

The premise was a wiki that loads the extension before update.php has run on it. Where the extension is
deployed, enabling it for a wiki runs its database updates first, in the same request, and the config that
loads the extension is not stored when those fail — so it is never live without its tables. What remains
are broken wikis: this repository's own schema procedure between the drop and the re-run, a partial
restore, a hand-edited LocalSettings.php.

On those a database error is the better answer. It names what is wrong and where, while an extension that
goes quiet leaves the wiki admitting people under rules it has stopped applying, with nothing to say so.

The reader-group stand-in goes with it: a second rule for who is refused a password and a single sign-on
login, worked out for a state that does not arise, running where nobody is watching, and answerable only
against a stub.

One guard stays. MemberLoginHandler runs for every login the wiki has, so a failure there locks out the
administrator who would fix it. Schema and DatabaseSchema stay for it, and MissingSchemaTest
collapses into the one case MemberLoginHandlerTest now carries.

A wiki with its tables behaves exactly as before.

AI-authored — Claude Code, Opus 5 (1M context, max); asked for by @JeroenDeDauw after an in-session review of the same pattern elsewhere, no redirections; what to keep is my proposal, agreed before the work; diff not yet human-reviewed; phpcs, phpstan and the full PHPUnit suite run locally, and the guard that stays was mutation-checked against the test that now covers it.

Production notes

Three CodeScreenTest cases fail in the local dev stack. They fail the same way on unmodified master
there and CI is green on master, so they are the environment rather than this branch.

Follows-up to #14, which had every entry point ask
whether the tables were there and go inert when they were not.

The premise was a wiki that loads the extension before `update.php` has run on it. Where the extension is
deployed, enabling it for a wiki runs its database updates first, in the same request, and the config that
loads the extension is not stored when those fail — so it is never live without its tables. What remains
are broken wikis: this repository's own schema procedure between the drop and the re-run, a partial
restore, a hand-edited `LocalSettings.php`.

On those a database error is the better answer. It names what is wrong and where, while an extension that
goes quiet leaves the wiki admitting people under rules it has stopped applying, with nothing to say so.

The reader-group stand-in goes with it: a second rule for who is refused a password and a single sign-on
login, worked out for a state that does not arise, running where nobody is watching, and answerable only
against a stub.

One guard stays. `MemberLoginHandler` runs for every login the wiki has, so a failure there locks out the
administrator who would fix it. `Schema` and `DatabaseSchema` stay for it, and `MissingSchemaTest`
collapses into the one case `MemberLoginHandlerTest` now carries.

A wiki with its tables behaves exactly as before.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.83333% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 87.03%. Comparing base (c7a5b63) to head (fd4954d).

Files with missing lines Patch % Lines
src/MemberAccessExtension.php 66.66% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master      #21      +/-   ##
============================================
- Coverage     87.29%   87.03%   -0.26%     
+ Complexity      604      586      -18     
============================================
  Files            66       66              
  Lines          2125     2052      -73     
============================================
- Hits           1855     1786      -69     
+ Misses          270      266       -4     

☔ 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.

@JeroenDeDauw
JeroenDeDauw marked this pull request as ready for review August 25, 2026 16:13
@JeroenDeDauw
JeroenDeDauw merged commit c8e5746 into master Aug 25, 2026
6 checks passed
@JeroenDeDauw
JeroenDeDauw deleted the remove-missing-schema-guards branch August 25, 2026 16:13
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