Feat: Verify translate-policy-page completion from the on-wiki creation

translate-policy-page was the last essential task with click-based completion, and it was wrong in both directions (T433617):

  • False negative: done required publishing via CX AND clicking "Mark as done". Someone who translated Five pillars from the kit and never returned stayed at status 2 forever — invisible to run counts and to every dashboard.

  • False positive: status 4 ("the page exists, not via CT") was in completedStatuses, so a policy page that predated the kit — or that anyone else created — read as done for EVERY user of that wiki. The same wiki-global existence bug T433369 retired for essential articles.

  • Register the task in VERIFIABLE_TASKS with verifyPolicyPageRun: resolve the wiki's Five pillars page through the langlink a CX publish lands on, then credit only when the creating revision is the caller's, is not a redirect, and is at/after their open. No ns0 gate — this page lives in the project namespace by design. Membership is also what makes POST /tasks/complete reject the click and flips the dashboards to ledger-sourced counts.

  • Accept BOTH open CTAs: step 1's open-translation and step 2's open-cx. The task described only open-cx, but that is the rarer path — against real analytics data, open-cx alone finds 4 runs where the pair finds 17, and BOTH of the two historically creditable runs used only open-translation. Registering one CTA would have shipped a feature that credited nobody. openCtas is a list for that reason.

  • Add fixedTitle for tasks whose target page is a constant: the open events carry no $.title (verified: 0 of 77 do), so the pending query and ledger anti-join COALESCE onto it. With @fixedTitle NULL the query is byte-for-byte equivalent for the other tasks. The ledger's UNIQUE key on the fixed title then gives exactly one credit per (wiki, user) — correct, since there is one page to create.

  • Rework the status to ledger-first (0|1|2|3) and retire status 4: a bare existing page is an availability fact about the wiki, not anyone's completion. Status 2 stays "this caller published via CX, not yet verified" — CX publishes happily over someone else's page, which the verifier then refuses, so a publish must not read as done. The wiki-global checkIfArticleExistsByLanglink gate is gone with status 4 (that method now has no callers; left in place deliberately).

  • Client: "Mark as done" becomes UI-only and the page tracks its own .complete event, matching the three sibling tasks. The unreachable "Saving…" state and its now-orphaned i18n message go.

  • Add the task to PER_USER_TASKS / completionScope 'user': a run belongs to the person whose creation was attested, never to the wiki.

The backfill needs no new code — verify-completions.js picks the task up through getPendingOpens once fixedTitle lands. Dry-run against a copy of the dev DB: 17 pending runs, 2 would credit (real Five pillars creations on fon.wikipedia and mni.wikipedia that no dashboard has ever counted), 0 errors. test.wikipedia.org runs can never verify — resolveLanglinkTarget declines the test code — which is expected and matches essential-article.

Verified with a 24-check smoke run against a throwaway DB (stubbed wiki API, real qualifier chain): creator/at-or-after-open/redirect gates, a step-2-only open crediting, project-namespace pages qualifying, repeat opens collapsing to the earliest, one credit per pair, the sweep picking the task up, and — the regression risk of touching a shared prepared statement — install-gadget and create-essential-article still resolving by their own titles with titleless opens still excluded.

Deploy coupling: registration flips the dashboards to ledger-sourced counts immediately, so the backfill must run in the same window or the task reads zero. Steps in deploy-runbook-t433617.md (untracked, as with the T433014 and T433369 runbooks).

Co-Authored-By: Claude Opus 5 Bug: T433617

Closes T433617

Merge request reports

Loading