Add a test data mode that allows fetching pending changes based on a configurable list of revision IDs instead of real flagged pages data.
Story
Currently, PendingChangesBot queries real flagged pages from the database. For testing and development purposes, we need the ability to simulate pending changes scenarios using specific revision IDs without test data going away when edits are reviewed.
Task
Configuration UI Updates
- Add a new configuration section for test data mode
- Provide input field/area for entering comma-separated revision IDs
- Add toggle/checkbox to switch between:
- Production mode: Use real flaggedrevs data
- Test mode: Use specified revision IDs
Database query updates in app/reviews/services.py: fetch_pending_pages()
- Production data mode (current): Keep as is
- Test mode (new):
Make following modification to the query (full query in Quarry 97856
... FROM (SELECT rev_page AS fp_page_id,
rev_id AS fp_stable,
20250901000000 AS fp_pending_since
FROM revision
WHERE rev_id IN ({revision_ids})) AS fp, ...Query Parameters:
- revision_ids: Comma-separated list from config (e.g., 22754221, 22754222, 22754223). Make input validation for the input so that it allows only integers, commans and spaces.
- fp_pending_since: Use fixed timestamp 20250901000000 for test cases
Testing Scenarios
-Test Mode with Valid Revision IDs
- Configure test mode with a known revision IDs
- Verify pending changes are returned for that revision
- Production Mode Unchanged
- Disable test mode
- Verify bot operates normally with real flagged pages
- Invalid Revision ID Handling
- Enter non-existent revision ID
- Verify graceful handling (empty result or clear error)
- Invalid input handling
- Enter incorrect input. ie something else than integers, commas and spaces.
- Verify graceful error handling (empty result or clear error)
- Mode Switching
- Switch between test and production modes
- Verify correct data source is used each time