fix(selfhost): add make restore, and stop doctor being shadowable - #143
Merged
Merged
Conversation
make backup existed without a counterpart, so the half of the pair that matters under pressure was the half you had to find in a runbook. restore now has a target. It asks for the confirmation instead of supplying it. restore.sh refuses without --confirm RESTORE, and a shortcut that filled that in would make the destructive operation easier to reach than the script it wraps — the guard is the point, not an obstacle to smooth over. The operator types RESTORE and the target forwards it, after saying what is about to be replaced. doctor was a target but missing from .PHONY, so a file or directory named doctor in the repository root would have silently shadowed it. Verified by hand: no BACKUP, no CONFIRM and a wrong CONFIRM each exit 2 with a message naming the next step; with CONFIRM=RESTORE the target delegates and restore.sh applies its own directory check. A new test pins that the target cannot start supplying the confirmation, and it fails when the guard is removed. Signed-off-by: L4XB <L4XB@users.noreply.github.com>
Member
Author
|
I have read and agree to the SixSentences CLA v1.0. |
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.
Closes #88.
What
make backupexisted without a counterpart. The half of the pair that mattersunder pressure — at 2am, with a broken deployment — was the half you had to go
find in a runbook.
make restorenow exists, andmake helplists it.doctorwas a target but missing from.PHONY, so a file or directory nameddoctorin the repository root would have silently shadowed it.The interesting part: it asks for the confirmation rather than supplying it
restore.shrefuses to run without--confirm RESTORE. A shortcut that filledthat in automatically would make the destructive operation easier to reach
than the script it wraps — which is the opposite of what a convenience target
should do. The guard is the point.
So the target asks for the same word, and says what is about to be replaced
before it happens:
Verified by hand
make restoremake restore BACKUP=/tmp/xmake restore BACKUP=/tmp/x CONFIRM=yesmake restore BACKUP=/tmp/nope CONFIRM=RESTORErestore.shrefuses: "--backup must name an existing, non-symlink absolute directory"make helprestorewith its descriptionThe last row is the one that matters: with a correct confirmation the target
does not decide anything itself, it hands over to the script, which applies its
own directory, symlink and checksum checks unchanged.
Tests
test_makefile_shortcuts_use_the_selected_environment_filenow also assertsdoctor:andrestore:exist and that both appear in.PHONY.test_make_restore_asks_for_the_confirmation_instead_of_supplying_itis new andpins the property above. It was checked against its own failure mode:
replacing the
CONFIRMtest withtruemakes it fail, so it is testing theguard rather than the file's existence.
Scope
restore.shis untouched, as the issue asked. The runbook gains themakeinvocation next to the direct one.