-
Notifications
You must be signed in to change notification settings - Fork 0
Respect instance whitelist when determining blacklist status #104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- Modified getInstance, getActivities, and getInstances to check is_whitelisted - Whitelisted instances are never marked as blacklisted, even if they have a blacklist entry - Added test for instance 16707634209 to verify whitelist behavior
- Added test in history.test.ts to verify whitelisted instances are not blacklisted - Added test in instances.test.ts to verify whitelisted instances are not blacklisted - Both tests use instance 16707634209 to verify the whitelist behavior
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR modifies the blacklist logic to respect instance whitelist status. When an instance has is_whitelisted set to true, it will no longer be marked as blacklisted, even if a blacklist entry exists for it.
Key Changes:
- Updated SQL queries in three service functions to check
is_whitelistedbefore marking instances as blacklisted - The new logic:
(b.instance_id IS NOT NULL AND NOT instance.is_whitelisted) AS "isBlacklisted" - Added a test case for
getInstanceto verify that whitelisted instances returnisBlacklisted: false
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| src/services/instance/instance.ts | Modified getInstance query to exclude whitelisted instances from blacklist status |
| src/services/player-instances/history.ts | Modified getActivities query to exclude whitelisted instances from blacklist status |
| src/services/player-instances/instances.ts | Modified getInstances query to exclude whitelisted instances from blacklist status |
| src/services/instance/instance.test.ts | Added test case to verify whitelisted instances are not marked as blacklisted |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/services/instance/instance.ts
Outdated
| CASE WHEN av.is_contest_eligible THEN date_completed < COALESCE(contest_end, TIMESTAMP 'epoch') ELSE false END AS "isContest", | ||
| date_completed < COALESCE(week_one_end, TIMESTAMP 'epoch') AS "isWeekOne", | ||
| b.instance_id IS NOT NULL AS "isBlacklisted" | ||
| (b.instance_id IS NOT NULL AND NOT instance.is_whitelisted) AS "isBlacklisted" |
Copilot
AI
Jan 2, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The expression NOT instance.is_whitelisted may not handle NULL values as expected. In SQL, NOT NULL evaluates to NULL (not FALSE), which could cause instances with NULL is_whitelisted values to be excluded from the blacklist when they should be included. Consider using COALESCE(instance.is_whitelisted, false) to treat NULL as false, ensuring the logic works as: (b.instance_id IS NOT NULL AND NOT COALESCE(instance.is_whitelisted, false))
| (b.instance_id IS NOT NULL AND NOT instance.is_whitelisted) AS "isBlacklisted" | |
| (b.instance_id IS NOT NULL AND NOT COALESCE(instance.is_whitelisted, false)) AS "isBlacklisted" |
| CASE WHEN av.is_contest_eligible THEN date_completed < COALESCE(contest_end, TIMESTAMP 'epoch') ELSE false END AS "isContest", | ||
| date_completed < COALESCE(week_one_end, TIMESTAMP 'epoch') AS "isWeekOne", | ||
| bi.instance_id IS NOT NULL AS "isBlacklisted", | ||
| (bi.instance_id IS NOT NULL AND NOT instance.is_whitelisted) AS "isBlacklisted", |
Copilot
AI
Jan 2, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The expression NOT instance.is_whitelisted may not handle NULL values as expected. In SQL, NOT NULL evaluates to NULL (not FALSE), which could cause instances with NULL is_whitelisted values to be excluded from the blacklist when they should be included. Consider using COALESCE(instance.is_whitelisted, false) to treat NULL as false, ensuring the logic works as: (bi.instance_id IS NOT NULL AND NOT COALESCE(instance.is_whitelisted, false))
| (bi.instance_id IS NOT NULL AND NOT instance.is_whitelisted) AS "isBlacklisted", | |
| (bi.instance_id IS NOT NULL AND NOT COALESCE(instance.is_whitelisted, false)) AS "isBlacklisted", |
| CASE WHEN av.is_contest_eligible THEN date_completed < COALESCE(contest_end, TIMESTAMP 'epoch') ELSE false END AS "isContest", | ||
| date_completed < COALESCE(week_one_end, TIMESTAMP 'epoch') AS "isWeekOne", | ||
| b.instance_id IS NOT NULL AS "isBlacklisted", | ||
| (b.instance_id IS NOT NULL AND NOT instance.is_whitelisted) AS "isBlacklisted", |
Copilot
AI
Jan 2, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The expression NOT instance.is_whitelisted may not handle NULL values as expected. In SQL, NOT NULL evaluates to NULL (not FALSE), which could cause instances with NULL is_whitelisted values to be excluded from the blacklist when they should be included. Consider using COALESCE(instance.is_whitelisted, false) to treat NULL as false, ensuring the logic works as: (b.instance_id IS NOT NULL AND NOT COALESCE(instance.is_whitelisted, false))
| (b.instance_id IS NOT NULL AND NOT instance.is_whitelisted) AS "isBlacklisted", | |
| (b.instance_id IS NOT NULL AND NOT COALESCE(instance.is_whitelisted, false)) AS "isBlacklisted", |
| CASE WHEN av.is_contest_eligible THEN date_completed < COALESCE(contest_end, TIMESTAMP 'epoch') ELSE false END AS "isContest", | ||
| date_completed < COALESCE(week_one_end, TIMESTAMP 'epoch') AS "isWeekOne", | ||
| bi.instance_id IS NOT NULL AS "isBlacklisted", | ||
| (bi.instance_id IS NOT NULL AND NOT instance.is_whitelisted) AS "isBlacklisted", |
Copilot
AI
Jan 2, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The whitelist behavior change should be tested in the getActivities function as well, similar to the test added for getInstance. This ensures that whitelisted instances are not marked as blacklisted when retrieved through player activity history.
| CASE WHEN av.is_contest_eligible THEN date_completed < COALESCE(contest_end, TIMESTAMP 'epoch') ELSE false END AS "isContest", | ||
| date_completed < COALESCE(week_one_end, TIMESTAMP 'epoch') AS "isWeekOne", | ||
| b.instance_id IS NOT NULL AS "isBlacklisted", | ||
| (b.instance_id IS NOT NULL AND NOT instance.is_whitelisted) AS "isBlacklisted", |
Copilot
AI
Jan 2, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The whitelist behavior change should be tested in the getInstances function as well, similar to the test added for getInstance. This ensures that whitelisted instances are not marked as blacklisted when retrieved through player instance queries.
- Use COALESCE to treat NULL is_whitelisted as false - Prevents NULL values from causing incorrect blacklist status - Updated getInstance, getActivities, and getInstances queries
This PR modifies the blacklist logic to respect the instance whitelist flag. When an instance has
is_whitelistedset to true, it will never be marked as blacklisted, even if there's a blacklist entry.Changes
getInstance,getActivities, andgetInstancesto checkis_whitelistedbefore marking an instance as blacklisted(b.instance_id IS NOT NULL AND NOT instance.is_whitelisted) AS "isBlacklisted"Testing