Skip to content

tests(fix[sync]): Default VCSPULL_SYNC_TIMEOUT_SECONDS=30 in pytest - #618

Merged
tony merged 1 commit into
masterfrom
tests/hg-sync-test-timeout-env
Dec 6, 2026
Merged

tony merged 1 commit into
masterfrom
tests/hg-sync-test-timeout-env

Conversation

@tony

@tony tony commented Dec 6, 2026

Copy link
Copy Markdown
Member

Refs #616

Summary

  • Default VCSPULL_SYNC_TIMEOUT_SECONDS=30 in tests/conftest.py alongside VCSPULL_JOBS=1 when unset in the caller environment.
  • Route test_hg_configured_remote_reaches_native_sync through _resolve_repo_timeout(None) instead of a hardcoded literal timeout.
  • Seed upstream in test_hg_configured_remote_reaches_native_sync with shutil.copytree and hg commit -A to drop redundant setup hg spawns.

1. Owner and boundary

  • Rule changed and module that owns it: Pytest default environment setup in tests/conftest.py and Mercurial remote worker test setup in tests/test_sync.py.
  • Sibling entry points checked (sync/async, CLI/API, single/batch, or N/A): Checked _resolve_repo_timeout precedence tests in tests/cli/test_sync_watchdog.py, CLI vcspull sync Mercurial error tests in tests/test_cli.py, and direct run_sync_process worker tests in tests/test_sync.py.
  • Why this belongs here (owner fix, boundary adapter, or single-PR ownership transfer): Keeps production _DEFAULT_REPO_TIMEOUT_SECONDS = 10 unchanged while giving pytest CLI and worker Mercurial tests (which spawn 10–16 sequential hg Python interpreters per HgSync.update_repo() call) sufficient scheduler headroom on heavily contended workstations (load average 50–80).

2. Failure before the fix (N/A for docs, lockfile bumps, or pure refactors)

  • Baseline (<base> commit, or <pre_fix_head> SHA if fixing a defect introduced in this PR): d83187e
  • Failing input or command and observed failure before the fix: Under heavy host CPU contention (load average: 65–79), full-suite uv run py.test timed out on tests/test_cli.py::test_sync_errored_hg_repo[hg-deleted-remote-shows-failed] (11.1s vs 10s CLI default across 10 hg calls) and tests/test_sync.py::test_hg_configured_remote_reaches_native_sync[True] (16.09s vs 15s across 16 hg calls).

3. Verification and tool disclosure

  • Gates run (plus production-only revert check for behavioral fixes, or 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), and uv run py.test tests/cli/test_sync_watchdog.py tests/cli/test_sync_sigint.py tests/test_cli.py tests/test_sync.py (N/A for production revert check; test-only change).
  • .github/workarounds.toml updates (None if none): None
  • Tool use: Antigravity (Gemini) profiled /usr/bin/hg and host runqueue contention (uptime / cProfile), updated tests/conftest.py and tests/test_sync.py, and verified lint, ty, and pytest gates.

Test plan

  • _resolve_repo_timeout unit and doctest checks continue to verify CLI flag, VCSPULL_SYNC_TIMEOUT_SECONDS, and 10s default precedence
  • test_sync_errored_hg_repo and test_hg_configured_remote_reaches_native_sync pass under heavy host load without hardcoded test literals
  • Full Python 3.11 / 3.15 matrix in GitHub Actions

why: On heavily contended hosts (load average 50-80), libvcs's 10-16
sequential hg Python spawns per HgSync.update_repo() call exceed both
the 10s CLI default in test_sync_errored_hg_repo and the 15s literal in
test_hg_configured_remote_reaches_native_sync.

what:
- Default VCSPULL_SYNC_TIMEOUT_SECONDS=30 alongside VCSPULL_JOBS=1 in
  tests/conftest.py when unset in the caller environment
- Route test_hg_configured_remote_reaches_native_sync through
  _resolve_repo_timeout(None) instead of a hardcoded literal
- Seed upstream in test_hg_configured_remote_reaches_native_sync with
  shutil.copytree and hg commit -A to drop redundant setup hg spawns
@codecov

codecov Bot commented Dec 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.25%. Comparing base (d83187e) to head (d048879).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #618   +/-   ##
=======================================
  Coverage   85.25%   85.25%           
=======================================
  Files          38       38           
  Lines        7663     7663           
  Branches     1567     1567           
=======================================
  Hits         6533     6533           
  Misses        751      751           
  Partials      379      379           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@tony
tony merged commit a4b2161 into master Dec 6, 2026
9 checks passed
@tony tony mentioned this pull request Dec 6, 2026
24 of 37 tasks
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