Replace the bootstrap file with declarative registration#94
Merged
Conversation
Codecov Report❌ Patch coverage is
❌ Your project check has failed because the head coverage (29.56%) is below the adjusted base coverage (30.08%). You can increase the head coverage or adjust the Removed Code Behavior. Additional details and impacted files@@ Coverage Diff @@
## master #94 +/- ##
============================================
- Coverage 30.08% 29.56% -0.53%
- Complexity 40 41 +1
============================================
Files 3 4 +1
Lines 113 115 +2
============================================
Hits 34 34
- Misses 79 81 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Drop the dead ApiBase::getVersion override (the parent method no longer exists in MediaWiki core) and read the test-run version header from extension.json instead of the SCQ_VERSION constant, so the constant can be removed with the bootstrap file.
Move message files, the compoundquery API module, and the #compound_query parser-function hook into extension.json. The parser function is registered by a new SCQ\Hooks ParserFirstCallInit handler. Delete SemanticCompoundQueries.php and drop load_composer_autoloader and the composer autoload block; the extension has no runtime composer dependencies and autoloads SCQ\ via AutoloadNamespaces. Fix I18nJsonFileIntegrityTest to handle the canonical array form of wgMessagesDirs['SemanticCompoundQueries'] set by MW from extension.json (the old bootstrap overwrote it with a string, masking this).
Mirror the existing SMW-autoloader is_readable() guard so a missing or unreadable extension.json fails with a clear message instead of a TypeError when reading the version.
b87f937 to
ba6bec9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Removes the root
SemanticCompoundQueries.phpbootstrap and registers everything it did declaratively inextension.json. The only piece that cannot be declarative — the#compound_queryparser function — moves into a smallSCQ\HooksParserFirstCallInithandler (MediaWiki has no declarative parser-function registration).Moved into
extension.jsonExtensionMessagesFilescompoundqueryAPI module (with theSMW.QuerySourceFactoryservice) →APIModules#compound_queryparser function →HookHandlers+Hooks(handled by the newSCQ\Hooks)Removed
SemanticCompoundQueries.phpand theSemanticCompoundQueriesclasscallback,ExtensionFunctions, andAutoloadClassesfromextension.jsonload_composer_autoloaderand the composerautoloadblock — the extension has no runtime composer dependencies (requireis onlyphpplus the install-timecomposer/installers), sovendor/autoload.phpis never needed at runtime;SCQ\is autoloaded viaAutoloadNamespacesSCQ_VERSIONconstant and its two consumers: a deadCompoundQuery::getVersion()override (it overrodeApiBase::getVersion(), removed from MediaWiki core long ago) and a version line in the PHPUnit bootstrap (now read fromextension.json)!defined( 'SMW_VERSION' )guard —requires.extensions.SemanticMediaWikialready enforces SMW's presence at registrationTest fix included
I18nJsonFileIntegrityTestnow handles the canonical array form ofwgMessagesDirs['SemanticCompoundQueries']. The old bootstrap overwrote MediaWiki's array (built fromMessagesDirs) with a bare string, which the test relied on; removing the bootstrap restores the array, so the test reads the first directory entry.No user-facing change:
#compound_queryand thecompoundqueryAPI module register with identical names and behaviour. The removed class and constant are internal-only and undocumented, and 7.0.0 is unreleased.Test plan
composer analyze— clean (lint + PHPCS + minus-x)composer test— green (63 tests, 121 assertions), including a newHooksTestandCompoundQueryTest::testExecute(which issues anaction=compoundqueryrequest, exercising the API-module registration)Special:Versionlists the extension at 7.0.0-alpha;{{#compound_query:…}}renders a result table;action=compoundqueryreturns results; thecompound_querymagic word resolves🤖 Generated with Claude Code