Skip to content

Add Check for Reference-Only Changes #24

Description

@zache-fi

Implement an edit check that detects when a user has only added or modified references (content within <ref></ref> tags) without making any other changes to the article content.

Requirements

1. Reference-Only Detection

  • Detect edits where the only changes are:
    • Adding new <ref></ref> tags with content
    • Modifying existing content within <ref></ref> tags
    • Adding or modifying self closed <ref /> tags
  • No other text or content outside references should be changed

2. External Link Domain Verification

When a reference contains external links:

  • Extract all domains from URLs in the added/modified references
  • Check if each domain has been previously used in Wikipedia articles (namespace=0)
  • Use Pywikibot's exturlusage() function for domain checking

Documentation:

3. Auto-Approval Logic

Auto-approve when:

  • ✅ Edit only adds/modifies references

Require manual review when:

  • ✅ Edit only removes references (it is OK if it replaces one reference with another)

Implementation Notes

  • Parse the diff to isolate changes within <ref></ref> tags
  • Handle both self-closing <ref /> and standard <ref></ref> tags
  • Refs can have name and group attributes: <ref name="..."> <ref group="...">
  • There should be also SPAM link check for added URL:s but i will create separate issue ticket for this

Write unit tests covering:

  • Adding a single reference
  • Modifying an existing reference
  • Adding multiple references
  • Modifying multiple references
  • Removing a reference (should not approve)
  • Mixed edits with references and other content changes (should not approve)
  • Adding self-closing reference tags
  • References with name and group attributes

Acceptance Criteria

  • Bot correctly identifies reference-only edits
  • There is unit tests for the change

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions