refactor: introduce parameter objects for data clumps across codebase - #85
Merged
Merged
Conversation
…mit configurations
…bject in commit_tree
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.
Summary
This pull request refactors multiple Data Clumps across
git-pulsarusing 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
DriftStateIntegration in Operations (ops.set_drift_state):ops.set_drift_stateto accept the domainDriftStateparameter object directly rather than unpacking loose(last_check_ts: float, warned_remote_ts: int)primitives.DriftState.ServiceUnitConfigfor Linux Daemon Installation (service.install_linux):ServiceUnitConfigdataclass encapsulatingunit_path,executable,interval, andlog_path.service.install_linux(config: ServiceUnitConfig)andservice.install.tests/test_service.py.CommitTreeParamsfor Plumbing Commit Operations (GitRepo.commit_tree):CommitTreeParamsdataclass encapsulatingtree,parents,message, andenv.GitRepo.commit_treeto acceptCommitTreeParamswhile preserving backwards-compatible parameter unpacking.tests/test_git_wrapper.py.BackupOptionsfor Backup Pipeline Context (daemon.run_backup):BackupOptionsdataclass encapsulatingconfig: Configandinteractive: bool._should_skip(repo_path, options)and_attempt_push(repo, refspec, options).daemon.pyand associated test cases intests/test_daemon.py.Verification
uv run ruff check .anduv run ruff format --check .passed with 0 errors.uv run mypy .passed with 0 issues across all 19 source files.uv run pytest --covpassed 187/187 tests with 82.81% total test coverage.