fix: forced monorepo splits fail during cleanup - #52
Merged
Conversation
splitAndPush only creates the <remote>-tmp branch on the non-forced path — a forced split pushes the split sha straight to the remote — but cleanupBranchAndRemote deleted that branch unconditionally, so every forced split ended in a git error once the pushes had succeeded. Forced splits also ignored --no-interaction. getParam answers a confirm with its initial value in non-interactive mode, and this one starts at false, so 'monorepo:split --force --no-interaction' always took the 'decided not to force push' path and quietly did nothing — which is exactly the combination a script or CI job would use. The confirmation is now skipped when the operator has already asked for no prompts.
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.
Two bugs in
monorepo:split --force, both found by using it regularly on the Flarum monorepo.Cleanup deletes a branch that a forced split never creates
splitAndPush()only creates the<remote>-tmpbranch on the non-forced path:but
cleanupBranchAndRemote()rangit branch -D <remote>-tmpunconditionally. So every forced split threw once all the pushes had already succeeded — the work was done, the command still ended in an error.--forceignored--no-interactionThe force confirmation is a
confirmparam withinitial: false. In non-interactive modePromptsIO::getParam()returns the initial value rather than prompting, so the answer was always "no" andmonorepo:split --force --no-interactionreliably printed "Decided not to force push" and did nothing.That's precisely the flag combination a script or CI job would use, and it silently no-oped. The confirmation is now skipped when the operator has already asked not to be prompted —
--no-interactionmeans "don't ask me", so a forced split proceeds.Worth being deliberate about: this makes
--force --no-interactiongenuinely force-push to every split repo without confirmation. That is the intent of the flag pair, and the guard remains for interactive use.Verification
yarn test— 22 suites, 176 tests, Prettier clean. Both paths exercised by hand against the Flarum monorepo on Apple silicon over an extended period.