feat: implement interactive pre-flight checklist for finalize#53
Merged
JacksonFergusonDev merged 6 commits intomainfrom Feb 24, 2026
Merged
feat: implement interactive pre-flight checklist for finalize#53JacksonFergusonDev merged 6 commits intomainfrom
JacksonFergusonDev merged 6 commits intomainfrom
Conversation
Introduces `diff_shortstat` to the `GitRepo` class to wrap `git diff --shortstat` using regex. This allows for deterministic extraction of files changed, insertions, and deletions between two revisions without parsing raw patch output.
Halts the `finalize` execution flow prior to the branch switch to display a `rich` table summary of all candidate backup streams. Aggregates machine IDs, relative timestamps, and diff statistics to negotiate the merge with the user. Prevents stranding the user on the target branch if aborted.
Fixes a crash in `test_finalize_octopus_merge` where `rich.table` failed to render a `MagicMock` object by explicitly returning a string for the commit time. Adds `test_finalize_aborts_on_user_decline` to ensure clean exits. Expands `test_git_wrapper.py` with `test_diff_shortstat_regex_parsing` to verify deterministic data extraction when Git omits empty clauses.
Updates `tests/README.md` to reflect the newly added interactive dry-run logic for the `finalize` command and the regex parsing determinism in the Git abstraction layer.
Updates `src/README.md` to reflect the newly added interactive dry-run negotiation for the `finalize` command in the `ops` module, and the regex parsing determinism added to the Git abstraction layer.
Updates the root README to check off the "Pre-Flight Checklists" item under the Phase 1 roadmap. Slightly adjusts the `finalize` command description in the reference table to highlight the new interactive dry-run safety feature.
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.
Context
Executing a blind octopus squash merge directly onto
mainviagit pulsar finalizeintroduces a high-risk vector for unwanted state mutations. This PR implements the "Pre-Flight Checklists" roadmap item to inject a deterministic, interactive dry-run negotiation phase before any destructive actions or branch switches occur.Technical Changes
git_wrapper.py): Introduceddiff_shortstatto theGitRepoclass. This uses regex capture groups to parsegit diff --shortstat, ensuring reliable extraction of files changed, insertions, and deletions even when Git dynamically omits zero-value clauses.ops.py):mainvsmaster) to occur prior to branch switching.finalize_workexecution pipeline to aggregate diff statistics across all remote machine streams.rich.table.Tablesummarizing the incoming DAG changes.sys.exit(0)) that guarantees the user'sHEADremains untouched on their active feature branch if they decline the merge.tests/):test_diff_shortstat_regex_parsingto verify regex edge cases.test_finalize_octopus_mergecaused byrich's strict type checking onMagicMockobjects.test_finalize_aborts_on_user_declineto guarantee isolation of the working directory on abort.README.md,src/README.md, andtests/README.mdto document the new control flow, highlight the regex determinism, and mark the roadmap item as complete.