Skip to content

test(coverage): expand test suite coverage to 80% and harden error boundaries - #79

Merged
JacksonFergusonDev merged 6 commits into
mainfrom
test/expand-test-coverage-and-robustness
Aug 22, 2026
Merged

test(coverage): expand test suite coverage to 80% and harden error boundaries#79
JacksonFergusonDev merged 6 commits into
mainfrom
test/expand-test-coverage-and-robustness

Conversation

@JacksonFergusonDev

@JacksonFergusonDev JacksonFergusonDev commented Aug 22, 2026

Copy link
Copy Markdown
Owner

Summary

This PR significantly expands the Tier 1 test suite from 99 tests (65.74% coverage) to 156 tests (79.64% branch coverage).

Additionally, the test coverage threshold (fail_under) in pyproject.toml has been raised from 60 to 75 to protect against future coverage regression.


Detailed Changes by Module

1. test_git_wrapper.py (+7 tests, 86% coverage)

  • Validation & Error Propagation: Verifies GitRepo raises ValueError on non-repositories and translates CalledProcessError to RuntimeError with stderr context.
  • Plumbing Safety: Tests atomic ref update guards with old_oid, re-raising on update_ref failure, and commit_tree error handling.
  • Branch Operations: Added tests for merge_squash no-op on empty branches and checkout force flag handling.

2. test_daemon.py (+13 tests, 81% coverage)

  • Skip & Push Guards: Tested _should_skip under critical battery, high system load, missing paths, and paused repos.
  • Eco-Mode & Connectivity: Tested _attempt_push skipping in eco-mode and when remote endpoints are unreachable.
  • Reachability & Locks: Added tests for SSH/HTTPS URL parsing in get_remote_host, TCP reachability in is_remote_reachable, and operational/stale lock detection in is_repo_busy.
  • Maintenance Lifecycle: Verified weekly backup pruning interval enforcement (7 days) in run_maintenance.

3. test_ops.py (+15 tests, 82% coverage)

  • Maintenance: Added tests for prune_backups deleting stale backup references and running git gc --auto.
  • Ignore Management: Added tests for add_ignore appending to .gitignore, skipping duplicates, respecting manage_gitignore=False, and prompting to untrack matching files.
  • Sync & Restore Safety: Added tests for sync_session when disabled, when up to date, and on user decline. Added restore_file failure exits and force overwrite handling.

4. test_cli.py (+15 tests, 76% coverage)

  • Repo Management: Added tests for list_repos (missing, paused, empty registry) and unregister_repo (clean removal, unlisted path warning, empty registry).
  • Diagnostics & Status: Added tests for show_diff outside a git repo and with untracked files, _check_repo_health paused states and missing backups, and show_status on unregistered repos.
  • State Control: Added tests for set_pause_state creating and unlinking the pulsar_paused sentinel.

5. test_system.py (+5 tests, 73% coverage)

  • Telemetry & Monitoring: Added tests for is_under_load CPU load ratio thresholding, pmset battery parsing on macOS, sysfs battery capacity/status parsing on Linux, and the get_system factory function.

6. Configuration & Documentation

  • pyproject.toml: Raised fail_under to 75.
  • tests/README.md: Updated documentation to reflect the expanded testing matrix.

Verification

  • just ci ran locally: all 156 unit tests passed, all linting/formatting/typechecks passed, and Tier 2 distributed sandbox passed cleanly.

@JacksonFergusonDev
JacksonFergusonDev merged commit 21f6738 into main Aug 22, 2026
7 checks passed
@JacksonFergusonDev
JacksonFergusonDev deleted the test/expand-test-coverage-and-robustness branch August 22, 2026 01:37
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