Commit graph

89 commits

Author SHA1 Message Date
C. Scott Ananian 0937838f1e Collect selective update statistics from LintUpdate job
This ensures that all parsoid parses are accounted for in our
statistics.  In the future we might want to query the cache for
an existing 'dirty' parse in this codepath to potentially allow
for selective update, but for now assume that selective updates
are not possible here.

Bug: T371713
Depends-On: I5b8c7ab48d5a1d6c1e311149fcac6abdc523aa13
Change-Id: I391e928175f60a1ff2e5c181e20ed72efe4dfd66
2024-09-19 14:00:48 -04:00
C. Scott Ananian ba41d323f9 LintUpdate: use content handler instead of directly invoking ParsoidParser
We don't need to directly handle the ParsoidParserFactory in the
LintUpdate job; use the existing ContentHandler pathways to reduce
dependencies.

Change-Id: I64a4556a74da4f735a5b562070c21310ecda36d1
2024-09-17 16:44:37 -04:00
James D. Forrester 95686b4e7d build: Update MediaWiki requirement to 1.43
All extensions in the MediaWiki tarball are expected to track MediaWiki's release directly.

Change-Id: I098a7fd0e99412cffa22bc55bde960d6c2a3af35
2024-08-22 17:37:43 -04:00
jenkins-bot 9f089f122b Merge "Add a "fostered-transparent" lint category" 2024-07-27 00:36:19 +00:00
Arlo Breault fe6612e6ea Add a "fostered-transparent" lint category
Historically, Parsoid would suppress emitting lints for fostered content
that was purely rendering transparent since it's common to put include
directives, categories, etc in fosterable position and it made no
difference to rendering.

However, clients like DiscussionTools can benefit from this knowledge,
especially outside of templated content where it could result in edit
corruptions.

A separate category is used to avoid disrupting the work of editors
cleaning up lints in the "fostered" category, as in T369317.

Bug: T371142
Bug: T290936
Bug: T369317
Change-Id: I3519d86898df262eaea1a3303130453497ff27aa
2024-07-26 16:41:59 -04:00
Arlo Breault ed8e449e13 Drop disabled lints
Covered by RecordLintJobTest::testDropInlineMediaCaptionLints

Change-Id: I564389ec9bd20cf36ec7a9bf96b1aebf7777cbbc
2024-07-25 11:29:36 -04:00
Brooke Vibber 8ec69f87aa Disable missing-image-alt-text lint
It's not actively used at this time and it's causing a lot of writes,
affecting production. Disabling it should be harmless and reduce load.

Bug: T370304
Change-Id: I2170f657088993dd3fb81a9601284d3af7fc1883
2024-07-21 21:56:38 +00:00
Jon Robson 8677ca3b3a Make night-mode-unaware-background-color lint rule visible
Bug: T368673
Change-Id: I987ee169e062054adaa86c82057c50cf7f0d87e4
2024-06-27 14:13:47 -07:00
sbailey 0dfaa5523e Remove linter tag and template dual mode config and code
* Removed the write and user interface config variables and
  fixed the tests affected by their removal.

Bug: T331883
Change-Id: If44ceedae7278f498158b8cdd528dfa32be609eb
2024-06-14 15:40:47 -04:00
sbailey 72653441b2 Remove linter namespace field dual mode config and code
* Manual tests completed and query code reviewed

Bug: T331883
Change-Id: Ie1628799bb40ad74a24ab57a27a4176c2364fb82
2024-06-14 09:29:07 -07:00
daniel 8b22ad5d78 Trigger Parsoid run when page metadata is being updated
When RESTBase is turned off, Parsoid runs will no longer be triggered
on template changes. This creates a new mechanism to do that, based on
the RevisionDataUpdates hook called by DerivedPageDataUpdater. The new
behavior is controlled by a feature flag, LinterParseOnDerivedDataUpdate,
which is enabled per default. In WMF production, this should be
turned off as long as we are still triggering Parsoid parses through
the pregeneration mechanism in RESTBase.

Note that this will not write ParserOutput to the ParserCache. On edits,
pages will get parsed with Parsoid twice, once to trigger the lint data
update, and once by ParsoidCachePrewarmJob to populate the ParserCache.
Both parses will trigger the ParserLogLinterData hook, the lint data
from the second parse is redundant.

However, while ParsoidCachePrewarmJob and RevisionDataUpdates get
triggered together on edits, they also get triggered separately:
ParsoidCachePrewarmJob by page views with parser cache misses; and
RevisionDataUpdates when pages get invalidated due to template changes.

Because ParsoidCachePrewarmJob and RevisionDataUpdates generally get
triggered in different situations, it seems cleaner to keep the two
mechanisms independent of each other, and live with the duplicate parse
on edit.

Bug: T361013
Change-Id: If53841ee583ce240dd245d640b9ea9c97e1eaa55
2024-06-03 16:50:17 -05:00
Brooke Vibber ea186c1cee Add hidden lint missing-image-alt-text
Add support for new parsoid lint, missing-image-alt-text
Matches on images that don't have an alt text attribute at all
(empty alt attributes count as present).

Intended to make it easier to put workflows around these images,
including streamlined workflows for "microcontributions" in the
mobile apps.

As this has some impedence mismatch with usage of Special:LintErrors
this is marked as hidden (priority=none) so will not be displayed by
default, but has an enum value reserved for it and can be queried
explicitly.

Bug: T344378
Change-Id: I38cc1abbece3cca8155bec1f071b854027be0966
2024-05-29 19:03:41 -04:00
Arlo Breault 261339c2a3 Inject Database into TotalsLookup
Change-Id: I01e6b89b4ce9b1cea241bba9cad7ef6673803166
2024-04-11 12:24:42 -04:00
Arlo Breault ffc266eae6 Drop DatabaseFactory, just have Database as the service
Change-Id: Id25271c82bc7ba833d32dff3fb11d3dfe15a3f02
2024-04-10 21:21:40 -04:00
C. Scott Ananian 4f991b5d0c [DI] Clean up LintErrorsPager
Inject the services required by LintErrorsPager from the SpecialLintErrors
class.

Change-Id: Ie20e00cccef895fbad8536a94dfc1978f20c4220
2024-04-09 18:35:34 -04:00
C. Scott Ananian 633d6024a4 [DI] Make TotalsLookup an injectable service
Change-Id: I71d41ca5b0a901afd59950b3539d8e19c4cead5f
2024-04-09 18:35:32 -04:00
C. Scott Ananian 24f771a6a3 [DI] Make CategoryManager and Database injectable services
Change-Id: I9fd6e7724dcf33be0b1feb19ec8eb448738cab09
2024-04-09 18:33:13 -04:00
jenkins-bot 2d46c8195c Merge "[DI] Use dependency injection for RecordLintJob" 2024-04-05 19:20:41 +00:00
jenkins-bot 94ef8d8ea4 Merge "night-mode-unaware-background-color doesn't emit params" 2024-04-05 15:21:22 +00:00
C. Scott Ananian fde916fff5 [DI] Use dependency injection for RecordLintJob
Change-Id: I3b8cd95e075af92c77a7dec4f12a0a81eab3ae4b
2024-04-04 21:42:10 -04:00
C. Scott Ananian c983a822e3 [DI] Use dependency injection for Hooks
Change-Id: I23f56b0a3df1ef206ec160453294349d2482435f
2024-04-04 18:43:13 -04:00
C. Scott Ananian d71a297781 [DI] Use dependency injection for ApiQueryLinterStats
Change-Id: I5f5d3a226a9f7b733a6f07200216a1192115b102
2024-04-04 18:43:13 -04:00
C. Scott Ananian d8970278d1 [DI] Use dependency injection for SpecialLintErrors
Change-Id: I211d70d5fb4a321cf302cc10f6e160480468a347
2024-04-04 18:43:10 -04:00
Arlo Breault 0a5700fa39 night-mode-unaware-background-color doesn't emit params
Change-Id: Id65e19266cfc7de095ee621fe28c35639a9f73b1
2024-04-04 18:22:46 -04:00
C. Scott Ananian 24ef2e9cdb Revert "Revert "Add inline background color""
This reverts commit e2c7746818.

Reason for revert: Culprit is actually on the Parsoid side (reporting a new linter type before the Linter extension knows about it, transiently during deploy) and this revert makes that problem worse not better.

Change-Id: Ib0c1fab8b8e9536e90591a58da673931f5bddf4c
2024-03-20 19:43:10 +00:00
Jdrewniak e2c7746818 Revert "Add inline background color"
This reverts commit d08fb459c0.

Reason for revert: Might have caused T360565

Change-Id: I408d6eeb2a2789a284d45f879c77ea1e9936ff7c
Bug: T360565
2024-03-20 19:18:54 +00:00
ksarabia d08fb459c0 Add inline background color
*This adds inline background color linter

Bug: T359205
Change-Id: Ic0a66bdd8ae784c8e048cdba60bcfa11e3f96d20
2024-03-07 17:55:07 +00:00
jenkins-bot af48028cca Merge "Enable "missing end tag in heading" error in LintErrors" 2024-01-09 20:17:34 +00:00
sbailey 8bac609d00 Enable "missing end tag in heading" error in LintErrors
* Seems reasoable to enable this category, it has been in the
   database and accessible through Quarry reports for months.

Bug: T341369
Change-Id: Id80a0c02b5948ba9bdc56e762b781d764844afcb
2024-01-09 15:13:32 -05:00
Umherirrender 6c10926920 Use namespaced classes
This requires 1.42 for some new names

Done automatically via script

Change-Id: Idaad9e8d165a6bd202b96bbb657deb710cca4c54
2024-01-06 17:03:30 +01:00
Arlo Breault e978607d56 Remove ParserMigration association
Bug: T333179
Change-Id: Ifc6676c3f873aeb1655f3cb1b549a5dd55bc4d85
2023-10-13 12:33:26 -04:00
James D. Forrester e143c30341 build: Update MediaWiki requirement to 1.41
All extensions in the MediaWiki tarball are expected to track MediaWiki's release directly.

Change-Id: I69d58367c129625a0b1159e92b4b30ec7b892a78
2023-08-19 13:29:08 +08:00
Moh'd Khier Abualruz b9f1d478e2 Unclosed tags in article headings
- divide the 'missing-end-tag' into 2 categories:
 * 'missing-end-tag': kept the same ( minus the new category results)
 * 'missing-end-tag-in-heading': high priority

depends-on: I8397a24e85ca9f5a9ce6413dec5efa8c401a9960

Bug: T308398
Change-Id: I5738abd522bf5248e4b7b1255920055182e6261f
2023-05-05 12:57:21 +02:00
Moh'd Khier Abualruz d543552be9 Allow registration of hidden lint rules
Adding support for categories non, allowing access to category page without showing it in listing, in categories in teh special page

Bug: T334527
Change-Id: I8397a24e85ca9f5a9ce6413dec5efa8c401a9960
2023-05-04 10:41:05 -07:00
Moh'd Khier Abualruz 53918dd364 Create linting rule for large tables
depends-on: Ic25c50caf15423179e32ab1b4c0f0ab9f6c71cb3

Bug: T334528
Change-Id: I691a265aa1c3914c8cd9f3a63c2e8f8bfe92af0f
2023-05-02 19:21:10 +02:00
gerritbot e1542b880a Update moved class WikiMap
See T321882. Moved in I60cf4b9ef02b9d5

Bug: T321681
Change-Id: I2d9e34bf9849c3ae05761f83031c806987b5991f
2023-04-25 09:54:08 +00:00
sbailey 6aa4cdeba9 Linter Tag and Template search feature, UI and report code
* Tag and Template search is enabled using config variable
   'LinterUserInterfaceTagAndTemplateStage' and also checks for
   the linter table column 'linter_tag' to exist to protect the
   report code from error if the column is absent. As the linter
   table alter maintenance added both the linter_tag and
   linter_template at the same time, there is no reason to check
   both. The user interface code does not check for the field
   presence only the config variable.

 * This code depends on the recordLintJob code writing the tag
   and template data which is enabled by the config variable
   'LinterWriteTagAndTemplateColumnsStage' and also assumes the
   data migration maintenance script migrateTagTemplate.php has
   been run to populate linter error records created prior to
   the table alter and the write code being enabled.

Bug: T175177
Change-Id: I2f951dfcd34e3dc6ca17e8754cfaeba8baa3e835
2023-02-27 06:55:06 -08:00
sbailey 499a1c3796 Use new linter_namespace column and index in the Linter table
* This performance improvement patch uses the namespace from the
   new field 'linter_namespace' in the linter table instead of
   the 'page_namespace' in the page table. It checks for and
   requires the presence of the linter_namespace field in the
   linter table, as well as the config variable
   'LinterUseNamaspaceColumnStage' being set true.

 * If the linter_namespace field is present and aforementioned
   config variable is true, the code assumes that the config
   variable 'LinterWriteNamespaceColumnStage' is set true and
   recording the linter_namespace for new lint errors is
   active and the migrateNamespace.php migrate code has been
   run to migrate the page_namespace data into existing linter
   records that were created before the linter_namespace column
   existed and were left NULL during the table alter maintenance
   operation.

 * A follow on patch should remove the configuration variables and
   conditional code producing the final, refactored code dependent
   on the new namespace column index.

Bug: T299612
Change-Id: I4a1497d9e4dcd6a9a7befdaccf3e34c61694365d
2023-02-24 06:54:08 -08:00
Kunal Mehta eaf2d26db8 Remove API action=record-lint
The action=record-lint was a hack that allowed Parsoid/JS to send data
to MediaWiki to be stored in the linter database. Thankfully we no
longer need it in the glorious Parsoid/PHP world because it can write
directly to the database.

The API module, i18n messages and $wgLinterSubmitterWhitelist are all
removed.

Bug: T329992
Change-Id: Iba70e05a2e28f4ecd02101cff51993ebe65f19d0
2023-02-20 20:44:00 -05:00
sbailey d12bf639f6 Change linter maintenance scripts to use existing config varaibles
* Having separate config variables to enable the maintenance
   migrateNamespace and migrateTagTemplate scripts is duplicitous
   and should be shared with the write enable config variables.

Bug: T329342
Change-Id: I4cb453fc0678b065cb42a2ca59863da1ab9cdbe4
2023-02-14 09:43:54 -08:00
Kunal Mehta cb84f3a872 Link to detailed Special:LintErrors from action=info
action=info has a summary table of number of lint errors by category,
but we have richer information available via Special:LintErrors. If
there is a "Lint errors" section, provide a link below the table to
Special:LintErrors for the errors on this page.

Update ApiRecordLint for the new Hooks constructor and leave a FIXME
to eliminate the coupling.

Bug: T301374
Change-Id: Ic1fcf42b50d1392ac53201ceb256691133cf62ff
2023-02-06 20:41:45 -05:00
Kunal Mehta b5a7aaf7e0 Move LoadExtensionSchemaUpdatesHook handler to separate class
This hook is not allowed to have a service, so before we can add
services to the main Hooks class, it needs to be split out.

Change-Id: Ia7b4b8bf7c91ebb851c5de9f0f54f56b0993bf83
2023-02-06 20:36:45 -05:00
Umherirrender eb31c6c4dc Replace deprecated HTMLForm::addHeaderText
Bug: T325474
Change-Id: If1a4b14b6cec480f600065c913cb1f27260fbc5f
2022-12-27 12:48:42 +01:00
sbailey 350d677c5b Phase 3 of T175177: Migrate linter_params into new fields
* The migrate code is designed to perform a one-time update of
   linter_params JSON encoded template and tag information into
   the new discrete template and tag text fields for use as
   additional search criteria. The function can be restarted if
   it is interrupted.
 * It now uses configurable batching and sleep times between
   batches to allow the database to do other work and replication
   to occur without stressing infrastructure.
 * The migrate code is only called by test code and needs to be
   called one-time from a maintenance script.

Bug: T175177
Change-Id: Idc4ca88d4762bc7a3bcbc4e66c0f275562083867
2022-12-09 12:01:06 -08:00
sbailey 702ce215d0 Phase 3 migrate code for namespace column add to Linter table
* Migrates namespace info from the page tables page_namespace field
   to the new linter table field linter_namespace. This duplication
   of the namespace value was requested to greatly reduce the amount
   of database activity required by the linter search and reporting
   code.

 * This patch has been prepared as a dark launch patch enabled with
   config value LinterMigrateNamespaceStage and assumes that the
   Linter table has had the linter_namespace column added to it,
   and recording of the namespace field is already enabled and is
   populating the namespace column.

 * The migrate code now runnable from Linter/maintenance directory,
   using migrateNamespace.php, which will be deployed in a separate
   patch. The maintenance code creates an appropriate environment
   to call migrateNamespace( in Database.php.

Bug: T299612
Change-Id: I73cb80729d6a5a8716fe93164ad1e42e6958d672
2022-11-28 08:07:54 -08:00
Reedy 1c526b7443 Convert to HookHandler
Change-Id: Ib8ad9a58e781f7dad4b047d170a8f689802c4bad
2022-09-07 02:58:04 +01:00
sbailey b358b20dca Second phase of T175177: Adds template and tag to RecordLintJob
Bug: T175177
Change-Id: I59be7cabb80ace98da3c7f6f36a0d3d4f6b17d23
2022-08-22 12:47:01 -07:00
Arlo Breault 0f46ed3dbc Get config from services, not globals
If908c4dc99c966cde2981f9a03be38a577406a4e introduced the
wgLinterWriteNamespaceColumnStage global but didn't add it to the
extension.json

Change-Id: I8ee5849f67ddfd894a25425582b59404eb52aef2
2022-08-03 13:01:42 -04:00
sbailey 0e56c22277 Delete lint error records when content model changes from wikitext
* Determines if new content type is not wikitext and if so
   deletes all existing lint error records for that pageID.

Bug: T298343
Change-Id: I20fac9a0c901f3e7a5cc898566a4487fbe70798f
2022-02-25 13:22:10 -08:00
Arlo Breault 6898415d8d Disable "inline-media-caption" category
Note that this only removes the category from the special page and the
lints will still show up by page.  Those need purging separately or more
code to filter out disabled categories from the results.

Bug: T297443
Change-Id: Idfcf5ee5d69f5dc65100229aacb22137be475866
2022-01-16 12:25:28 -05:00