Skip to content

Make the bootstrap and the deploy say why they stopped - #416

Merged
Swordlash merged 8 commits into
mainfrom
bootstrap-says-why
Dec 3, 2026
Merged

Swordlash merged 8 commits into
mainfrom
bootstrap-says-why

Conversation

@Swordlash

@Swordlash Swordlash commented Dec 2, 2026 •

Copy link
Copy Markdown
Owner

The local deploy and the toolchain's bootstrap never stop without saying why. The owner ran npm run deploy-local at work; it printed "installing or checking GHC and cabal, which build the deploy's maker (toolchain/bootstrap.sh maker)" and ended with nothing more. The cause was his network (a proxy, GitHub not reached). His words: "powinniśmy coś wypisywać".

What was silent

  • Reproduced: update_cabal_index assigned from cabal path --remote-repo-cache with its errors sent to the log. When the toolchain's directory lies below a cabal.project (a deploy's --prefix inside the checkout), cabal path first clones the project's git packages; behind a proxy that refuses GitHub the clone fails, and set -e ended the run after the deploy's one line (status 128).
  • Read, not triggered: GHCUP_BIN=$(ghcup whereis bindir) for a ghcup on the PATH; awk … >tmp && mv in hackage_config, which went on and said the mirror was written when awk had failed.
  • Every other path already spoke: the ghcup download, ghcup's installs, cabal update, the maker's build, a proxy that refuses everything, an address where nothing listens.

Whether the reproduced path is the owner's is not confirmed: it needs GHC and cabal present and a cabal.project above the toolchain's directory, and the line he quoted has no ", under

". Whatever his was, a stop now names its step and shows the log's end.

What is built (as cut down after round 4; the rounds below tell how it got here)

  • The cause found is removed: cabal path -z -v0 and cabal update -z read no project (cabal 3.12, the floor, has -z); a failing cabal path stops with a message and the log's path.
  • A net under everything: trap net EXIT in bootstrap.sh, set again inside the subshell that holds the lock, which opens the lock's file after the trap. A non-zero exit that nothing explained prints one line with the step (current_step, set by run, run_long and the main phases), the status and the log's path, and no excerpt of the log. It is silent on a zero exit, for ready, check and system-tools, after an exit that already spoke, and on usage errors.
  • stop (a message on stderr, nothing written to the log) only for the two exits that were silent on main: ghcup whereis bindir and cabal path. The exits that already spoke on main keep main's lines and only mark that they spoke.
  • fail as on main, and for a step that downloads (the ghcup download, ghcup's installs, cabal update, the maker's build, the Node download) one fixed sentence after it: that a proxy or a firewall may be in the way if the lines above show a refused or failed connection, and that curl, with which ghcup and cabal download here, and git read https_proxy or HTTPS_PROXY, http_proxy in small letters only, and ALL_PROXY. No address, no mirror, no status in it.
  • deploy-local.sh has the same net (die marks that it spoke, deploy_step names the phase), and when the bootstrap fails its own last line says so with the script and mode, the status and the log's path, and no option's value.
  • The log's end is printed exactly where main prints it (run, run_long, the two checksum checks, finding the maker's binary) and nowhere else; the mirror's probe is main's code with one mark added.

Known and left

  • Behind a proxy that refuses GitHub the deploy now gets past the bootstrap and meets GitHub again in the maker's stage (the wiki's git packages, the page's download); that stage reports its own failures and was not examined.
  • maker/src/Maker/Store.hs runs cabal update in the state directory without -z: it prints its failure, but the same project is read there.
  • A URL with a password (a proxy's, a mirror's) can appear in the log's end that fail shows and in a long step's live output, as on main; the maker's own failure shows the log's end too; the deploy's --status prints the stored mirror and npm registry in full; the usage error for a malformed --hackage-mirror echoes the value. This pull request changes none of that and promises nothing about passwords: masking them everywhere is a package of its own.

Tests

  • toolchain/test-bootstrap.sh: each kind of failing step gives a non-zero status and a message naming the step and the log; a download's failure adds the one sentence; a failing cabal path speaks once and shows no log; a silently failing mv makes the net print exactly its one line; the net is silent on success, on ready not ready, a blocked check, too-old system tools and usage errors; a directory at the lock's path gives one line; system-tools with a failing ghcup whereis bindir writes nothing; the fake cabal refuses path without -z. A line seeded into the log beforehand appears in the output of none of the probe's failure, cabal path's failure and the net (shown failing with each made to print the log).
  • toolchain/test-deploy-local.sh: a fake bootstrap failing with status 3 gives status 3 and the deploy's line last, with a mirror's password given on the command line appearing nowhere; a silently failing env mode gives one net line; a refused move adds none.

Verification

Run locally: test-bootstrap.sh (47 cases), test-deploy-local.sh (144 deploy, 11 deploy-server, 12 static), the wizard's part of test-configure.sh (26), format, lint, shellcheck (no new finding against main). No Haskell is touched. The reproduction before and after, through a small CONNECT proxy and a toolchain home under a scratch directory, never the real one.

Codex

  • Round 1 (b528e63, gpt-6.2-sol, high): four findings, being fixed. (1) A mirror's probe that cannot connect was reported as a mirror that does not serve root.json, without curl's error or the proxy advice. (2) A mirror's URL with credentials was printed whole in the new messages. (3) The downloads the maker makes after the hand-over (Node in build and static, and the rest) do not get the advice the README's paragraph promises. (4) The advice named public Hackage also when cabal's configuration names another repository.

Round 1's fixes (38bbcc1). (1) The mirror's probe reads curl's HTTP status: a 404 or 410 says the mirror has no root.json, with the sentence about Hackage's signed metadata; no answer at all (a proxy's refusal gives curl the same exit status as a 404, and the status 000) goes through fail as any download does, with curl's own line and the proxy advice; nothing is written to cabal's configuration either way. (2) redact_url (scheme://***@host…) wherever a mirror's URL is printed or logged by these scripts; cabal's configuration keeps the real one; curl itself prints no userinfo on a refused connection, a 403 or a 404 (checked). The usage error for a malformed --hackage-mirror and the deploy's --status line, which this pull request does not touch, still print the value as given. (3) The README's paragraph and the changelog entry are narrowed instead of the maker being changed: the shell's stage gives the advice (ghcup, GHC and cabal through ghcup, cabal's index, the mirror's probe, the maker's build, Node in the node mode); the maker's later downloads have no one function to carry it (some go through its fetch, others through its run helpers or git) and name the step and show the log's end. (4) hackage_reach names the url cabal's configuration gives Hackage's repository, redacted: the toolchain's own under a named base, otherwise the user's (cabal path -z --config-file); public Hackage only when that is the url or no configuration exists yet. Run locally: test-bootstrap.sh (47), test-deploy-local.sh (144, 11, 12), the wizard's part (26), shellcheck against main, format, lint. One case of test-deploy-local.sh (97, --refresh-page, the maker's page download from the cache, code this pull request does not change) failed once in a run with the wizard and passed in the rerun; the test prints no output for it, so the reason is not known.

  • Round 2 (38bbcc1): five findings, two of them a mirror's password reaching the terminal through what round 1 added (a quoted url read from cabal's configuration is not masked; an older log's lines are shown unmasked in an excerpt). Being fixed by narrowing: the advice no longer reads cabal's configuration and prints no URL from a file, only the host of a mirror given on the command line or none; every excerpt of the log shown on the terminal goes through one filter that masks userinfo. Also: a probe answered 407 is the proxy asking for authentication and gets the proxy advice; the lock's file is opened inside the subshell, after its trap is set.

Round 2's fixes (87f2153), by narrowing. The advice no longer reads cabal's configuration and prints no URL from a file: for cabal's steps it says the step downloads from the repository cabal's configuration names, hackage.haskell.org unless that says otherwise, and that the lines above name the address that failed; a mirror given on the command line is named by scheme and host alone (url_host, tested with userinfo, a port, quotes, an IPv6 literal, and values it must refuse), or not at all; the deploy's last line shows --hackage-mirror=<the mirror>. mask_userinfo masks userinfo in every excerpt of the log shown and in every line these scripts write to the log from now on; the log already written is not rewritten. Its test seeds a log with lines an older bootstrap wrote, makes two unrelated steps fail and finds the password on neither stream; with the filter made a no-op the test fails. A probe answered 407, by the proxy for an http:// mirror or in the tunnel to an https:// one, gets the proxy advice and a sentence that the proxy wants a user and a password. The lock's file is opened inside the subshell after its trap is set; a directory at its path gives one line naming the step. CI's failure on 38bbcc1 was the removed case: the fake cabal answered with CABAL_DIR's configuration, which the workflow sets to the runner's real home. Left unchanged, outside this diff: the usage error for a malformed --hackage-mirror echoes the value, the deploy's --status prints the stored mirror in full, and the maker's own failure shows its log's end unmasked. Run locally: test-bootstrap.sh (48, also with CABAL_DIR exported as on the runner), test-deploy-local.sh with the wizard (26, 144, 11, 12), shellcheck against main, format, lint.

  • Round 3 (87f2153): three findings, two of them the mask again (a long step's live output is teed to the terminal before any filter, the maker's own failure shows the shared log unmasked, an apostrophe inside userinfo ends the match), one a write to the log in a read-only mode. Three rounds have each found the mask incomplete, so it is taken out rather than patched: this pull request promises nothing about passwords and prints nothing from the log, a configuration or the command line's values that main does not already print. fail shows the log's end as on main; the net's line gives the step, the status and the log's path with no excerpt; stop writes nothing to the log.

Round 3's fixes (f389037). mask_userinfo and its tests are gone, with the sentences about masking in the README and the changelog; fail, say, run and run_long print, write and tee as on main; the probe no longer prints curl's line itself (it goes to the log, and fail shows the log's end as for any step). The net prints one line and no excerpt, for example bootstrap: stopped while writing the environment file /home/me/.wiki-toolchain/env (status 1) without saying why; the end of its log, /home/me/.wiki-toolchain/bootstrap.log, may say more. stop writes to stderr only: system-tools with a failing ghcup whereis bindir and an existing toolchain directory leaves everything byte for byte as it was (tested). Read against main: beside fixed words, steps' names, statuses and paths, the added lines print the pinned ghcup and Node addresses, a command line's mirror by scheme and host where main printed the whole URL, and what main already printed. Run locally: test-bootstrap.sh (48, also with CABAL_DIR exported), test-deploy-local.sh with the wizard (26, 144, 11, 12), shellcheck against main, format, lint.

  • Round 4 (f389037): three findings, all in what was added beyond the purpose: the mirror's probe now goes through fail, which shows the log's end on a path where main showed none; the hint about --hackage-mirror is given in modes that do not take the option; a 403 for an http:// mirror gets no proxy advice. Four rounds have each found faults in the advice and the probe's special cases, so they are being cut: the probe goes back to main's code, the advice becomes one fixed sentence with no address, mirror or status in it, and nothing prints the log's end where main does not. What stays is the purpose: cabal reading no project above the toolchain's directory, the net, stop, and the deploy's last line.

Round 4's cut (5a30715, rebased onto main). The diff against main went from 637 added lines to 407. Removed: the lists of addresses, the naming of a mirror's host, the hint about --hackage-mirror, the probe's cases by status (404, 407, no answer), their tests; hackage_config is main's again with one mark. "What is built" and "Tests" above describe the pull request as it is now. Run locally: test-bootstrap.sh (47, also with CABAL_DIR exported), test-deploy-local.sh with the wizard (26, 144, 11, 12), shellcheck (the same findings as main), format, lint.

  • Round 5 (5a30715): three small findings, all inside the purpose, being fixed: the deploy names the wrong step when claiming the prefix's directory fails; the bootstrap's net has no step's name when the state directory or the log's header cannot be written; both name a log the failed run may never have written.

Round 5's fixes (9a6c6fe). The deploy sets its step before every operation from the end of option parsing to the maker's start (claiming the prefix among them); the bootstrap names a step from the moment its net is set; the bootstrap's net names the log only once this run has appended its header to it, and the deploy's last line says "its log, if it got as far as writing one, is …". Tests: a directory at the log's path (the net names the step and no log); a prefix whose parent is not writable (the deploy's net names claiming the prefix); the deploy's last line for a bootstrap that failed before logging. Run locally: test-bootstrap.sh (47, also with CABAL_DIR exported), test-deploy-local.sh with the wizard (26, 144, 11, 12), shellcheck (the same findings as main), format, lint.

  • Round 6 (9a6c6fe): "The project-independent Cabal lookup addresses the original failure." Three findings, none fixed on this head; the owner is asked whether to merge as it stands. (1) The read-only modes (check, ready) mark that they spoke before they run, so an unexpected failure inside one (a helper's node -e exiting with a status of its own) still ends without a line. (2) When writing the environment file fails in the node mode, the net names installing Node. (3) When bootstrap.sh env has explained its own failure, the deploy's net adds a line saying the deploy stopped without saying why.

(rounds are added here)

🤖 Generated with Claude Code

https://claude.ai/code/session_01HnFn8HVAncUyJ6jU4yhnRM

npm run deploy-local can stop right after "installing or checking GHC
and cabal" with nothing more on the screen. One way, reproduced behind a
proxy that refuses GitHub: the bootstrap asked cabal path for the index's
directory from inside the toolchain's directory. Below a cabal.project (a
--prefix inside the checkout), cabal path first clones the project's git
packages from GitHub, fails, and wrote its message to the log alone; under
set -e the assignment ended the run without a word.

cabal path and cabal update now run with -z, so no project is read there,
and a failure of cabal path goes through fail. Every step that downloads
names the addresses it reaches when it fails, and which proxy variables
curl, ghcup, cabal and git read (measured, not assumed). An EXIT trap in
the bootstrap, set again inside the subshell that holds the lock, and one
in the deploy, catch any other failure nothing explained and name the
step, the status and the log. The deploy also says, last, which bootstrap
command failed, its status and its log.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HnFn8HVAncUyJ6jU4yhnRM
…ssword

A probe of --hackage-mirror that reached no server (a proxy refusing the
tunnel, which curl reports with the same exit status as a 404) was
reported as a mirror without root.json. The probe now reads curl's HTTP
status: 404 or 410 is a mirror without the file, 000 is a download that
failed, with curl's line and the proxy advice as for any other, and
another status is named. Nothing is written in any of these cases.

A mirror's URL may carry a user and a password. Every message that names
it (the probe, the "written into" line, the advice's addresses, the
deploy's last line) prints it through redact_url as https://***@host/;
cabal's configuration keeps the URL as given.

The advice names the repository cabal really uses: the url its
configuration gives hackage.haskell.org (the toolchain's own, or the
user's, which cabal path -z --config-file finds), Hackage when there is
no configuration yet, and no repository by name when the configuration
names no url for it.

The maker's downloads after the hand-over (Node in the other modes, the
wasm sysroot, Chromium, fourmolu, libsodium) go through several paths,
not one function, so they keep showing the step and the log's end; the
README and the changelog entry now say which stage gives the advice.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HnFn8HVAncUyJ6jU4yhnRM
The advice for cabal's downloads read the url of cabal's configuration
and printed it. A quoted url escaped the mask, and CABAL_CONFIG can name
another file. The advice now says in words that the step downloads from
the repository cabal's configuration names, hackage.haskell.org unless it
says otherwise, and leaves the failing address to cabal's and curl's own
lines. A --hackage-mirror given on the command line is named by its
scheme and host alone (url_host); the deploy's last line shows the option
as --hackage-mirror=<the mirror>.

A log written by an older bootstrap holds mirror URLs with passwords.
Every excerpt of the log the bootstrap shows, and every line it writes
to the log, now goes through mask_userinfo, which replaces the userinfo
of any scheme://userinfo@ with ***. The log itself is not rewritten.

A probe of the mirror answered 407 is a proxy that wants a user and a
password: the advice says so instead of blaming the mirror.

The lock's descriptor is opened inside the subshell, after its net, so a
lock file that cannot be opened is a named step like any other.

The test of the user's own cabal configuration failed on CI: its fake
cabal answered --config-file from CABAL_DIR, which the workflow exports
as the runner's real ~/.cabal. The script no longer asks, and the fake
no longer answers it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HnFn8HVAncUyJ6jU4yhnRM
Three rounds of review each found the mask of URLs' passwords incomplete
(the live output of a long step, the maker's own log excerpt, an
apostrophe). This pull request is about saying why a run stopped, so it
now prints nothing from the log, a configuration file or the command
line's values that main does not already print, and promises nothing
about passwords. fail shows the log's end and run and run_long write and
tee exactly as on main. The net prints one line, with the step, the
status and the log's path, and no excerpt of the log: on main such a
stop printed nothing at all. The mirror probe leaves curl's message in
the log, where fail's excerpt or the log itself shows it.

stop now writes only to stderr: it ends the read-only modes too, and
system-tools with a failing ghcup whereis bindir wrote to an existing
toolchain directory's log. A test checks that directory is left as it
was.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HnFn8HVAncUyJ6jU4yhnRM
Four review rounds found faults, nearly all in what this pull request
added beyond its purpose: naming the hosts each download reaches, a
Hackage mirror's probe told apart by its HTTP status, and the log's end
printed on paths where nothing of the log was printed before, where an
old run's line can hold a mirror's password. Those are gone. The probe
of a mirror is as it was, but for setting spoke so that the net does not
speak after its message. A failing cabal path stops with the log's path
instead of the log's end. fail is as it was, and a step that downloads
adds one fixed sentence about proxy variables. The deploy's last line
names the command and the log, and no option's value.

What stays: cabal path and cabal update with -z, the EXIT trap that
names the step, the status and the log once when nothing else spoke,
and stop for the exits that were bare. A test seeds a line in the log
and checks that the probe's failure, cabal path's failure and the net
print none of it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HnFn8HVAncUyJ6jU4yhnRM
The four exits that said why on main (missing commands twice, missing
Debian packages, and the check for x86_64 Linux) printed on stdout and
wrote to the log. They stay as they were, with spoke set so that the
net does not speak after them. stop is left for the exits that were
bare on main.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HnFn8HVAncUyJ6jU4yhnRM
A deploy whose prefix could not be made said it stopped while loading
the toolchain's environment, and the bootstrap stopped before its log
existed with no step named and a log it never wrote. The deploy now sets
its step before each stage-one operation: the name and the prefix, the
state, the toolchain's directory, the status report, claiming the
prefix, the bootstrap, loading the environment and the maker. The
bootstrap names its steps from the start, and its net names the log only
after this run has written its first line there. The deploy cannot see
whether the bootstrap got that far, so its last line says where the log
is if one was written.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HnFn8HVAncUyJ6jU4yhnRM
@Swordlash
Swordlash enabled auto-merge December 3, 2026 08:48
@Swordlash
Swordlash disabled auto-merge December 3, 2026 08:48
@Swordlash
Swordlash merged commit a7a73d6 into main Dec 3, 2026
14 checks passed
@Swordlash
Swordlash deleted the bootstrap-says-why branch December 3, 2026 08:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants