Skip to content

refactor: introduce parameter objects for data clumps across codebase - #85

Merged
JacksonFergusonDev merged 6 commits into
mainfrom
refactor/introduce-parameter-objects
Aug 22, 2026
Merged

refactor: introduce parameter objects for data clumps across codebase#85
JacksonFergusonDev merged 6 commits into
mainfrom
refactor/introduce-parameter-objects

Conversation

@JacksonFergusonDev

Copy link
Copy Markdown
Owner

Summary

This pull request refactors multiple Data Clumps across git-pulsar using the Introduce Parameter Object design pattern. Previously, related primitive and collection values (such as drift timestamps, Linux service installation configuration, Git tree commit parameters, and backup execution context) were passed across functions as loose parameters.

Key Changes & Introduced Parameter Objects

  1. DriftState Integration in Operations (ops.set_drift_state):

    • Refactored ops.set_drift_state to accept the domain DriftState parameter object directly rather than unpacking loose (last_check_ts: float, warned_remote_ts: int) primitives.
    • Updated daemon roaming radar / drift state callsites and tests to construct and pass DriftState.
  2. ServiceUnitConfig for Linux Daemon Installation (service.install_linux):

    • Introduced ServiceUnitConfig dataclass encapsulating unit_path, executable, interval, and log_path.
    • Refactored service.install_linux(config: ServiceUnitConfig) and service.install.
    • Added unit test suite in tests/test_service.py.
  3. CommitTreeParams for Plumbing Commit Operations (GitRepo.commit_tree):

    • Introduced CommitTreeParams dataclass encapsulating tree, parents, message, and env.
    • Refactored GitRepo.commit_tree to accept CommitTreeParams while preserving backwards-compatible parameter unpacking.
    • Updated daemon shadow commit pipeline and added test coverage in tests/test_git_wrapper.py.
  4. BackupOptions for Backup Pipeline Context (daemon.run_backup):

    • Introduced BackupOptions dataclass encapsulating config: Config and interactive: bool.
    • Refactored _should_skip(repo_path, options) and _attempt_push(repo, refspec, options).
    • Updated backup execution pipeline in daemon.py and associated test cases in tests/test_daemon.py.

Verification

  • Linting & Formatting: uv run ruff check . and uv run ruff format --check . passed with 0 errors.
  • Type Checking: uv run mypy . passed with 0 issues across all 19 source files.
  • Unit Testing & Coverage: uv run pytest --cov passed 187/187 tests with 82.81% total test coverage.
  • Atomic Commits: Each refactoring phase was verified and committed atomically.

@JacksonFergusonDev
JacksonFergusonDev merged commit 35513c6 into main Aug 22, 2026
7 checks passed
@JacksonFergusonDev
JacksonFergusonDev deleted the refactor/introduce-parameter-objects branch August 22, 2026 21:59
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