French onthisday/selected for some 1sts of the month pages not working
Closed, ResolvedPublic

Description

Some 1st days of the month onthisday/selected entries don't work on French Wikipedia.

http://localhost:6927/fr.wikipedia.org/v1/feed/onthisday/selected/01/01
{
"status": 404,
"type": "https://mediawiki.org/wiki/HyperSwitch/errors/not_found#page_revisions",
"title": "Not found.",
"detail": "Page was deleted",
"method": "get",
"uri": "/fr.wikipedia.org/v1/page/html/Wikip%C3%A9dia%3A%C3%89ph%C3%A9m%C3%A9ride%2F1_janvier"
}

Similar:
http://localhost:6927/fr.wikipedia.org/v1/feed/onthisday/selected/02/01
http://localhost:6927/fr.wikipedia.org/v1/feed/onthisday/selected/03/01
http://localhost:6927/fr.wikipedia.org/v1/feed/onthisday/selected/09/01
http://localhost:6927/fr.wikipedia.org/v1/feed/onthisday/selected/10/01
http://localhost:6927/fr.wikipedia.org/v1/feed/onthisday/selected/11/01
http://localhost:6927/fr.wikipedia.org/v1/feed/onthisday/selected/12/01

This happens already on master and production, e.g. https://fr.wikipedia.org/api/rest_v1/feed/onthisday/selected/01/01, etc., but also with the new patch https://gerrit.wikimedia.org/r/#/c/373748.

bearND created this task.Thu, Aug 31, 6:02 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptThu, Aug 31, 6:02 PM
bearND added a subscriber: Mhurd.Thu, Aug 31, 6:04 PM

CC @Mhurd in case you have any thoughts about this since you've worked on this area recently.

Mhurd added a comment.Thu, Aug 31, 6:05 PM

@bearND iirc french is missing a page for jan 1 - i'll double check...

Mhurd added a comment.Thu, Aug 31, 6:07 PM

Ah I was wrong! Turns out the name first day pages a little differently - 1er_janvier instead of 1_janvier... should be a fairly easy fix... I'll take a stab at it.

Mhurd claimed this task.Thu, Aug 31, 6:07 PM

@Mhurd My bad: I should have looked at the selected page instead: https://fr.wikipedia.org/api/rest_v1/page/html/Wikip%C3%A9dia:%C3%89ph%C3%A9m%C3%A9ride%2F1er_janvier

Maybe it's because it needs to add the 'er' after the '1' in the page title, because https://fr.wikipedia.org/api/rest_v1/page/html/Wikip%C3%A9dia:%C3%89ph%C3%A9m%C3%A9ride%2F1_janvier does not work?

Probably a copy of these line to the nameFormatter for selected page as well should do the trick:

if (dayNumber === 1) {
    dayNumber = '1er';
}
Mhurd added a comment.Thu, Aug 31, 6:41 PM

@bearND Ya that's what I thought too, but unfortunately the anniversary pages are named inconsistently:

The August 1st anniversary page doesn't use 'er': 1_août (even though the August 1st day page does: 1er_août)

But the February 1st anniversary page does: 1er_février

So making the change you specified does fix 'selected' for 02/01, 03/01, 09/01, 10/01, 11/01 and 12/01, but it breaks 'selected' for the first days of the other months...

Hmm...

Mhurd added a comment.Thu, Aug 31, 6:42 PM

I'll hack at accounting for these variances and see how ugly the solution will be... :)

Mhurd added a comment.Thu, Aug 31, 6:43 PM

At least all the day pages for 1st days of the month consistency use 'er' :)

Mhurd added a comment.Thu, Aug 31, 6:56 PM

I have a fix that accounts for all these variances. Because the nameFormatter is a closure it was super easy :)

Mhurd added a comment.Thu, Aug 31, 7:10 PM

I'll submit a patch as soon as https://gerrit.wikimedia.org/r/#/c/373748/ gets merged (otherwise will probably have merge conficts).

Mhurd added a comment.Thu, Aug 31, 7:23 PM

Here's my fix for the FR selectedPage nameFormatter if you want to kick the tires:

nameFormatter : (monthName, monthNumber, dayNumber) => {
    if (dayNumber === 1) {
        if (new Set([1, 2, 3, 5, 9, 10, 11, 12]).has(monthNumber)) {
            dayNumber = '1er';                      
        }
    }              
    return `Wikipédia:Éphéméride/${dayNumber}_${monthName}`;
},

Probably would be good to cc some folks who speak French, like @hashar, @Tbayer, @mobrovac, and see if they have any insight.

@Mhurd You don't need to wait until your other patch gets merged if you just add the commit to the same local branch (or a branch that is based on the other one).

Change 375407 had a related patch set uploaded (by Mhurd; owner: Mhurd):
[mediawiki/services/mobileapps@master] Fix "On this day" for "selected" for first days of months.

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

Mhurd added a comment.Fri, Sep 1, 5:56 PM

Probably would be good to cc some folks who speak French, like @hashar, @Tbayer, @mobrovac, and see if they have any insight.

I suppose those pages could be renamed to be consistent if there're wasn't a lang specific reason not to?

Yeah, the first day of the month is an exception in French. All but that date are cardinals, the first of the month is an ordinal, though: 2 may, 20 octobre, but 1er may and 1er octobre. The lack of structure is not surprising as French people are confused about it themselves :) The correct way is 1er janvier, though, not 1 janvier.

Here's my fix for the FR selectedPage nameFormatter if you want to kick the tires:

nameFormatter : (monthName, monthNumber, dayNumber) => {
    if (dayNumber === 1) {
        if (new Set([1, 2, 3, 5, 9, 10, 11, 12]).has(monthNumber)) {
            dayNumber = '1er';                      
        }
    }              
    return `Wikipédia:Éphéméride/${dayNumber}_${monthName}`;
},

How about trying to request it twice? Or rather, how about engaging the French WP community and come to a consensus with them?

bearND added a comment.EditedWed, Sep 6, 12:11 AM

To use 1er instead of 1 for the monthNumber is not a surprise to me. The inconsistency between the page names for the selected event pages and the regular day pages is surprising to me:

  • All day pages of the first of the month start with "1er". Example: 1er_juillet
  • But only some of the page names for the selected page start with "1er". Some do not, mostly in the middle of the year: Example: 1_avril, 1er_mai, 1_juillet

If there are exceptions to the rule that all 1st days in the month pages in French start with 1er then I would have expected them to be the same for [[fr:1er_juillet]] and for [[fr:Wikipédia:Éphéméride/1er_juillet]], but it's [[fr:Wikipédia:Éphéméride/1_juillet]] instead.

Anyways, the current page names are encoded in @Mhurd's latest patch which should get deployed on Wednesday.

Change 375407 merged by jenkins-bot:
[mediawiki/services/mobileapps@master] Fix "On this day" for "selected" for first days of months.

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

Mentioned in SAL (#wikimedia-operations) [2017-09-12T21:55:45Z] <bsitzmann@tin> Started deploy [mobileapps/deploy@b11b75c]: Update mobileapps to 297b048 (T174707 T175305)

Mentioned in SAL (#wikimedia-operations) [2017-09-12T22:00:13Z] <bsitzmann@tin> Finished deploy [mobileapps/deploy@b11b75c]: Update mobileapps to 297b048 (T174707 T175305) (duration: 04m 28s)

bearND closed this task as Resolved.