feature/approval-utility-function-v2 - #107
Open
Teja-Sri-Surya wants to merge 31 commits into
Open
Conversation
- Add revert detection check to autoreview system - Implement @zache-fi's Superset approach for finding reviewed revisions - Add change_tag_params to Superset query for revert detection - Add comprehensive tests for revert detection functionality - Add ENABLE_REVERT_DETECTION configuration setting - Parse change tag parameters to extract reverted revision IDs - Query MediaWiki database for previously reviewed content by SHA1 Fixes Wikimedia-Suomi#3 - Add check for already-reviewed reverted edits
- Implement approve_revision() utility function with pywikibot API integration - Add PENDING_CHANGES_DRY_RUN setting for safe testing - Create Django management command test_pending_changes_review - Add comprehensive unit tests (12 test cases) - Implement dry-run mode with Merkityt_versiot_-kokeilu/* namespace check - Add proper error handling and logging - Support for approve/unapprove operations with custom values Fixes Wikimedia-Suomi#106
- Fixed settings.py conflict by combining revert detection, pending changes dry-run, and ORES settings - Removed old autoreview.py file (replaced by directory structure in PR Wikimedia-Suomi#96) - Fixed wiki_client.py conflict by keeping statistics functionality - All conflicts resolved and PR Wikimedia-Suomi#107 should now be ready for review This resolves the same conflicts as PR Wikimedia-Suomi#108 but for the approval utility function.
Contributor
Author
✅ Merge Conflicts Resolved!Hi @zache-fi! I've successfully resolved all merge conflicts with the latest main branch. What Was Fixed:
Changes Made:
Current Status:
The PR now includes:
Ready for final review! 🚀 |
Contributor
Author
|
Hi @zache-fi , @ademolaomosanya Please review this PR. It implements a utility function for approving/unapproving pending changes revisions with pywikibot API integration, dry-run mode support, and 12 comprehensive unit tests. All components are tested and ready for review. |
…cleanups, suppress S608 with validated ids)
…sible by integration')
…tection (fix E501/W293)
…d wrapper _check_revert_detection
…ion; attach dynamically
…h, sha1, wikitext)
…uery and _find_reviewed_revisions_by_sha1)
- Move all imports above module docstring in revert_detection.py - Module docstring should be after imports, not before - Satisfies E402 (module level import not at top of file) Fixes CI lint failures in PR Wikimedia-Suomi#107
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR implements a comprehensive utility function for approving/unapproving pending changes revisions using pywikibot's SimpleRequest API, with dry-run mode support and a Django management command for testing.
Changes Made
✅ Core Implementation
approve_revision()utility function - Complete API integration with pywikibotMerkityt_versiot_-kokeilu/*namespace checkPENDING_CHANGES_DRY_RUNsetting for environment controltest_pending_changes_reviewfor testing✅ Safety Features
Merkityt_versiot_-kokeilu/*pages even in dry-run mode✅ Testing
Technical Details
API Integration
pywikibot.data.api.Request(SimpleRequest) for MediaWiki FlaggedRevs APIaction=reviewendpoint with proper authenticationDry-Run Logic
Management Command Usage
Files Added/Modified
New Files
app/reviews/utils/approval.py- Core utility functionapp/reviews/management/commands/test_pending_changes_review.py- Management commandapp/reviews/tests/test_approval.py- Comprehensive test suiteapp/reviews/utils/__init__.py- Utils packageapp/reviews/management/__init__.py- Management packageapp/reviews/management/commands/__init__.py- Commands packageModified Files
app/reviewer/settings.py- AddedPENDING_CHANGES_DRY_RUNsettingTesting
Unit Tests (12 test cases)
Management Command Testing
Configuration
Environment Variables
Settings
Acceptance Criteria Met
approve_revision()successfully approves revisions using pywikibot's APIunapproveparameter correctly unapproves revisions when set to TrueMerkityt_versiot_-kokeilu/*pages are processed even in dry-run modeFuture Integration
This utility function is designed to be moved to the Pywikibot codebase in the future, as mentioned in the issue description. The current implementation provides a solid foundation for that transition.
Related