Page MenuHomePhabricator

AddLink feature ignore 'maxTasksPerDay' rule
Closed, ResolvedPublicBUG REPORT

Event Timeline

Urbanecm_WMF triaged this task as High priority.
Urbanecm_WMF subscribed.

Thanks for reporting! Seems to be an issue by looking at the contributions.

Few checks I did: The task type handler seems to be returning the correct value. It also works when I briefly change cswiki production value.

> $disabledTaskTypes = \MediaWiki\MediaWikiServices::getInstance()->get('GrowthExperimentsNewcomerTasksConfigurationLoader')->getDisabledTaskTypes()
= [
    "image-recommendation" => GrowthExperiments\NewcomerTasks\TaskType\ImageRecommendationTaskType {#3806},
    "link-recommendation" => GrowthExperiments\NewcomerTasks\TaskType\LinkRecommendationTaskType {#3801},
    "links" => GrowthExperiments\NewcomerTasks\TaskType\TemplateBasedTaskType {#3786},
    "section-image-recommendation" => GrowthExperiments\NewcomerTasks\TaskType\SectionImageRecommendationTaskType {#3969},
  ]

> $disabledTaskTypes['link-recommendation']
= GrowthExperiments\NewcomerTasks\TaskType\LinkRecommendationTaskType {#3801}

> $disabledTaskTypes['link-recommendation']->getMaxTasksPerDay()
= 5

>

But, the reported number of completed tasks for today is zero:

[urbanecm@mwmaint1002 ~]$ mwscript shell.php ruwiki
Psy Shell v0.11.10 (PHP 7.4.33 — cli) by Justin Hileman
> \MediaWiki\MediaWikiServices::getInstance()->get('GrowthExperimentsLinkRecommendationSubmissionLogFactory')->newLinkRecommendationSubmissionLog(User::newFromName('Влад Мишаков'))->count()
= 0

>

Enabling verbose debugging for the above command shows:

[debug] [rdbms] GrowthExperiments\NewcomerTasks\NewcomerTasksLog::count [0.001s] db1168: SELECT  COUNT(*) AS `rowcount`  FROM (SELECT  1  FROM `logging` JOIN `actor` ON ((log_actor=actor_id))   WHERE log_type = 'growthexperiments' AND log_action = 'addlink' AND actor_name = 'Влад_Мишаков' AND (log_timestamp > '20230813210000') AND (log_action IS NOT NULL)  ) `tmp_count`

The actor_name condition is incorrect (there should be a space, not an underscore). Fixing this problem at the maintenance server returns a more believable number (32, in particular). Uploading Gerrit patch fix!

Change 948614 had a related patch set uploaded (by Urbanecm; author: Urbanecm):

[mediawiki/extensions/GrowthExperiments@master] NewcomerTasksLogFactory: Use getName(), not getDbKey()

https://gerrit.wikimedia.org/r/948614

Change 948614 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] NewcomerTasksLogFactory: Use getName(), not getDbKey()

https://gerrit.wikimedia.org/r/948614

Change 948625 had a related patch set uploaded (by Urbanecm; author: Urbanecm):

[mediawiki/extensions/GrowthExperiments@master] [tests] Add NewcomerTasksLogTest

https://gerrit.wikimedia.org/r/948625

Change 948588 had a related patch set uploaded (by Urbanecm; author: Urbanecm):

[mediawiki/extensions/GrowthExperiments@wmf/1.41.0-wmf.20] NewcomerTasksLogFactory: Use getName(), not getDbKey()

https://gerrit.wikimedia.org/r/948588

Change 948588 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@wmf/1.41.0-wmf.20] NewcomerTasksLogFactory: Use getName(), not getDbKey()

https://gerrit.wikimedia.org/r/948588

Mentioned in SAL (#wikimedia-operations) [2023-08-14T20:16:41Z] <urbanecm@deploy1002> Started scap: Backport for [[gerrit:948588|NewcomerTasksLogFactory: Use getName(), not getDbKey() (T344163)]]

Mentioned in SAL (#wikimedia-operations) [2023-08-14T20:18:08Z] <urbanecm@deploy1002> urbanecm: Backport for [[gerrit:948588|NewcomerTasksLogFactory: Use getName(), not getDbKey() (T344163)]] synced to the testservers mwdebug1002.eqiad.wmnet, mwdebug1001.eqiad.wmnet, mwdebug2002.codfw.wmnet, mwdebug2001.codfw.wmnet, and mw-debug kubernetes deployment (accessible via k8s-experimental XWD option)

Mentioned in SAL (#wikimedia-operations) [2023-08-14T20:25:49Z] <urbanecm@deploy1002> Finished scap: Backport for [[gerrit:948588|NewcomerTasksLogFactory: Use getName(), not getDbKey() (T344163)]] (duration: 09m 08s)

@Iniquity This bug should now be resolved in production. If you can test it, it would be appreciated. Thanks again for reporting!

@Iniquity This bug should now be resolved in production. If you can test it, it would be appreciated. Thanks again for reporting!

I'm afraid that until this - T344034 - is fixed I won't be able to test because there are too many false positives :( But thanks a lot for the fix! :)

Gotcha, thanks for the clarification @Iniquity. I've uploaded a script change for the other task, and once it is merged, I can run it on ruwiki. Hopefully this can happen by the end of week.

Change 948625 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] [tests] Add NewcomerTasksLogTest

https://gerrit.wikimedia.org/r/948625

@Iniquity This bug should now be resolved in production. If you can test it, it would be appreciated. Thanks again for reporting!

I'm afraid that until this - T344034 - is fixed I won't be able to test because there are too many false positives :( But thanks a lot for the fix! :)

Both tasks should now be resolved. Let me know if it works correctly!

Checked on testwiki wmf.22 - seems to be working as expected.

Checked

  • how soon after changing maxTasksPerDay limit users will be restricted in their access to add link tasks
  • if the previous edits (suggested tasks edits, article and non-article edits) will affect the limit counter
  • (added) testing users with a space in their name

All of the above works as expected.

Checked on testwiki wmf.22 - seems to be working as expected.

Checked

  • how soon after changing maxTasksPerDay limit users will be restricted in their access to add link tasks
  • if the previous edits (suggested tasks edits, article and non-article edits) will affect the limit counter

All of the above works as expected.

Thanks for the tests! I just realized I didn't make obvious, but as far as I know, this bug only affected users who have a space in their username. I'll note that in the description as well.

Checked on testwiki wmf.22 - seems to be working as expected.

Checked

  • how soon after changing maxTasksPerDay limit users will be restricted in their access to add link tasks
  • if the previous edits (suggested tasks edits, article and non-article edits) will affect the limit counter

All of the above works as expected.

Thanks for the tests! I just realized I didn't make obvious, but as far as I know, this bug only affected users who have a space in their username. I'll note that in the description as well.

Yes, I forgot to add it to the tests that I've run (will add it to the comment above).