Page MenuHomePhabricator

Create service to generate snippets for the context header and content for calling a CoPE model
Closed, ResolvedPublic

Description

Summary

The content to be evaluated for a given content policy may be different, depending on how the structure of the content is described in the content policy text. We should though avoid code duplication and increase reliability by making a public service that allows each content policy definition to get snippets like the edit summary, diff of the revision, and lines added

Technical details

  • The service likely needs to allow fetching:
    • The lede of an article
    • The title of a page
    • The edit summary of a revision (though maybe we can just call the RevisionRecord method directly)
    • The unified diff of a revision compared to the parent revision
    • The added lines of a revision compared to the parent revision
    • The removed lines of a revision compared to the parent revision
  • The service may also want to include methods to stitch these parts together and return a unified content

Acceptance criteria

Event Timeline

Change #1312278 had a related patch set uploaded (by Kosta Harlan; author: Kosta Harlan):

[mediawiki/extensions/WikimediaAntiAbuse@master] Add RevisionSnippetGenerator service

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

The service may also want to include methods to stitch these parts together and return a unified content

IMO this should be done in private code.

Change #1312453 had a related patch set uploaded (by Kosta Harlan; author: Kosta Harlan):

[mediawiki/core@master] diff: Mark UnifiedDiffFormatter as stable to extend

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

Change #1312453 merged by jenkins-bot:

[mediawiki/core@master] diff: Mark UnifiedDiffFormatter as stable to extend

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

Change #1312278 merged by jenkins-bot:

[mediawiki/extensions/WikimediaAntiAbuse@master] Add RevisionSnippetGenerator service

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

Change #1313050 had a related patch set uploaded (by Dreamy Jazz; author: Dreamy Jazz):

[mediawiki/extensions/WikimediaAntiAbuse@master] Expand coverage for RevisionSnippetGenerator

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

Change #1313092 had a related patch set uploaded (by Kosta Harlan; author: Kosta Harlan):

[mediawiki/core@wmf/1.47.0-wmf.12] diff: Mark UnifiedDiffFormatter as stable to extend

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

Change #1313093 had a related patch set uploaded (by Kosta Harlan; author: Kosta Harlan):

[mediawiki/extensions/WikimediaAntiAbuse@wmf/1.47.0-wmf.12] Add RevisionSnippetGenerator service

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

Change #1313050 merged by jenkins-bot:

[mediawiki/extensions/WikimediaAntiAbuse@master] Expand coverage for RevisionSnippetGenerator

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

Change #1313092 merged by jenkins-bot:

[mediawiki/core@wmf/1.47.0-wmf.12] diff: Mark UnifiedDiffFormatter as stable to extend

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

Change #1313093 merged by jenkins-bot:

[mediawiki/extensions/WikimediaAntiAbuse@wmf/1.47.0-wmf.12] Add RevisionSnippetGenerator service

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

Mentioned in SAL (#wikimedia-operations) [2026-07-21T13:15:25Z] <kharlan@deploy2003> Started scap sync-world: Backport for [[gerrit:1313092|diff: Mark UnifiedDiffFormatter as stable to extend (T432457)]], [[gerrit:1313093|Add RevisionSnippetGenerator service (T432457)]]

Mentioned in SAL (#wikimedia-operations) [2026-07-21T13:17:24Z] <kharlan@deploy2003> kharlan: Backport for [[gerrit:1313092|diff: Mark UnifiedDiffFormatter as stable to extend (T432457)]], [[gerrit:1313093|Add RevisionSnippetGenerator service (T432457)]] synced to the testservers (see https://wikitech.wikimedia.org/wiki/Mwdebug). Changes can now be verified there.

Mentioned in SAL (#wikimedia-operations) [2026-07-21T13:23:14Z] <kharlan@deploy2003> Finished scap sync-world: Backport for [[gerrit:1313092|diff: Mark UnifiedDiffFormatter as stable to extend (T432457)]], [[gerrit:1313093|Add RevisionSnippetGenerator service (T432457)]] (duration: 07m 50s)

Service exists and appears to be working. Wider QA of the feature can be done through T431292: Tag revisions with private change tag for likely oversightable/revision deletable content