Repository navigation
Conversation
why: Add real POSIX PTY and VT500 state-machine fixtures for testing controlling-terminal prompts and carriage-return progress output on Python 3.12+. what: - Add libvt[pytest]>=0.0.1a5,<0.1 with python_version >= '3.12' marker to dev and testing dependency groups - Exempt libvt from uv exclude-newer cooldown - Allow unresolved libvt imports in ty when checking Python 3.11 - Refresh uv.lock
why: Prevent unattended Git subprocesses from blocking on /dev/tty when HTTPS remotes return 401 Unauthorized, and stop ANSI SGR sequences from polluting parsed branch, reflog, and stash fields under color.ui=always. what: - Default GIT_TERMINAL_PROMPT=0 in Git.run() unless already set in env or os.environ - Pass --no-color in GitBranchManager._ls(), GitReflogManager._ls(), and GitStashManager._ls() - Add libvt PTY 401 tests and color.ui=always parser regression tests Fixes #568
why: Multi-byte UTF-8 characters split across 128-byte stderr pipe reads were decoded independently and corrupted into \xNN escapes in ProgressCallback, while GitSync.update_repo() and GitSync.create_worktree() omitted --progress and Git.fetch() dropped log_in_real_time. what: - Decode stderr callback chunks with an incremental decoder and flush any incomplete trailing bytes at EOF via backslashreplace - Forward log_in_real_time in Git.fetch() - Pass progress=True and log_in_real_time=True to fetch in GitSync.update_repo() and GitSync.create_worktree() when progress_callback is set - Document both fixes in CHANGES and add VT500 and sync regression tests Fixes #569
Merging this PR will not alter performance1 warning
Comparing |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #570 +/- ##
==========================================
+ Coverage 73.14% 73.84% +0.69%
==========================================
Files 54 55 +1
Lines 12348 12793 +445
Branches 1761 1790 +29
==========================================
+ Hits 9032 9447 +415
- Misses 2486 2511 +25
- Partials 830 835 +5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
why: Copying os.environ into a new Python dict on every Git.run() call forced subprocess.Popen to fsencode every host environment variable in Python even on headless runners without a controlling /dev/tty, adding ~3.7ms of CPU instructions to GitSync.obtain() in CodSpeed simulation. what: - Cache controlling /dev/tty detection per PID in _has_controlling_tty() so headless callers keep env=None on subprocess.Popen, and use os.environb on POSIX when a controlling TTY is present - Cache codecs.getincrementaldecoder lookups and instantiate the incremental stderr decoder lazily on the first non-empty stderr chunk
why: Pin terminal screen, cursor, soft-wrap, and SGR style spans for PTY 401 failures, CR progress overwrites, and split UTF-8 stderr chunks so regressions in stream framing or coloring fail visibly. what: - Add libvt[pytest,syrupy] and syrupy>=7.0.3 for Python 3.12+ test groups and allow unresolved syrupy imports in ty - Snapshot 401 GitSync.obtain() and update_repo() PTY error screens with port and path scrubbing - Snapshot clone/fetch CR progress transitions, diffs, and SGR spans - Snapshot 128-byte split UTF-8 CJK progress and backslashreplace lines
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #568
Fixes #569
Summary
GIT_TERMINAL_PROMPT=0inGit.run().GitBranchManager,GitReflogManager, andGitStashManagerundercolor.ui=always.stderrchunks inrun()using an incremental decoder.git fetchupdates by streaming--progressinGitSync.update_repo()andGitSync.create_worktree().libvt[pytest,syrupy]PTY, VT500 terminal, and.ambrscreen/SGR snapshot tests on Python 3.12+.Changes by area
Git commands and sync
src/libvcs/cmd/git.py: defaultGIT_TERMINAL_PROMPT=0unless already configured, pass--no-colorin branch, reflog, and stash list parsers, and forwardlog_in_real_timeinGit.fetch().src/libvcs/sync/git.py: passprogress=Trueandlog_in_real_time=Truetofetch()inGitSync.update_repo()andGitSync.create_worktree()whenprogress_callbackis set.Subprocess runner
src/libvcs/_internal/run.py: decodestderrcallback chunks incrementally withbackslashreplaceerror handling, including trailing incomplete sequences at EOF.Dependencies, tests, and changelog
pyproject.toml,uv.lock: addlibvt[pytest,syrupy]>=0.0.1a5,<0.1andsyrupy>=7.0.3for Python 3.12+ test environments and allow unresolvedlibvtandsyrupyimports whentytargets Python 3.11.tests/sync/test_vt_subprocess.py,tests/sync/__snapshots__/test_vt_subprocess.ambr,tests/cmd/test_git.py,tests/_internal/test_run.py,tests/sync/test_git.py: cover isolated PTY401handling,color.ui=alwayslist parsing, multi-byte UTF-8 boundary progress inlibvt,GitSyncfetch progress streaming, and boxed.ambrscreen + SGR snapshots for PTY401errors,\rprogress transitions/diffs, and split CJK/backslashreplacediagnostics.CHANGES: document both fixes under the unreleased section.Test plan
tytargeting Python 3.11 and Python 3.15pytest-xdist-n 2 --dist worksteal) includinglibvtPTY, VT500, and.ambrsnapshot tests (test_git_tty_401_fails_fast_without_credential_prompt,test_git_tty_401_error_screen_snapshot,test_git_clone_and_update_progress_transition_snapshot,test_run_utf8_cjk_progress_and_backslashreplace_snapshot,test_run_utf8_boundary_progress_overwrites_in_vt_terminal,test_git_clone_color_ui_always_progress_renders_in_vt_terminal)libvt/syrupymarker skip and non-VT regression tests (test_git_run_disables_terminal_prompt_by_default,test_git_parsers_strip_ansi_when_color_ui_always,test_run_callback_reassembles_utf8_across_read_boundary,test_update_repo_and_create_worktree_stream_fetch_progress)just build-docs