Page MenuHomePhabricator

Inform the user that (un)syncing a tracking tool failed
Closed, ResolvedPublic

Description

If an organizer adds a tracking tool to an event (or removes it), but the synchronization fails, we won't add (or remove) the tool. Changes to the event will still be saved, but the organizer should see a warning message in the interface stating that the tool in question could not be added/removed.

Acceptance criteria

Assuming that an organizer edits (or creates) an event and adds a tracking tool that passes validation but not the actual commit logic (*), then:

  • When using the API (enable event registration and update event registration), the response should be successful but it should contain a warning message.
  • When using the special page (Special:EnableEventRegistration and Special:EditEventRegistration), saving should succeed but there should be a warning box below the success box.
  • When using either the API or the special page, the failed update should be logged in the "CampaignEvents" channel (check the MW log file, see https://www.mediawiki.org/wiki/Manual:How_to_debug#Logging).

(*) - You probably have to manually change the code to see this behaviour, as it's not supposed to happen during normal operations. The easiest way is to edit WikiEduDashboard::validateToolAddition and ::validateToolRemoval and change their content to:

return StatusValue::newGood();

and also edit WikiEduDashboard::addToNewEvent, ::addToExistingEvent, and ::removeFromEvent and change their content to:

return StatusValue::newFatal( 'campaignevents-tracking-tool-http-error' );

Event Timeline

Restricted Application added a subscriber: Aklapper. ยท View Herald TranscriptMay 17 2023, 7:02 PM
Daimona updated the task description. (Show Details)

Change 921330 had a related patch set uploaded (by Daimona Eaytoy; author: Daimona Eaytoy):

[mediawiki/extensions/CampaignEvents@master] Report tracking tool commit failures to the user

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

Change 921330 merged by jenkins-bot:

[mediawiki/extensions/CampaignEvents@master] Report tracking tool commit failures to the user

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

Daimona added a subscriber: vaughnwalters.

@vaughnwalters Note that this is not testable yet because the functionality is not exposed anywhere. You will be able to test this once T317709 is done. Testing instructions are in the task description.

This is now ready for testing, as the endpoints were updated in T317709.

โœ… When using the API (enable event registration and update event registration), the response should be successful but it should contain a warning message.
enable event registration:

Screenshot 2023-06-30 at 5.56.27 PM.png (1ร—1 px, 271 KB)

update event registration:

Screenshot 2023-06-30 at 5.43.17 PM.png (1ร—1 px, 348 KB)

โœ… When using the special page (Special:EnableEventRegistration and Special:EditEventRegistration), saving should succeed but there should be a warning box below the success box.
Special:EnableEventRegistration

Screenshot 2023-06-30 at 5.14.46 PM.png (668ร—2 px, 122 KB)

Special:EditEventRegistration
Screenshot 2023-06-30 at 4.41.08 PM.png (496ร—2 px, 76 KB)

โœ… When using either the API or the special page, the failed update should be logged in the "CampaignEvents" channel (check the MW log file, see https://www.mediawiki.org/wiki/Manual:How_to_debug#Logging).

The stack trace is huge so I'm just including the error message from the log, this is from the Special Page:

[CampaignEvents] Tracking tool update failed for: event update (new tool). Event 3 with tool 1: <Error, collected 1 message(s) on the way, no value set>
+----------+---------------------------+--------------------------------------+
| error    | campaignevents-tracking-t |                                      |
|          | ool-http-error            |                                      |
+----------+---------------------------+--------------------------------------+

[rdbms] Wikimedia\Rdbms\LoadBalancer::reuseOrOpenConnectionForNewRef: reusing connection for 0/my_wiki
[rdbms] MediaWiki\Extension\CampaignEvents\TrackingTool\TrackingToolUpdater->replaceEventTools [0.001s] localhost: SELECT  *  FROM "ce_tracking_tools"    WHERE cett_event = 3
[rdbms] MediaWiki\Extension\CampaignEvents\TrackingTool\TrackingToolUpdater->replaceEventTools [0.001s] localhost: DELETE FROM "ce_tracking_tools" WHERE cett_id = '11'
[rdbms] MediaWiki::preOutputCommit [0.015s] localhost: COMMIT
MediaWiki::preOutputCommit: primary transaction round committed
[DeferredUpdates] MediaWiki\Deferred\DeferredUpdatesManager::run: started CdnCacheUpdate #860
[squid] CdnCacheUpdate::purge: http://localhost:8080/wiki/Event:T336900d http://localhost:8080/w/index.php?title=Event:T336900d&action=history
[DeferredUpdates] MediaWiki\Deferred\DeferredUpdatesManager::run: ended CdnCacheUpdate #860, processing time: 0.00098395347595215
etc etc

and this is from the API:

[CampaignEvents] Tracking tool update failed for: event update (new tool). Event 3 with tool 1: <Error, collected 1 message(s) on the way, no value set>
+----------+---------------------------+--------------------------------------+
| error    | campaignevents-tracking-t |                                      |
|          | ool-http-error            |                                      |
+----------+---------------------------+--------------------------------------+

[rdbms] Wikimedia\Rdbms\LoadBalancer::reuseOrOpenConnectionForNewRef: reusing connection for 0/my_wiki
[rdbms] MediaWiki\Extension\CampaignEvents\TrackingTool\TrackingToolUpdater->replaceEventTools [0.001s] localhost: SELECT  *  FROM "ce_tracking_tools"    WHERE cett_event = 3
[rdbms] MediaWiki\Extension\CampaignEvents\TrackingTool\TrackingToolUpdater->replaceEventTools [0s] localhost: DELETE FROM "ce_tracking_tools" WHERE cett_id = '14'
[rdbms] MediaWiki::preOutputCommit [0.012s] localhost: COMMIT
MediaWiki::preOutputCommit: primary transaction round committed
[DeferredUpdates] MediaWiki\Deferred\DeferredUpdatesManager::run: started CdnCacheUpdate #559
[squid] CdnCacheUpdate::purge: http://localhost:8080/wiki/Event:T336900d http://localhost:8080/w/index.php?title=Event:T336900d&action=history
etc
ifried subscribed.

This looks good, based on the QA notes, so I'm marking this as Done.