-
Notifications
You must be signed in to change notification settings - Fork 11
Sync progress flushes #492
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: master
Are you sure you want to change the base?
Conversation
Reviewer's GuideThis PR inserts explanatory comments in run.py detailing why Git’s progress output uses new lines when stderr isn’t a TTY (and why switching to a pseudo-TTY would require deeper subprocess changes), and it scaffolds a new test file stub for run.py. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
) | ||
|
||
# Verify we got multiple chunks | ||
assert len(captured_chunks) > 0, "Should receive progress chunks" |
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.
issue (code-quality): Simplify sequence length comparison (simplify-len-comparison
)
) | ||
|
||
# Check that output is fragmented | ||
assert len(captured_chunks) > 0, "Should capture output" |
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.
suggestion (code-quality): Simplify sequence length comparison (simplify-len-comparison
)
assert len(captured_chunks) > 0, "Should capture output" | |
assert captured_chunks, "Should capture output" |
|
||
# In current implementation, all stderr is read in one chunk | ||
# This demonstrates the buffering issue | ||
assert len(captured_chunks) >= 1, "Should get at least 1 chunk" |
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.
suggestion (code-quality): Simplify sequence length comparison (simplify-len-comparison
)
assert len(captured_chunks) >= 1, "Should get at least 1 chunk" | |
assert captured_chunks, "Should get at least 1 chunk" |
# Desired behavior: each complete line is one chunk | ||
|
||
# For now, just verify we got output | ||
assert len(captured_chunks) > 0, "Should capture output" |
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.
suggestion (code-quality): Simplify sequence length comparison (simplify-len-comparison
)
assert len(captured_chunks) > 0, "Should capture output" | |
assert captured_chunks, "Should capture output" |
tests/_internal/test_run.py
Outdated
"Output should be fragmented into multiple chunks" | ||
) | ||
|
||
assert len(captured_chunks) > 0 |
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.
issue (code-quality): Simplify sequence length comparison (simplify-len-comparison
)
b505738
to
b0b3cab
Compare
…ate broken state)
… behavior - Add TestFlushingBehavior class with tests for: - Timing verification of immediate flushing - Unbuffered subprocess output handling - Carriage return overwrites for progress bars - ANSI escape sequence preservation - Git-style progress simulation - Mixed line endings (\n, \r, \r\n) - Large output streaming without blocking - stderr vs stdout stream separation - Add TestRealWorldScenarios class covering: - npm-style progress with Unicode spinners - Long-running processes with periodic updates - Multi-line progress bars (Docker-style) - Binary/Unicode output handling - Interleaved stdout/stderr timing - Add TestEdgeCases class for: - Empty output handling - stdout-only processes - Very long lines exceeding buffer size - Rapid output bursts - Callback exception handling - Enhance existing tests with better type annotations - Fix linting issues (imports, line length, docstrings) - Follow libvcs testing conventions and patterns These tests verify the current behavior of the run() function's real-time output streaming via callbacks, including the 128-byte chunking behavior and proper handling of control characters. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
b0b3cab
to
4f85cd7
Compare
…e progress updates why: Commit 80b480e switched to text=True which interfered with carriage return handling, causing git progress output to appear on separate lines instead of overwriting the same line. what: - Revert subprocess to text=False (bytes mode) - Restore console_to_str() function for proper bytes-to-string conversion 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
… of broken fragmentation why: Previous tests were verifying the broken 128-byte fragmentation behavior. With the fix, we need tests that verify proper in-place progress streaming. what: - Update existing tests to verify correct behavior instead of broken fragmentation - Add comprehensive TestStreamingFix class with tests for: * Line-by-line streaming without fragmentation * Real-time streaming with timing verification * Proper handling of long lines without breaking them 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
why: Fix mypy type errors and improve type safety in subprocess handling. what: - Add type annotations for lines and stderr_lines variables - Add null checks for proc.stdout and proc.stderr before accessing readlines() - Update ProgressCallbackProtocol to use str instead of t.AnyStr for consistency 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
…ations why: Comply with 88-character line length limit for linting requirements. what: - Split long assert statement across multiple lines in line 438 - Break long string literal across multiple lines in line 965 - Update CallbackOutput type alias from t.AnyStr to str for consistency 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Summary by Sourcery
Document TTY limitation for git progress output and introduce tests for the run module
Enhancements:
Tests: