Page MenuHomePhabricator

Uniqueness of linter_cat_page_position index prevents lints with different params
Open, LowPublic

Description

Because dsr info is associated with an entire encapsulated region, it can be the case that multiple instances of errors in the same category can have the same position but different params. For example,

<span id="one">1</span>
<span id="two">2</span>
{{1x|1=
<span id="one">1</span>
<span id="two">2</span>
}}

will emit two lint errors,

{"type":"duplicate-ids","dsr":[48,106,null,null],"templateInfo":{"name":"Template:1x"},"params":{"id":"one"}}
{"type":"duplicate-ids","dsr":[48,106,null,null],"templateInfo":{"name":"Template:1x"},"params":{"id":"two"}}

However, the uniqueness constraint of the index linter_cat_page_position will prevent the second error from being stored in the db. Duplicate key errors are ignored when inserting,
https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/extensions/Linter/+/refs/heads/master/includes/Database.php#264

I suppose this is not such a big deal since fixing one error will allow the second error to be exposed.