wiki.techinc.nl/tests/phpunit/includes
Timo Tijhof 008b6528b6 resourceloader: Skip version hash calculation in debug mode
=== Why

* More speed

  In debug mode, the server should regenerate the startup manifest
  on each page view to ensure immediate effect of changes. But,
  this also means more version recomputation work on the server.

  For most modules, this was already quite fast on repeat views
  because of OS-level file caches, and our file-hash caches and
  LESS compile caches in php-apcu from ResourceLoader.
  But, this makes it even faster.

* Better integration with browser devtools.

  Breakpoints stay more consistently across browsers when the
  URL stays the same even after you have changed the file and
  reloaded the page. For static files, I believe most browsers ignore
  query parameters. But for package files that come from load.php,
  this was harder for browsers to guess correctly which old script URL
  is logically replaced by a different one on the next page view.

=== How

Change Module::getVersionHash to return empty strings in debug mode.

I considered approaching this from StartupModule::getModuleRegistrations
instead to make the change apply only to the client-side manifest.

I decided against this because we have other calls to getVersionHash
on the server-side (such as for E-Tag calculation, and formatting
cross-wiki URLs) which would then not match the version queries that
mw.loader formats in debug mode.

Also, those calls would still be incurring some the avoidable costs.

=== Notes

* The two test cases for verifying the graceful fallback in production
  if version hash computations throw an exception, were moved to a
  non-debug test case as no longer happen now during the debug
  (unminified) test cases.

* Avoid "PHP Notice: Undefined offset 0" in testMakeModuleResponseStartupError
  by adding a fallback to empty string so that if the test fails,
  it fails in a more useful way instead of aborting with this error
  before the assertion happens. (Since PHPUnit generally stops on the
  first error.)

* In practice, there are still "version" query parameters and E-Tag
  headers in debug mode. These are not module versions, but URL
  "combined versions" crafted by getCombinedVersion() in JS and PHP.
  These return the constant "ztntf" in debug mode, which is the hash
  of an empty string. We could alter these methods to special-case
  when all inputs are and join to a still-empty string, or maybe we
  just leave them be. I've done the latter for now.

Bug: T235672
Bug: T85805
Change-Id: I0e63eef4f85b13089a0aa3806a5b6f821d527a92
2021-09-15 18:13:09 -07:00
..
actions Revert "Use CsrfTokenSet as CSRF token source" 2021-08-05 15:48:26 -07:00
api Merge "rdbms: Add more return typehints" 2021-09-14 20:51:25 +00:00
auth AuthManager: inject more services 2021-08-05 21:31:02 +00:00
block tests: Swap assertion order in unit tests 2021-08-04 20:21:01 +02:00
cache Merge "LinkCache: soft deprecate addGoodLinkObj()" 2021-09-10 17:22:02 +00:00
changes Title: Make use of BacklinkCacheFactory service 2021-09-09 14:04:02 +01:00
changetags ChangeTagsTest: make use of assertSelect() 2021-08-05 22:55:21 +00:00
collation CollationTest: Be more specific with @covers 2021-09-08 13:46:58 +00:00
config Tests: Mark more more closures as static 2021-02-09 02:55:57 +00:00
content Hard-deprecate Content::preSaveTransform. 2021-08-25 16:14:59 +03:00
context Remove $actor field from UsererIdentityValue 2021-04-13 18:18:06 +00:00
db ILoadBalancer: Rename forEachOpenMasterConnection to forEachOpenPrimaryConnection 2021-09-03 13:05:23 -07:00
debug Cleanup mixed space/tab line indent 2021-09-04 00:52:31 +02:00
deferred ILoadBalancer/ILBFactory: Rename commitMasterChanges() to commitPrimaryChanges() 2021-09-02 11:27:10 -07:00
diff Apply side lock to diff headers and empty lines, too 2021-08-12 18:08:57 +02:00
editpage Replace easy usages of User for UserIdentity/Authority 2021-06-09 07:53:52 -07:00
exception build: Updating dependencies 2021-07-22 03:36:05 +00:00
externalstore Remove unneeded uses of MediaWikiCoversValidator 2021-05-22 01:43:29 +00:00
filebackend Cleanup mixed space/tab line indent 2021-09-04 00:52:31 +02:00
filerepo tests: Swap assertion order in unit tests 2021-08-04 20:21:01 +02:00
GlobalFunctions Cleanup mixed space/tab line indent 2021-09-04 00:52:31 +02:00
HookContainer Tests: Mark more more closures as static 2021-02-09 02:55:57 +00:00
htmlform Tests: Mark more more closures as static 2021-02-09 02:55:57 +00:00
http Move HttpRequestFactoryTest to a unit test 2021-06-02 13:20:02 +00:00
import build: Updating dependencies 2021-07-22 03:36:05 +00:00
installer Installer: Do not use mediawiki.skinning.interface module 2021-04-15 11:11:32 -07:00
interwiki Replace uses of DB_MASTER with DB_PRIMARY 2021-04-29 09:24:31 -07:00
jobqueue Title: Make use of BacklinkCacheFactory service 2021-09-09 14:04:02 +01:00
language
languages Fix various typos in documentation 2021-08-23 09:03:44 +00:00
libs Cleanup mixed space/tab line indent 2021-09-04 00:52:31 +02:00
linkeddata build: Updating dependencies 2021-07-22 03:36:05 +00:00
linker Remove stub threshold feature 2021-09-13 09:26:38 -07:00
logging build: Updating dependencies 2021-07-22 03:36:05 +00:00
mail Make MailAddressTest a unit test 2021-07-23 10:30:04 +00:00
media PNGMetadataExtractor: skip oversize chunks instead of aborting 2021-07-28 14:14:22 +10:00
Message phpunit: Mass-replace setMethods with onlyMethods and adjust 2021-04-16 20:15:00 +02:00
Navigation
objectcache build: Updating dependencies 2021-07-22 03:36:05 +00:00
page LinkCache: soft deprecate addGoodLinkObj() 2021-09-10 16:00:02 +02:00
pager Replace uses of DB_MASTER with DB_PRIMARY 2021-04-29 09:24:31 -07:00
ParamValidator/TypeDef Make UserDefTest a unit test 2021-09-13 23:55:51 -04:00
parser Cleanup mixed space/tab line indent 2021-09-04 00:52:31 +02:00
password Remove PasswordCannotMatchUsername password policy 2021-09-06 14:55:12 +00:00
Permissions Cleanup mixed space/tab line indent 2021-09-04 00:52:31 +02:00
poolcounter ParserCache: only use in-process caching for metadata 2021-04-06 17:53:38 -06:00
preferences build: Updating dependencies 2021-07-22 03:36:05 +00:00
rcfeed build: Updating dependencies 2021-07-22 03:36:05 +00:00
registration registration: Make it easier to set a skin's templateDirectory 2021-08-27 00:22:38 -07:00
resourceloader resourceloader: Skip version hash calculation in debug mode 2021-09-15 18:13:09 -07:00
Rest build: Updating dependencies 2021-07-22 03:36:05 +00:00
Revision Merge "PageStore: Use LinkCache" 2021-09-09 20:04:47 +00:00
search Fix indent of line comment 2021-09-11 20:56:18 +02:00
session Use CentralIdLookup service instead of static factory 2021-07-26 07:00:53 -07:00
shell Cleanup mixed space/tab line indent 2021-09-04 00:52:31 +02:00
site Remove meaningless ->expects( $this->any() ) from all tests 2021-04-23 11:58:58 +02:00
skins Deprecate Skin::getCopyrightIcon. Skin::getPoweredBy, SkinGetPoweredBy hook 2021-09-14 20:53:46 -07:00
sparql sparql: Replace deprecated Http::userAgent() in SparqlClient 2021-08-04 13:54:13 +00:00
specialpage Cleanup mixed space/tab line indent 2021-09-04 00:52:31 +02:00
specials Rename four config variables to avoid 'blacklist' term 2021-09-08 23:32:29 +01:00
Storage Merge "rdbms: Add more return typehints" 2021-09-14 20:51:25 +00:00
title build: Updating dependencies 2021-07-22 03:36:05 +00:00
upload Revert "Use CsrfTokenSet as CSRF token source" 2021-08-05 15:48:26 -07:00
user Merge "rdbms: Add more return typehints" 2021-09-14 20:51:25 +00:00
utils build: Updating dependencies 2021-07-22 03:36:05 +00:00
watcheditem build: Updating dependencies 2021-07-22 03:36:05 +00:00
ActorMigrationTest.php Schema migration for revison_actor_temp table removal 2021-07-14 08:29:04 +10:00
ActorMigrationTest.sql Schema migration for revison_actor_temp table removal 2021-07-14 08:29:04 +10:00
AutoLoaderTest.php build: Updating dependencies 2021-07-22 03:36:05 +00:00
CategoryTest.php Remove Title from signatures in CategoryViewer 2021-09-13 16:14:06 +00:00
CommentStoreCommentTest.php
CommentStoreTest.php build: Upgrade mediawiki-codesniffer from v35.0.0 to v36.0.0 2021-04-29 13:00:15 -07:00
CommentStoreTest.sql
ContentSecurityPolicyTest.php Cleanup mixed space/tab line indent 2021-09-04 00:52:31 +02:00
EditPageConstraintsTest.php Revert "Use CsrfTokenSet as CSRF token source" 2021-08-05 15:48:26 -07:00
EditPageTest.php Cleanup mixed space/tab line indent 2021-09-04 00:52:31 +02:00
ExportTest.php build: Updating dependencies 2021-07-22 03:36:05 +00:00
ExtraParserTest.php build: Updating dependencies 2021-07-22 03:36:05 +00:00
FauxRequestTest.php build: Updating dependencies 2021-07-22 03:36:05 +00:00
GitInfoTest.php build: Updating dependencies 2021-07-22 03:36:05 +00:00
HooksTest.php build: Updating dependencies 2021-07-22 03:36:05 +00:00
HtmlTest.php build: Updating dependencies 2021-07-22 03:36:05 +00:00
LinkerTest.php Add tests for comment formatting methods in Linker 2021-09-02 11:29:09 -04:00
LinkFilterTest.php build: Updating dependencies 2021-07-22 03:36:05 +00:00
MagicWordFactoryTest.php
MediaWikiServicesTest.php Tests: Mark more more closures as static 2021-02-09 02:55:57 +00:00
MediaWikiTest.php build: Updating dependencies 2021-07-22 03:36:05 +00:00
MediaWikiVersionFetcherTest.php
MergeHistoryTest.php Clean up MergeHistory 2021-07-13 12:01:04 -07:00
MessageTest.php Message: Remove deprecated format property 2021-09-03 09:21:12 -07:00
MockServiceWiring.php Use the old HookContainer to set up the post-reset services 2020-12-01 13:04:12 +11:00
MovePageTest.php Use MovePageFactory and hard deprecate constructing MovePage objects directly 2021-08-11 15:44:09 -04:00
MultiHttpClientTest.php build: Updating dependencies 2021-07-22 03:36:05 +00:00
MWTimestampTest.php build: Updating dependencies 2021-07-22 03:36:05 +00:00
OutputPageTest.php Revert "Use CsrfTokenSet as CSRF token source" 2021-08-05 15:48:26 -07:00
PagePropsTest.php tests: Swap assertion order in unit tests 2021-08-04 20:21:01 +02:00
SampleTest.php build: Updating dependencies 2021-07-22 03:36:05 +00:00
SiteStatsTest.php Cleanup mixed space/tab line indent 2021-09-04 00:52:31 +02:00
StatusTest.php phpunit: Mass-replace setMethods with onlyMethods and adjust 2021-04-16 20:15:00 +02:00
TemplateCategoriesTest.php Use WikiPage::doUserEditContent() instead of ::doEditContent() 2021-06-28 00:11:30 -07:00
TestUser.php Create new UserGroupManager::addUserToMultipleGroups method 2021-08-30 10:24:46 -04:00
TestUserRegistry.php Remove unneeded @return documentation 2021-01-25 19:44:27 +01:00
TimeAdjustTest.php
TitleTest.php Merge "Title: Make use of BacklinkCacheFactory service" 2021-09-10 14:31:23 +00:00
TitleUrlTest.php Introduce TitleUrlTests 2021-09-08 07:48:45 +00:00
WebRequestTest.php build: Updating dependencies 2021-07-22 03:36:05 +00:00
WikiMapTest.php build: Updating dependencies 2021-07-22 03:36:05 +00:00
XmlTest.php build: Updating dependencies 2021-07-22 03:36:05 +00:00