Repository navigation
sync,tests(fix): Stabilize worker sync tests and inspection - #617
Merged
Merged
Conversation
why: Post-timeout and post-interrupt recovery inspection spawned a fresh Python worker with a 1.0s deadline while importing the full CLI package, timing out under CPU or coverage load and dropping retained dirty: preserve recovery tokens. what: - Raise _INSPECTION_TIMEOUT_SECONDS from 1.0 to 5.0 in vcspull._internal.sync_process - Defer importing vcspull.cli.sync in sync_process._main() to sync operations so worktree and inspect workers load only _internal and validator modules - Add test_watchdog_inspection_tolerates_slow_worker_startup and raise the Subversion inspection test timeout to 5s - Update docs/cli/sync.md and CHANGES for the five-second deadline
why: test_sync_interrupt_stops_worker used a fixed 3s accept timeout, dropped --timeout 30 in worktree mode, and matched the first interrupted NDJSON event in parallel_main even when sibling_repo finished first, while test_hg_configured_remote_reaches_native_sync gave 16 sequential hg processes only 5s. what: - Poll the hook socket with selectors.DefaultSelector and process.poll() so crashed CLI children fail within 50ms while slow hosts get 20s startup and 15s shutdown budgets - Run hook.py with python -S, pass --timeout 30 to worktree sync, bound accepted hook socket reads to 5s, and select NDJSON events by target repository or worktree - Raise test_hg_configured_remote_reaches_native_sync worker timeout from 5s to 30s
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #617 +/- ##
==========================================
- Coverage 85.29% 85.25% -0.05%
==========================================
Files 38 38
Lines 7658 7663 +5
Branches 1566 1567 +1
==========================================
+ Hits 6532 6533 +1
- Misses 747 751 +4
Partials 379 379 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
why: 10s (_DEFAULT_REPO_TIMEOUT_SECONDS) clips 16 sequential hg startups on WSL2 (~10.9s), while 15s bounds the worker without a 30s ceiling. what: - Lower test_hg_configured_remote_reaches_native_sync worker timeout from 30s to 15s
This was referenced Dec 6, 2026
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.
Closes #616
Summary
sync_process.vcspull.cli.syncimports insync_process._main()tosyncworker runs.post-checkouthook connections withselectors.DefaultSelectorand child liveness checks intest_sync_interrupt_stops_worker.test_sync_interrupt_stops_worker.test_hg_configured_remote_reaches_native_syncworker deadline to 15 seconds across Mercurial updates.docs/cli/sync.mdandCHANGESfor the five-second recovery-inspection deadline.1. Owner and boundary
src/vcspull/_internal/sync_process.py, documented indocs/cli/sync.mdandCHANGES, alongside subprocess test coordination intests/cli/test_sync_sigint.py,tests/cli/test_sync_watchdog.py, andtests/test_sync.py.sync/async, CLI/API, single/batch, orN/A): Checked sequentialvcspull sync, parallelvcspull sync --jobs,vcspull sync --include-worktrees, standalonevcspull worktree sync, and directupdate_repovsrun_sync_processworker execution.vcspull._internal.sync_process, keeping"worktree"and"inspect"workers insidevcspull._internalandvcspull.validatorwithout pullingvcspull.clisubcommands into non-CLI-sync worker startups.2. Failure before the fix (
N/Afor docs, lockfile bumps, or pure refactors)<base>commit, or<pre_fix_head>SHA if fixing a defect introduced in this PR):cb7ac9euv run py.test tests/test_sync.py -k "test_hg_configured_remote_reaches_native_sync and True"failed withAssertionError: assert 'timed_out' == 'synced'(duration=5.39sacross 16 sequentialhgprocesses againsttimeout=5).uv run py.test tests/cli/test_sync_sigint.py -k test_sync_interrupt_stops_workerfailed intermittently withTimeoutError: timed outonserver.accept()(3sbudget across a multi-interpreter chain),AssertionError: assert 'not-started' == 'unknown'inparallel_mainwhensibling_repoemitted its interrupted event ahead ofgit_repo, and missingretained_recoveriesunder CPU contention whensync_process.run_sync_processtimed out at1.0simportingvcspull.cli.syncduring"inspect".3. Verification and tool disclosure
N/A):uv run ruff format .,uv run ruff check . --fix --show-fixes,uv run ty check --error-on-warning .(Python 3.11 and 3.15),just build-docs,PYTHON_COLORS=0 NO_COLOR=1 uv run sphinx-build -W -b dirhtml -d docs/_build/doctrees docs docs/_build/html,uv run python scripts/generate_schema.py --check,uv run --isolated --no-cache --no-dev --no-editable --frozen python scripts/runtime_dep_smoketest.py, fulluv run py.test, two 16-worker CPU-contention stress runs, and the production-only revert check (BITE_TEST="tests/cli/test_sync_watchdog.py::test_watchdog_inspection_tolerates_slow_worker_startup"failing oncb7ac9ewithAssertionError: assert () == (SyncResult(...),))..github/workarounds.tomlupdates (Noneif none):None/spike-ratchet, drafted the changes, and ran the local lint, typecheck, documentation, production-revert test-bite, CPU-contention, and pytest gates.Test plan
test_watchdog_inspection_tolerates_slow_worker_startupfails whensrc/vcspull/_internal/sync_process.pyis reverted toorigin/masterand passes with the fix_accept_hook_connectionfails within 50 ms withreturncode,stdout, andstderrwhen a CLI child exits before connecting to the hook sockettests/cli/test_sync_sigint.pyandtest_hg_configured_remote_reaches_native_syncpass repeatedly under 16-process CPU contentionuv run py.test,ruff,ty(Python 3.11 and 3.15), strict Sphinx build (-W), and isolatedscripts/runtime_dep_smoketest.pypass locallycheck-workaroundsin GitHub Actions