Commit graph

26 commits

Author SHA1 Message Date
Arlo Breault ed8e449e13 Drop disabled lints
Covered by RecordLintJobTest::testDropInlineMediaCaptionLints

Change-Id: I564389ec9bd20cf36ec7a9bf96b1aebf7777cbbc
2024-07-25 11:29:36 -04:00
Amir Sarabadani 388106b0a4 Stop storing missing-image-alt-text lints
Bug: T370304
Change-Id: Ib473ddcc09c6c02e450a8664d21acbddaa7b2505
2024-07-22 02:59:21 +02:00
Arlo Breault 489fe5a912 Revert changes in log levels
I015fbe2ab613619c8805d12bfd397cc08450ef24 falsely assumed these were
ending up in logstash already but, unless explicitly asked, logstash
doesn't go below "info", regardless of the channel's level.

Change-Id: I55884a2535e839ca92d5d679cc4dc7911050f298
2024-07-11 18:59:58 -04:00
Arlo Breault 054abb7915 Change some log levels to debug so logs can be suppressed from Logstash
Failing to inject is redundant with EventBus logs.

Change-Id: I015fbe2ab613619c8805d12bfd397cc08450ef24
2024-07-02 20:13:08 -04:00
daniel 6c07b92097 Logging: add debug messages in Hooks and RecordLintJob
Additional debug logging allows us to verify the upcoming changes
in If53841ee583ce in production.

Bug: T361013
Change-Id: I261aacc1c9fa6483d88e94424d1f77d861f1a990
2024-05-22 21:06:50 +02: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
Arlo Breault c04b075858 Stop constructing Database with a page id
Instead, pass the page id when using methods for a page.  The change
avoids constructing Database a dummy page id when those methods aren't
going to be used.

getFromId doesn't seem like it needs a page id, since the linter id is
the primary key.

Also, a namespace id should no longer optional to setForPage.  The
LinterWriteNamespaceColumnStage option already gates whether to include
it in the row.

Follows-Up: I9fd6e7724dcf33be0b1feb19ec8eb448738cab09
Change-Id: Ib3d3622144b670ebe1a4ce04e6db6811584d42c8
2024-04-10 21:07:08 -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
C. Scott Ananian fde916fff5 [DI] Use dependency injection for RecordLintJob
Change-Id: I3b8cd95e075af92c77a7dec4f12a0a81eab3ae4b
2024-04-04 21:42:10 -04:00
Arlo Breault 8d49b68ba5 Move Database::updateStats to TotalsLookup
Database::updateStats moved to Database from RecordLintJob in
I2610b9b16d4032b0e18b3537cc9ed51bfdaff299 for reuse in Hooks but seems
better placed on TotalsLookup.

Change-Id: I600853e5cfc9e8abae9c6b07cee4c2adc37ef464
2024-04-02 17:12:24 -04:00
gerritbot e181c2ef66 Replace some moved Title class uses, now MediaWiki\Title\Title
Bug: T321681
Change-Id: Id325b25e154b8b2bbd1d0b1d7b1c7830b40873f6
2023-08-19 12:37:07 +00:00
sbailey e306f5f681 Add namespace column and new index to Linter table - part 2
* Writes namespaceID to new "linter_namespace" field if global
   "wgLinterWriteNamespaceColumnStage" is present

Bug: T299612
Change-Id: If908c4dc99c966cde2981f9a03be38a577406a4e
2022-07-01 06:51:29 -07:00
Subramanya Sastry 70ffca650e Drop 'inline-media-caption' lint requests
Bug: T297443
Bug: T299302
Change-Id: Id158f1fef8be06ddac733c71b7c1e26a58270955
2022-01-17 12:55:51 -06:00
Arlo Breault fc8c39baa5 Fix lint error updating
The article id of the title is set to 0 when the page is deleted so,
although the lint job from the hook runs, it doesn't remove anything.

Reverts most of I06b821b65f65609ddac8ed4e7c662336082d8266

Bug: T298782
Bug: T170313
Change-Id: I2610b9b16d4032b0e18b3537cc9ed51bfdaff299
2022-01-10 16:24:00 -05:00
Alexander Vorwerk af53fbc23a Replace usages of deprecated wfWikiID()
The global function wfWikiID() is deprecated since 1.35 and it's usages
should be replaced with WikiMap::getCurrentWikiId().

Bug: T298059
Change-Id: I695c20bff266f869f740baf7f3e335b357546fb4
2021-12-21 01:54:47 +00:00
C. Scott Ananian 551a1fb398 Allow Parsoid to provide category ID hints
This eases deployment dependencies by allowing Parsoid to supply an
appropriate database category ID so that new lint categories can be
appropriately stored during the interval between adding a new lint
category to Parsoid and deploying an Extension:Linter patch to
describe it.

Change-Id: Ib7b2342168fa53ca2abac7d5f54fe313be341eb7
2019-12-03 23:26:34 -05:00
Kunal Mehta e41e8e32a4 Drop excess events at the API layer
Originally we were dropping excess events inside the job queue, but that means
all of the events need to be passed into the job queue...which can cause
problems.

So drop them in the API module. The only other place we construct
RecordLintJob is when an article has been deleted, and those jobs have
no errors since they're all being deleted.

Bug: T202179
Change-Id: I61940280e0dfb99398d9f047d0e66007d91a0241
2018-08-17 20:36:06 -07:00
Kunal Mehta a1421792e9 Use normal lint error updating logic for page deletions
Page deletions were bypassing the logic in RecordLintJob that
ensured the right category totals cache was cleared and the
statsd updates. Fix that by just using RecordLintJob directly.

Bug: T170313
Change-Id: I06b821b65f65609ddac8ed4e7c662336082d8266
2017-10-05 21:03:30 -07:00
Kunal Mehta eebd04aa00 Add caching to looking up totals
The query itself is too expensive to be run on large Wikimedia wikis. So
put it behind WAN cache and touch the check keys for each category
whenever those have errors added or deleted from them.

If this happens to get out of sync, it will get fully refreshed
regularly when the totals are sent to statsd.

WANObjectCache's 'lockTSE' feature will help avoid cache stampedes that
made this query expensive in the past.

Change-Id: I3774103a29fa0f29d36283950f136259fa71bffe
2017-05-29 07:33:41 -07:00
Kunal Mehta eacb3c0d0d Split statsd metrics by wiki
This way we can track the progress of individual wikis in cleaning up
errors. The wiki name is at the end of the key so we can still use
e.g. "linter.category.$name.*" to see across all wikis at once.

Change-Id: I62463b9256e125d32d97396bd939334d71b46027
2017-04-06 11:21:41 -07:00
Kunal Mehta 9ba2839e7d Record totals in categories in statsd
For historical purposes so we can see new errors being added/fixed.

Bug: T152664
Change-Id: Icec62d236351e43ec397ac448805ab16131c943c
2016-12-08 16:52:52 -08:00
Kunal Mehta 419610bcdb Enforce category/page/position uniqueness constraint in the database
Move location to two separate columns in the database: linter_start and
linter_end. This allows us to have the database enforce the uniqueness
of those fields, instead of just relying upon the PHP code to do so,
which could be bypassed since we have multiple servers and concurrent
processes.

Change-Id: I3e67ce1b7cb3c93866a388ec3248af4cff2a81e0
2016-11-30 18:55:19 -08:00
Kunal Mehta 29379edb0b De-duplicate errors and trim excessive errors in the same category
It's possible to have duplicate, identical lint errors if the same exact
error is repeated in a template transclusion (e.g. {{1x|<b/> <b/>}})
since the position via dsr is the same. In this case, just de-duplicate
the errors since we can't differentiate them.

At the same time, trim excessive errors on the same page in the same
category. It's most likely that if a page has that many of the same
errors, the editor or bot will just fix all of them at the same time, so
we don't need to include all of them in the database. 20 is kind of a
low value, but we can always increase it later on as necessary.

Change-Id: I9cded720169870d0eea574e1a930ce4e9b190ac0
2016-11-23 19:47:04 -08:00
Kunal Mehta 9ecf62ead3 Update lint errors via the job queue
The job queue will allow us to have better flood control and rate
limiting instead of trying to do all the database writes as soon as
parsoid contacts MediaWiki.

On the downside, this means it may take longer for changes to be
reflected in the database and to users, but we already have no promise
for that, so it seems okay.

Note that if you don't have a job queue runner set up, you'll need to
run the runJobs.php script every time to have the jobs execute.

Change-Id: I25fd54734aca4dab09711e7f6aee027654931300
2016-11-15 11:31:45 -08:00