fix: a wrong password no longer costs an entire reinstall
The endpoint credentials are asked for at the very end of a run, after every package is installed -- correct, because a password typed at picker time would sit in memory through ten minutes of downloads. But any non-200 was fatal, so one mistyped character meant repeating the whole install to get back to a three-line prompt. Now it retries, up to five attempts. URL and username persist across them and blank keeps them, shown as `Bootstrap URL [https://...]:`, so only the password is retyped -- retyping an address that was already pasted correctly is its own source of error. `q` at the URL prompt leaves the machine public-only. The message also names the fault. Every failure used to print "endpoint refused the credentials", including a 404 and an unreachable host -- which is precisely how a URL-shape bug reads as a password problem. The status is now captured alongside the body rather than relying on --fail: 401 wrong username or password 404 reached the host, but no bootstrap.env is there -- check the route 000 could not reach that address (DNS, TLS, or the host is down) The body is used only when the code is 200, so an error page is still never parsed as a blob; that was --fail's job and an explicit check is stronger. `dotup private` already re-ran only this step, leaving installed packages alone -- it was simply missing from --help, so the cheap way back in was undiscoverable. Documented, and the failure path now points at it. The end-to-end sends a wrong password first on purpose and asserts both the message and that blank-blank-correct works, which is the only way to test a recovery path. Note that harness clones the PUBLISHED repo, so it validates what a user gets, not the working tree -- these invariants are covered in the unit suite, which reads the tree directly. 105 -> 113.
This commit is contained in:
@@ -92,12 +92,30 @@ proc wait_for {pat what} {
|
||||
}
|
||||
}
|
||||
|
||||
# dotup's own three: plain `read`, no TUI, so the text is the whole signal
|
||||
# dotup's own three: plain `read`, no TUI, so the text is the whole signal.
|
||||
#
|
||||
# The FIRST password sent here is deliberately wrong. These credentials are
|
||||
# asked for at the very end of a run, so a typo used to be fatal -- one wrong
|
||||
# character and the whole install had to be repeated to get back to this
|
||||
# prompt. Getting it wrong on purpose is the only way to prove the retry loop
|
||||
# exists and that the URL and username survive the attempt.
|
||||
wait_for {Bootstrap URL:} "the bootstrap URL prompt"
|
||||
send -- "$env(BOOT_URL)\r"
|
||||
wait_for {Username:} "the username prompt"
|
||||
send -- "$env(BOOT_USER)\r"
|
||||
wait_for {Password:} "the password prompt"
|
||||
send -- "definitely-not-the-password\r"
|
||||
|
||||
# The message must name the actual fault. "endpoint refused the credentials"
|
||||
# was once emitted for a 401, a 404 and an unreachable host alike.
|
||||
wait_for {wrong username or password} "the wrong-password message"
|
||||
# Blank keeps the URL and the username, so only the password is retyped. The
|
||||
# bracketed default in the prompt is what proves they were retained.
|
||||
wait_for {Bootstrap URL \[} "the retry prompt, with the URL kept"
|
||||
send -- "\r"
|
||||
wait_for {Username \[} "the retry username prompt, with the user kept"
|
||||
send -- "\r"
|
||||
wait_for {Password:} "the retry password prompt"
|
||||
send -- "$env(BOOT_PW)\r"
|
||||
# The private repo's seven, each answered only once its TUI is genuinely ready
|
||||
# to read.
|
||||
|
||||
Reference in New Issue
Block a user