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
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
<ref></ref>tags with content<ref></ref>tags<ref />tags2. External Link Domain Verification
When a reference contains external links:
exturlusage()function for domain checkingDocumentation:
3. Auto-Approval Logic
Auto-approve when:
Require manual review when:
Implementation Notes
<ref></ref>tags<ref />and standard<ref></ref>tags<ref name="..."><ref group="...">Write unit tests covering:
Acceptance Criteria