Ensure autoreview refreshes pending pages and validates new link domains#67
Open
Dhie-boop wants to merge 8 commits into
Open
Ensure autoreview refreshes pending pages and validates new link domains#67Dhie-boop wants to merge 8 commits into
Dhie-boop wants to merge 8 commits into
Conversation
zache-fi
requested changes
Oct 13, 2025
| raise RuntimeError("Site reference expired; cache needs refresh") | ||
|
|
||
| try: | ||
| results = site.exturlusage(domain, total=1, namespaces=[0]) |
Contributor
There was a problem hiding this comment.
Same as in pull request #46 earlier, as we are checking the links after the page is saved the database contain the added link so we need to check if there is least 2 links ( our own link + 1 more )
Contributor
|
also same as 46, the |
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.
Fix #66
that:
Uses Pywikibot to fetch the latest revision ID for the page.
Returns immediately if the cached revision matches.
When it finds a newer revision, calls a new helper (_refresh_page_from_superset) to query Superset for that single page and rebuilds PendingPage / [PendingRevision] (https://github.com/Wikimedia-Suomi/PendingChangesBot-ng/blob/main/app/reviews/models.py) records from the payload.
_refresh_page_from_superset reuses the existing Superset query code path but scopes the results to just the target page, leaving other cached data intact.
Updated api_autoreview view to use the helper and 404 when the page isn’t pending anymore.
Introduced [WikiClient_fetch_latest_revision_id] (https://github.com/Wikimedia-Suomi/PendingChangesBot-ng/blob/main/app/reviews/services.py ) to encapsulate the Pywikibot call.
Strengthened run_autoreview_for_page by adding an external-link domain check backed by a new LRU cache module check_domains The check rejects auto-approvals if new links point to domains the wiki has never used, aligning with “only auto-review familiar external sources” logic.