Fix return value for sync verification#204
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adjusts the CLI challenge verify exit code behavior to align with other operations (returning 0 on success) and fix an inconsistent return value in sync verification.
Changes:
- Update
ChallengeCommand.verify()to return0in the non-exception path (previously returned1).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ctfcli/cli/challenges.py
Outdated
| if len(challenges_out_of_sync) > 1: | ||
| return 2 | ||
|
|
||
| return 1 | ||
| return 0 |
There was a problem hiding this comment.
With this change, verify() will return 0 even when exactly one challenge is out of sync (because the only non-zero return is guarded by len(challenges_out_of_sync) > 1). That makes an out-of-sync verification indistinguishable from a fully-in-sync run for the common single-challenge case.
Consider returning 0 only when len(challenges_out_of_sync) == 0 and using the non-zero status (e.g., 2) for any out-of-sync count (> 0), while keeping 1 for exceptions/failures.
|
Your original code is right but I suspect the failed verifications code wouldn't always hit if the failed verification amount was only 1. |
The other operations return 0 on success. Verify returned 1 on both failure and success.