Skip to content

Improve error messaging and string formatting consistency #1

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

Open
wants to merge 4 commits into
base: subprocess
Choose a base branch
from

Conversation

Zsailer
Copy link

@Zsailer Zsailer commented Jul 22, 2025

Summary

  • Replace f-strings in logging calls with proper % formatting for lazy evaluation
  • Add more specific error messages including PID for credential daemon cleanup for better debugging
  • Improve git command failure logging with more descriptive messages
  • Include timeout error details in warning logs

Changes Made

  • Fixed logging practices: Replaced f-strings in logging calls with % formatting to follow Python logging best practices
  • Enhanced credential daemon cleanup logging: Include process PID for better debugging
  • Improved generic git command failure message: More descriptive error messages
  • Added timeout error details: Include specific timeout information in warning logs

Why These Changes Matter

  • Performance: % formatting in logging is only evaluated if the message will actually be logged, unlike f-strings which are evaluated eagerly
  • Error handling: Prevents potential errors if expressions in logging statements fail
  • Best practices: Follows Python logging conventions for lazy evaluation
  • Debugging: More informative error messages with specific details like process PIDs

Test Plan

  • Verify timeout scenarios still work correctly
  • Check that error messages are more informative during debugging
  • Ensure credential daemon cleanup logging provides useful information
  • Confirm logging performance improvements with lazy evaluation

Neha Singla and others added 4 commits July 16, 2025 13:00
- Add timeout to subprocess.communicate() to prevent indefinite hanging
- Fix pexpect timeout from None to use actual timeout parameter
- Add proper process cleanup with graceful termination → wait → force kill
- Improve credential cache daemon cleanup with timeout handling
- Add comprehensive error handling for timeout scenarios
- Ensure all subprocess exceptions properly clean up processes

Fixes issue where git subprocesses could accumulate and consume system resources
when commands hang due to network issues or authentication problem
- Use f-strings consistently throughout timeout error handling
- Add more specific error messages including PID for credential daemon cleanup
- Improve git command failure logging with more descriptive messages
- Include timeout error details in warning logs for better debugging

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Replace f-strings in logging calls with % formatting for lazy evaluation
- Prevents eager evaluation of expressions in logging statements
- Follows Python logging best practices for performance and error handling
- Maintains same informative error messages with proper logging patterns

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Extract subprocess functions to module level with proper timeout handling
- Add timeout parameter to call_subprocess_with_authentication
- Implement graceful termination (terminate → wait → kill) for subprocess timeouts
- Add comprehensive test suite for timeout scenarios and process cleanup
- Improve credential daemon cleanup with proper timeout handling
- Ensure proper logging with lazy evaluation for all timeout scenarios

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@Zsailer Zsailer force-pushed the subprocess-improvements branch from 38a301a to aacce32 Compare July 23, 2025 00:12
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