Skip to content

Conversation

@Derb237
Copy link

@Derb237 Derb237 commented Oct 24, 2025

Summary

Fixed two bugs in the request error handling that caused misleading debug messages when debug mode was enabled.

Issues Fixed

1. Typo in variable name (Line 153)

  • Before: fail_reason = 'Mission already claimed'
  • After: reason_failed = 'Mission already claimed'
  • The variable fail_reason was never used, causing the message to never be logged correctly

2. Unconditional debug log (Line 168)

  • Before: Debug log executed for every HTTP request regardless of status
  • After: Only logs terminal failures (HTTP 400, 401, 403, 412)
  • This caused "MISSION ALREADY CLAIMED" to appear for successful requests (200 OK), authentication flows, profile requests, etc.

Impact

When debug=True was set, users would see confusing "MISSION ALREADY CLAIMED" messages for every single HTTP request, even ones completely unrelated to missions.

Example - Before fix:

2025-10-24 07:57:42 -- NETWORK REQUEST
	401 -- GET -- https://platform.synack.com/api/profiles/me
2025-10-24 07:57:42 -- MISSION ALREADY CLAIMED
	(401 - Unauthorized) https://platform.synack.com/api/profiles/me

After fix:

2025-10-24 08:06:50 -- NETWORK REQUEST
	200 -- GET -- https://platform.synack.com/api/profiles/me
[no spurious mission message]

Now "Mission already claimed" only appears for actual HTTP 412 responses.

Root Cause

Bug was introduced in commit c406ca9 (March 2, 2025) during refactoring of error handling code.

Testing

Tested with debug=True using synack_check_target.py - confirmed spurious messages are gone and only appropriate errors are logged.

@Derb237 Derb237 changed the base branch from main to wip-2025 October 24, 2025 08:16
Fixed two bugs in the request error handling:

1. Line 153: Fixed typo where 'fail_reason' was set instead of 'reason_failed'
   for HTTP 412 status codes

2. Line 168: Moved unconditional debug log into a conditional that only
   logs terminal failures (400, 401, 403, 412)

Previously, when debug mode was enabled, every HTTP request would log
'MISSION ALREADY CLAIMED' regardless of the actual status code or context.
This was caused by an unconditional debug.log() call that always executed.

Now, 'Mission already claimed' only appears for actual HTTP 412 errors.

Bug introduced in commit c406ca9 (March 2, 2025)
@Derb237 Derb237 force-pushed the fix/debug-logging-spurious-messages branch from 85fb6ab to 53a5be7 Compare October 24, 2025 08:19
@Derb237
Copy link
Author

Derb237 commented Nov 6, 2025

Superseded by enhanced fix in PR #20

@Derb237 Derb237 closed this Nov 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant