Skip to content

fix(install): Windows re-runs work again; organiser setup needs only Docker - #12

Merged
Denimworld12 merged 2 commits into
mainfrom
fm/hospital-chain-v1-1-0-fixes
Oct 11, 2026
Merged

Denimworld12 merged 2 commits into
mainfrom
fm/hospital-chain-v1-1-0-fixes

Conversation

@Denimworld12

@Denimworld12 Denimworld12 commented Oct 11, 2026 •

Copy link
Copy Markdown
Owner

Intent

Following the merge of PR #10 (join-code onboarding) and the publish of the v1.1.0 image, a real tester ran the published package end to end on a genuinely clean Windows 11 laptop (only Docker Desktop and Tailscale installed beforehand) and filed GitHub issue #11 on this repository with the findings. The captain asked to have that issue checked and its real findings fixed, continuing the same effort to get the friend-onboarding flow actually working that produced PR #10. The issue reports that a first-time friend join works well, but re-running the install command on Windows - which the project's own documentation tells a friend to do after every reboot - always fails due to a real PowerShell bug, and that setting up the organiser's side cannot currently be done with only Docker installed, contrary to what the docs imply. It also reports several smaller real defects found during the same live test.

What issue #11 reports (the substance of the findings referred to above):

  1. deploy/install/install.ps1 re-run always fails on Windows (PowerShell 5.1 and 7): $recreate = if ($rerun) { @("--force-recreate") } else { @() } unwraps the one-element array into a string, and splatting it passes the flag to Docker one character at a time ("no such service: -"); the installer then shows misleading port advice. The tester verified $recreate = @(if ($rerun) { "--force-recreate" }) fixes it. Because the "organiser removed this laptop" check runs after that docker compose up line, a removed friend on Windows saw the Docker error instead of the clear removal message. The PS7 test with a fake docker missed it because the fake did not check its arguments; the issue asks for a test that checks the arguments docker compose up actually receives on a re-run.
  2. Organiser setup with only Docker: scripts/provision.py is not in the image and the docs say python scripts/provision.py, but the organiser has no Python (running it via docker run --rm -v "${PWD}:/src" -w /src ghcr.io/denimworld12/medchain-node:v1.1.0 python scripts/provision.py ... worked); provision.py refuses --peers with only the organiser's own hospital ("needs at least two hospitals"), forcing a placeholder second hospital when everyone else will be added by join code; make hub does not exist on Windows, and the plain docker compose --project-directory . --env-file kits/directory/hub.env -f deploy/hub.yml up -d --wait worked. Suggestions: document the docker run provision.py command (or ship it in the image), allow one hospital when join codes add the rest, show the plain docker compose hub command next to make hub.
  3. Smaller items: install.ps1 exits 0 on every failure (no join code, refused, Docker error), so a script cannot tell it failed; after stopping a removed node it still ends with "Nothing has been changed on this laptop."; the 2 GB image is downloaded before the join code or name is checked, so a friend with a missing code waits minutes before being told; the Join codes dashboard page has no Copy button for the code or the install commands; a hospital started from a kit (the organiser's own) shows the container's hostname and Linux/WSL2 on the Nodes page instead of the laptop's details; the v1.1.0 Node image workflow fails at its last "check it" step (red X) although the image published for both linux/amd64 and linux/arm64, likely because grep -q '"architecture":"arm64"' does not match how --format '{{json .Manifest.Manifests}}' prints the JSON.

What Changed

  • Installers (deploy/install/install.ps1, install.sh): On Windows, --force-recreate now stays an array (@(if ($rerun) { ... })). Before, PowerShell turned it into a string and splatted it to Docker one character at a time, so every re-run failed. Both installers now ask for and check the hospital name and join code before the 2 GB image download. That includes a format check for the 20-character code. When a removed laptop's node is stopped, the closing message now says so instead of "Nothing has been changed". install.ps1 now reports failure: it exits 1 when run as a file or one-off command, and sets $LASTEXITCODE = 1 when pasted into an open window. It also falls back cleanly when Get-CimInstance is unavailable. New tests/unit/test_install_ps1.py and extra test_install_sh.py cases cover this, including the arguments docker compose up receives on a re-run.
  • Organiser setup with only Docker: scripts/provision.py --peers now accepts a single hospital, the organiser's own, because join codes add the rest. README and docs/MULTI_LAPTOP.md now give the docker run ... python scripts/provision.py command for organisers without Python. They also show the plain docker compose commands next to make hub and make node, and explain why a hospital started from a kit shows the container's hostname and OS on the Nodes page.
  • Dashboard and CI: The Join codes page has Copy buttons for the code and for both install commands. Over plain http (not a secure context), they fall back to selection-based copying. The image workflow's final check now uses jq to confirm both amd64 and arm64 are in the manifest. It used to grep for compact JSON, which never matched the pretty-printed output, so the step failed.

Risk Assessment

✅ Low: The fix round changed only docs (the README command is now on one line, and the provision.py docstring uses a double backslash and its prose is back in its own paragraph), and both changes are correct; the code changes reviewed in round 1 (install.ps1 array fix, exit codes, early checks of the name and join code, provision.py accepting one hospital, the jq manifest check, the Copy buttons) still look correct, and only a small README wording issue is left.

Testing

This host has no PowerShell, so I ran install.ps1 under PowerShell 7.4.6 in a local container, with docker and tailscale replaced by fakes that record their arguments. Those runs are not live, so the installer scenarios are marked untested. Under those fakes the target installer passed every check, and the base commit's installer reproduced issue #11 ("no such service: -", exit 0 on failures, "Nothing has been changed" after a removal). The install.sh and provision.py tests passed. The image workflow's new jq check, run live against the real published v1.1.0 manifest list, passes, and the old grep check fails on it. I did not drive the organiser's Docker-only setup (provisioning in the image, then the plain docker compose hub command) or the Join codes Copy buttons: the 2 GB v1.1.0 image download was stopped at its time limit before it finished. So there is no screenshot of the Copy button UI.

  • Live validation: ⚠️ inconclusive - 1 of 8 scenarios driven live against the product
Scenario Result Live Evidence
A friend re-runs the Windows install command on an enrolled laptop: docker compose up gets -d --force-recreate as separate whole arguments and the hospital starts ('Done') ⏸️ untested no The earlier run did not establish a live result: real PowerShell 7.4.6 ran the real install.ps1, but docker and tailscale were fakes (see install_ps1_transcripts.txt and test_a_rerun_passes_force_recr…
A laptop the organiser removed re-runs the installer: it shows the removal message, stops the node, exits 1, and does not say 'Nothing has been changed' ⏸️ untested no The earlier run did not establish a live result: docker was a fake and the hub's refusal was simulated with an exit code (install_ps1_transcripts.txt). A live run needs a running hub that has removed…
A friend runs the installer with no join code or a malformed code or name: it is refused before the 2 GB image is downloaded, with exit 1 ⏸️ untested no The earlier run did not establish a live result: a fake docker recorded the calls instead of downloading (install_ps1_transcripts.txt showed no 'docker pull'; test_a_bad_name_or_code_fails_before_the_…
Any installer failure exits non-zero, and a paste into an open window sets LASTEXITCODE instead of closing it ⏸️ untested no The earlier run did not establish a live result: only unit tests ran (test_every_failure_exits_non_zero, test_pasted_into_an_open_window_it_sets_lastexitcode_instead_of_closing_it), with a fake docker…
Image workflow 'check it' step: the new jq check passes on the real published v1.1.0 (amd64 + arm64) and fails when arm64 is missing ✅ pass live image_workflow_check.txt
An organiser with only Docker runs the documented docker run ... medchain-node:v1.1.0 python scripts/provision.py --zip --peers <own hospital only> --directory ... and gets kits including kits/direc… ⏸️ untested no The 2 GB v1.1.0 image download was stopped at its time limit before it finished. Only the unit test test_the_organisers_own_hospital_alone_is_enough_when_join_codes_add_the_rest ran (it passed). Re-ru…
The organiser starts the hub without make, using docker compose --project-directory . --env-file kits/directory/hub.env -f deploy/hub.yml up -d --wait ⏸️ untested no This depends on the provisioned kit from the previous scenario, which needs the image that was not downloaded. It also needs ports free of the medchain-hub stack already running on this host.
On the dashboard's Join codes page the organiser presses Copy on the code and on the install commands and sees 'Copied' ⏸️ untested no This needs the hub from the previous scenario running with MEDCHAIN_ADMIN_PASSWORD set, then a browser to log in, create a code and click Copy. It was not reached because the image download was stoppe…
Evidence: install.ps1 tests on the target (real pwsh 7)
============================= test session starts ==============================
platform linux -- Python 3.12.15, pytest-9.1.1, pluggy-1.6.0 -- /usr/local/bin/python3
rootdir: /w
configfile: pytest.ini
plugins: anyio-4.15.1
collecting ... collected 8 items

tests/unit/test_install_ps1.py::test_a_rerun_passes_force_recreate_to_docker_as_one_argument PASSED [ 12%]
tests/unit/test_install_ps1.py::test_a_first_install_enrolls_then_starts_without_recreating PASSED [ 25%]
tests/unit/test_install_ps1.py::test_a_removed_laptop_rerun_is_told_so_and_stopped PASSED [ 37%]
tests/unit/test_install_ps1.py::test_a_bad_name_or_code_fails_before_the_download[env0-No join code given] PASSED [ 50%]
tests/unit/test_install_ps1.py::test_a_bad_name_or_code_fails_before_the_download[env1-That is not a join code] PASSED [ 62%]
tests/unit/test_install_ps1.py::test_a_bad_name_or_code_fails_before_the_download[env2-2 to 60 characters] PASSED [ 75%]
tests/unit/test_install_ps1.py::test_every_failure_exits_non_zero PASSED [ 87%]
tests/unit/test_install_ps1.py::test_pasted_into_an_open_window_it_sets_lastexitcode_instead_of_closing_it PASSED [100%]

============================== 8 passed in 3.40s ===============================
Evidence: Base commit's install.ps1 failing the same tests (issue #11 reproduced)
============================= test session starts ==============================
platform linux -- Python 3.12.15, pytest-9.1.1, pluggy-1.6.0 -- /usr/local/bin/python3
rootdir: /w
configfile: pytest.ini
plugins: anyio-4.15.1
collecting ... collected 8 items

tests/unit/test_install_ps1.py::test_a_rerun_passes_force_recreate_to_docker_as_one_argument FAILED [ 12%]
tests/unit/test_install_ps1.py::test_a_first_install_enrolls_then_starts_without_recreating PASSED [ 25%]
tests/unit/test_install_ps1.py::test_a_removed_laptop_rerun_is_told_so_and_stopped FAILED [ 37%]
tests/unit/test_install_ps1.py::test_a_bad_name_or_code_fails_before_the_download[env0-No join code given] FAILED [ 50%]
tests/unit/test_install_ps1.py::test_a_bad_name_or_code_fails_before_the_download[env1-That is not a join code] FAILED [ 62%]
tests/unit/test_install_ps1.py::test_a_bad_name_or_code_fails_before_the_download[env2-2 to 60 characters] FAILED [ 75%]
tests/unit/test_install_ps1.py::test_every_failure_exits_non_zero FAILED [ 87%]
tests/unit/test_install_ps1.py::test_pasted_into_an_open_window_it_sets_lastexitcode_instead_of_closing_it FAILED [100%]

=================================== FAILURES ===================================
_________ test_a_rerun_passes_force_recreate_to_docker_as_one_argument _________

tmp_path = PosixPath('/tmp/pytest-of-root/pytest-0/test_a_rerun_passes_force_recr0')
hub = '127.0.0.1:45125'

    def test_a_rerun_passes_force_recreate_to_docker_as_one_argument(tmp_path, hub):
        """The bug from issue #11: `--force-recreate` reached Docker as - - f o r c e ... and every re-run failed."""
        kit = enrolled_kit(tmp_path)
        r, argvs = run_installer(tmp_path, hub)
        assert r.returncode == 0, r.stdout + r.stderr
>       assert compose_up(argvs) == ["up", "-d", "--force-recreate"]
E       AssertionError: assert ['up', '-d', ...'f', 'o', ...] == ['up', '-d', ...rce-recreate']
E         
E         At index 2 diff: '-' != '--force-recreate'
E         Left contains 15 more items, first extra item: '-'
E         
E         Full diff:
E           [
E               'up',...
E         
E         ...Full output truncated (19 lines hidden), use '-vv' to show

tests/unit/test_install_ps1.py:109: AssertionError
______________ test_a_removed_laptop_rerun_is_told_so_and_stopped ______________

tmp_path = PosixPath('/tmp/pytest-of-root/pytest-0/test_a_removed_laptop_rerun_is0')
hub = '127.0.0.1:49697'

    def test_a_removed_laptop_rerun_is_told_so_and_stopped(tmp_path, hub):
        enrolled_kit(tmp_path)
        r, argvs = run_installer(tmp_path, hub, REGISTER_EXIT="3")
>       assert r.returncode == 1, r.stdout + r.stderr
E       AssertionError: 
E         MedChain hospital installer 1.1.0
E         -------------------------------------------
E           [ok] Docker Desktop is running
E           [ok] Tailscale is connected: this laptop is 100.101.1.7 (friend-laptop.tail1234.ts.net)
E           [ok] The hub at 127.0.0.1:49697 answers
E           [ok] 359.7 GB free on /
E         
E         Downloading the MedChain program (ghcr.io/denimworld12/medchain-node:v1.1.0, about 2 GB the first time)...
E           [ok] This laptop is already enrolled (st-marys-3f9a); keeping its keys
E         
E         
E           [!] Docker could not start the hospital.
E               What to do: If it says 'port is already allocated', another program uses port 8000: close it, or set $env:MEDCHAIN_PORT to another port and run the same command again (no new join code needed). Otherwise restart Docker Desktop and run this again.
E         
E           Fix that, then run the same command again. Nothing has been changed on this laptop.
E         ^[[31;1mGet-CimInstance: ^[[0m/w/deploy/install/install.ps1:131^[[0m
E         ^[[31;1m^[[0m^[[36;1mLine |^[[0m
E         ^[[31;1m^[[0m^[[36;1m^[[36;1m 131 | ^[[0m     $os = ^[[36;1mGet-CimInstance^[[0m Win32_OperatingSystem^[[0m
E         ^[[31;1m^[[0m^[[36;1m^[[36;1m^[[0m^[[36;1m^[[0m^[[36;1m     | ^[[31;1m           ~~~~~~~~~~~~~~~^[[0m
E         ^[[31;1m^[[0m^[[36;1m^[[36;1m^[[0m^[[36;1m^[[0m^[[36;1m^[[31;1m^[[31;1m^[[36;1m     | ^[[31;1mThe term 'Get-CimInstance' is not recognized as a name of a cmdlet,^[[0m
E         ^[[31;1m^[[0m^[[36;1m^[[36;1m^[[0m^[[36;1m^[[0m^[[36;1m^[[31;1m^[[31;1m^[[36;1m^[[31;1m^[[36;1m     | ^[[31;1mfunction, script file, or executable program. Check the spelling of the^[[0m
E         ^[[31;1m^[[0m^[[36;1m^[[36;1m^[[0m^[[36;1m^[[0m^[[36;1m^[[31;1m^[[31;1m^[[36;1m^[[31;1m^[[36;1m^[[31;1m^[[36;1m     | ^[[31;1mname, or if a path was included, verify that the path is correct and try^[[0m
E         ^[[31;1m^[[0m^[[36;1m^[[36;1m^[[0m^[[36;1m^[[0m^[[36;1m^[[31;1m^[[31;1m^[[36;1m^[[31;1m^[[36;1m^[[31;1m^[[36;1m^[[31;1m^[[36;1m     | ^[[31;1magain.^[[0m
E         ^[[31;1mInvalidArgument: ^[[0m/w/deploy/install/install.ps1:134^[[0m
E         ^[[31;1m^[[0m^[[36;1mLine |^[[0m
E         ^[[31;1m^[[0m^[[36;1m^[[36;1m 134 | ^[[0m     ^[[36;1m$env:MEDCHAIN_HOST_BOOTED_AT = [string][int64](([DateTimeOffset]$^[[0m …^[[0m
E         ^[[31;1m^[[0m^[[36;1m^[[36;1m^[[0m^[[36;1m^[[0m^[[36;1m     | ^[[31;1m     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^[[0m
E         ^[[31;1m^[[0m^[[36;1m^[[36;1m^[[0m^[[36;1m^[[0m^[[36;1m^[[31;1m^[[31;1m^[[36;1m     | ^[[31;1mCannot convert null to type "System.DateTimeOffset".^[[0m
E         no such service: -
E         
E       assert 0 == 1
E        +  where 0 = CompletedProcess(args=['pwsh', '-NoProfile', '-NonInteractive', '-File', '/w/deploy/install/install.ps1'], returncode=0, stdout="\nMedChain hospital installer 1.1.0\n-------------------------------------------\n  [ok] Docker Desktop is running\n  [ok] Tailscale is connected: this laptop is 100.101.1.7 (friend-laptop.tail1234.ts.net)\n  [ok] The hub at 127.0.0.1:49697 answers\n  [ok] 359.7 GB free on /\n\nDownloading the MedChain program (ghcr.io/denimworld12/medchain-node:v1.1.0, about 2 GB the first time)...\n  [ok] This laptop is already enrolled (st-marys-3f9a); keeping its keys\n\n\n  [!] Docker could not start the hospital.\n      What to do: If it says 'port is already allocated', another program uses port 8000: close it, or set $env:MEDCHAIN_PORT to another port and run the same command again (no new join code needed). Otherwise restart Docker Desktop and run this again.\n\n  Fix that, then run the same command again. Nothing has been changed on this laptop.\n", stderr='\x1b[31;1mGet-CimInstance: \x1b[0m/w/deploy/install/install.ps1:131\x1b[0m\n\x1b[31;1m\x1b[0m\x1b[36;1mLine |\x1b[0m\n\x1b[31;1m\x1b[0m\x1b[36;1m\x1b[36;1m 131 | \x1b[0m     $os = \x1b[36;1mGet-CimInstance\...31;1m\x1b[36;1m\x1b[31;1m\x1b[36;1m     | \x1b[31;1mfunction, script file, or executable program. Check the spelling of the\x1b[0m\n\x1b[31;1m\x1b[0m\x1b[36;1m\x1b[36;1m\x1b[0m\x1b[36;1m\x1b[0m\x1b[36;1m\x1b[31;1m\x1b[31;1m\x1b[36;1m\x1b[31;1m\x1b[36;1m\x1b[31;1m\x1b[36;1m     | \x1b[31;1mname, or if a path was included, verify that the path is correct and try\x1b[0m\n\x1b[31;1m\x1b[0m\x1b[36;1m\x1b[36;1m\x1b[0m\x1b[36;1m\x1b[0m\x1b[36;1m\x1b[31;1m\x1b[31;1m\x1b[36;1m\x1b[31;1m\x1b[36;1m\x1b[31;1m\x1b[36;1m\x1b[31;1m\x1b[36;1m     | \x1b[31;1magain.\x1b[0m\n\x1b[31;1mInvalidArgument: \x1b[0m/w/deploy/install/install.ps1:134\x1b[0m\n\x1b[31;1m\x1b[0m\x1b[36;1mLine |\x1b[0m\n\x1b[31;1m\x1b[0m\x1b[36;1m\x1b[36;1m 134 | \x1b[0m     \x1b[36;1m$env:MEDCHAIN_HOST_BOOTED_AT = [string][int64](([DateTimeOffset]$\x1b[0m …\x1b[0m\n\x1b[31;1m\x1b[0m\x1b[36;1m\x1b[36;1m\x1b[0m\x1b[36;1m\x1b[0m\x1b[36;1m     | \x1b[31;1m     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\x1b[0m\n\x1b[31;1m\x1b[0m\x1b[36;1m\x1b[36;1m\x1b[0m\x1b[36;1m\x1b[0m\x1b[36;1m\x1b[31;1m\x1b[31;1m\x1b[36;1m     | \x1b[31;1mCannot convert null to type "System.DateTimeOffset".\x1b[0m\nno such service: -\n').returncode

tests/unit/test_install_ps1.py:129: AssertionError
__ test_a_bad_name_or_code_fails_before_the_download[env0-No join code given] __

tmp_path = PosixPath('/tmp/pytest-of-root/pytest-0/test_a_bad_name_or_code_fails_0')
hub = '127.0.0.1:57831', env = {'MEDCHAIN_DISPLAY_NAME': "St Mary's"}
says = 'No join code given'

    @pytest.mark.parametrize("env, says", [
        ({"MEDCHAIN_DISPLAY_NAME": "St Mary's"}, "No join code given"),
        ({"MEDCHAIN_

... [21219 bytes truncated] ...

[0m\n\x1b[31;1m\x1b[0m\x1b[36;1m\x1b[36;1m\x1b[0m\x1b[36;1m\x1b[0m\x1b[36;1m     | \x1b[31;1m     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\x1b[0m\n\x1b[31;1m\x1b[0m\x1b[36;1m\x1b[36;1m\x1b[0m\x1b[36;1m\x1b[0m\x1b[36;1m\x1b[31;1m\x1b[31;1m\x1b[36;1m     | \x1b[31;1mCannot convert null to type "System.DateTimeOffset".\x1b[0m\n').returncode

tests/unit/test_install_ps1.py:154: AssertionError
__ test_pasted_into_an_open_window_it_sets_lastexitcode_instead_of_closing_it __

tmp_path = PosixPath('/tmp/pytest-of-root/pytest-0/test_pasted_into_an_open_windo0')
hub = '127.0.0.1:33275'

    def test_pasted_into_an_open_window_it_sets_lastexitcode_instead_of_closing_it(tmp_path, hub):
        r = subprocess.run(["pwsh", "-NoProfile", "-NoExit", "-Command",
                            f"Get-Content -Raw '{INSTALLER}' | Invoke-Expression; Write-Host \"still open, LASTEXITCODE=$LASTEXITCODE\""],
                           env=stub_env(tmp_path, hub, {"MEDCHAIN_DISPLAY_NAME": "St Mary's"}),
                           stdin=subprocess.DEVNULL, capture_output=True, text=True, timeout=120)
        assert "No join code given" in r.stdout + r.stderr
>       assert "still open, LASTEXITCODE=1" in r.stdout, r.stdout + r.stderr
E       AssertionError: 
E         MedChain hospital installer 1.1.0
E         -------------------------------------------
E           [ok] Docker Desktop is running
E           [ok] Tailscale is connected: this laptop is 100.101.1.7 (friend-laptop.tail1234.ts.net)
E           [ok] The hub at 127.0.0.1:33275 answers
E           [ok] 359.7 GB free on /
E         
E         Downloading the MedChain program (ghcr.io/denimworld12/medchain-node:v1.1.0, about 2 GB the first time)...
E         
E         Enrolling this laptop. The organiser gives you a join code (it works once, for 30 minutes).
E         
E           [!] No join code given.
E               What to do: Set $env:MEDCHAIN_JOIN_CODE to the code the organiser gave you, then run the same command again.
E         
E           Fix that, then run the same command again. Nothing has been changed on this laptop.
E         still open, LASTEXITCODE=0
E         PS /w> ^[[?1h^[[31;1mGet-CimInstance: ^[[0m
E         ^[[31;1m^[[36;1mLine |^[[0m
E         ^[[31;1m^[[36;1m^[[36;1m 131 | ^[[0m     $os = ^[[36;1mGet-CimInstance^[[0m Win32_OperatingSystem^[[0m
E         ^[[31;1m^[[36;1m^[[36;1m^[[0m^[[36;1m^[[0m^[[36;1m     | ^[[31;1m           ~~~~~~~~~~~~~~~^[[0m
E         ^[[31;1m^[[36;1m^[[36;1m^[[0m^[[36;1m^[[0m^[[36;1m^[[31;1m^[[31;1m^[[36;1m     | ^[[31;1mThe term 'Get-CimInstance' is not recognized as a name of a cmdlet, function, script file, or executable program.^[[0m
E         ^[[31;1m^[[36;1m^[[36;1m^[[0m^[[36;1m^[[0m^[[36;1m^[[31;1m^[[31;1m^[[36;1m^[[31;1mCheck the spelling of the name, or if a path was included, verify that the path is correct and try again.^[[0m
E         ^[[31;1mInvalidArgument: ^[[0m
E         ^[[31;1m^[[36;1mLine |^[[0m
E         ^[[31;1m^[[36;1m^[[36;1m 134 | ^[[0m     ^[[36;1m$env:MEDCHAIN_HOST_BOOTED_AT = [string][int64](([DateTimeOffset]$^[[0m …^[[0m
E         ^[[31;1m^[[36;1m^[[36;1m^[[0m^[[36;1m^[[0m^[[36;1m     | ^[[31;1m     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^[[0m
E         ^[[31;1m^[[36;1m^[[36;1m^[[0m^[[36;1m^[[0m^[[36;1m^[[31;1m^[[31;1m^[[36;1m     | ^[[31;1mCannot convert null to type "System.DateTimeOffset".^[[0m
E         
E       assert 'still open, LASTEXITCODE=1' in '\nMedChain hospital installer 1.1.0\n-------------------------------------------\n  [ok] Docker Desktop is running\n  [ok] Tailscale is connected: this laptop is 100.101.1.7 (friend-laptop.tail1234.ts.net)\n  [ok] The hub at 127.0.0.1:33275 answers\n  [ok] 359.7 GB free on /\n\nDownloading the MedChain program (ghcr.io/denimworld12/medchain-node:v1.1.0, about 2 GB the first time)...\n\nEnrolling this laptop. The organiser gives you a join code (it works once, for 30 minutes).\n\n  [!] No join code given.\n      What to do: Set $env:MEDCHAIN_JOIN_CODE to the code the organiser gave you, then run the same command again.\n\n  Fix that, then run the same command again. Nothing has been changed on this laptop.\nstill open, LASTEXITCODE=0\nPS /w> \x1b[?1h'
E        +  where '\nMedChain hospital installer 1.1.0\n-------------------------------------------\n  [ok] Docker Desktop is running\n  [ok] Tailscale is connected: this laptop is 100.101.1.7 (friend-laptop.tail1234.ts.net)\n  [ok] The hub at 127.0.0.1:33275 answers\n  [ok] 359.7 GB free on /\n\nDownloading the MedChain program (ghcr.io/denimworld12/medchain-node:v1.1.0, about 2 GB the first time)...\n\nEnrolling this laptop. The organiser gives you a join code (it works once, for 30 minutes).\n\n  [!] No join code given.\n      What to do: Set $env:MEDCHAIN_JOIN_CODE to the code the organiser gave you, then run the same command again.\n\n  Fix that, then run the same command again. Nothing has been changed on this laptop.\nstill open, LASTEXITCODE=0\nPS /w> \x1b[?1h' = CompletedProcess(args=['pwsh', '-NoProfile', '-NoExit', '-Command', 'Get-Content -Raw \'/w/deploy/install/install.ps1\' | Invoke-Expression; Write-Host "still open, LASTEXITCODE=$LASTEXITCODE"'], returncode=0, stdout='\nMedChain hospital installer 1.1.0\n-------------------------------------------\n  [ok] Docker Desktop is running\n  [ok] Tailscale is connected: this laptop is 100.101.1.7 (friend-laptop.tail1234.ts.net)\n  [ok] The hub at 127.0.0.1:33275 answers\n  [ok] 359.7 GB free on /\n\nDownloading the MedChain program (ghcr.io/denimworld12/medchain-node:v1.1.0, about 2 GB the first time)...\n\nEnrolling this laptop. The organiser gives you a join code (it works once, for 30 minutes).\n\n  [!] No join code given.\n      What to do: Set $env:MEDCHAIN_JOIN_CODE to the code the organiser gave you, then run the same command again.\n\n  Fix that, then run the same command again. Nothing has been changed on this laptop.\nstill open, LASTEXITCODE=0\nPS /w> \x1b[?1h', stderr='\x1b[31;1mGet-CimInstance: \x1b[0m\n\x1b[31;1m\x1b[36;1mLine |\x1b[0m\n\x1b[31;1m\x1b[36;1m\x1b[36;1m 131 | \x1b[0m     $os = \x1b[36;1mGet-CimInstance\x1b[0m Win32_OperatingSystem\x1b[0m\n\x1b[31;1m\x1b[36;1m\x1b[36;1m\x1b[0m\x1b[36;1m\x1b[0m\x1b[36;1m     | \x1b[31;1m           ~~~~~~~~~~~~~~~\x1b[0m\n\x1b[31;1m\x1b[36;1m\x1b[36;1m\x1b[0m\x1b[36;1m\x1b[0m\x1b[36;1m\x1b[31;1m\x1b[31;1m\x1b[36;1m     | \x1b[31;1mThe term \'Get-CimInstance\' is not recognized as a name of a cmdlet, function, script file, or executable program.\x1b[0m\n\x1b[31;1m\x1b[36;1m\x1b[36;1m\x1b[0m\x1b[36;1m\x1b[0m\x1b[36;1m\x1b[31;1m\x1b[31;1m\x1b[36;1m\x1b[31;1mCheck the spelling of the name, or if a path was included, verify that the path is correct and try again.\x1b[0m\n\x1b[31;1mInvalidArgument: \x1b[0m\n\x1b[31;1m\x1b[36;1mLine |\x1b[0m\n\x1b[31;1m\x1b[36;1m\x1b[36;1m 134 | \x1b[0m     \x1b[36;1m$env:MEDCHAIN_HOST_BOOTED_AT = [string][int64](([DateTimeOffset]$\x1b[0m …\x1b[0m\n\x1b[31;1m\x1b[36;1m\x1b[36;1m\x1b[0m\x1b[36;1m\x1b[0m\x1b[36;1m     | \x1b[31;1m     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\x1b[0m\n\x1b[31;1m\x1b[36;1m\x1b[36;1m\x1b[0m\x1b[36;1m\x1b[0m\x1b[36;1m\x1b[31;1m\x1b[31;1m\x1b[36;1m     | \x1b[31;1mCannot convert null to type "System.DateTimeOffset".\x1b[0m\n').stdout

tests/unit/test_install_ps1.py:168: AssertionError
=========================== short test summary info ============================
FAILED tests/unit/test_install_ps1.py::test_a_rerun_passes_force_recreate_to_docker_as_one_argument
FAILED tests/unit/test_install_ps1.py::test_a_removed_laptop_rerun_is_told_so_and_stopped
FAILED tests/unit/test_install_ps1.py::test_a_bad_name_or_code_fails_before_the_download[env0-No join code given]
FAILED tests/unit/test_install_ps1.py::test_a_bad_name_or_code_fails_before_the_download[env1-That is not a join code]
FAILED tests/unit/test_install_ps1.py::test_a_bad_name_or_code_fails_before_the_download[env2-2 to 60 characters]
FAILED tests/unit/test_install_ps1.py::test_every_failure_exits_non_zero - as...
FAILED tests/unit/test_install_ps1.py::test_pasted_into_an_open_window_it_sets_lastexitcode_instead_of_closing_it
========================= 7 failed, 1 passed in 3.66s ==========================
Evidence: Installer output and recorded docker calls: re-run, removed laptop, missing code, refused code
===== Re-run on an enrolled laptop (what a friend does after a reboot) =====
exit code: 0
--- stdout ---

MedChain hospital installer 1.1.0
-------------------------------------------
  [ok] Docker Desktop is running
  [ok] Tailscale is connected: this laptop is 100.101.1.7 (friend-laptop.tail1234.ts.net)
  [ok] The hub at 127.0.0.1:50757 answers
  [ok] 359.7 GB free on /
  [ok] This laptop is already enrolled (st-marys-3f9a); keeping its keys

Downloading the MedChain program (ghcr.io/denimworld12/medchain-node:v1.1.0, about 2 GB the first time)...


Waiting for the hub to place this hospital (up to 3s)...

Done. This laptop is running hospital st-marys-3f9a.
  - If Windows asks whether Docker Desktop Backend may use the network, tick 'Private networks' and Allow.
  - Keep the laptop plugged in, awake, and Docker Desktop and Tailscale running.
  - The organiser sees this laptop's name and live numbers on the dashboard's Nodes page within a minute.
  - Your hospital's files and keys are in /tmp/tmp2p3rx9je/MedChain (don't share that folder).

  Watch it:  docker compose --project-directory "/tmp/tmp2p3rx9je/MedChain" -f "/tmp/tmp2p3rx9je/MedChain/deploy/node.yml" logs -f
  Leave:     docker compose --project-directory "/tmp/tmp2p3rx9je/MedChain" -f "/tmp/tmp2p3rx9je/MedChain/deploy/node.yml" exec node python -m node.leave
  Stop:      docker compose --project-directory "/tmp/tmp2p3rx9je/MedChain" -f "/tmp/tmp2p3rx9je/MedChain/deploy/node.yml" down

--- docker calls ---
  docker info | --format | {{.ServerVersion}}
  docker compose | version
  docker pull | ghcr.io/denimworld12/medchain-node:v1.1.0
  docker compose | --project-directory | /tmp/tmp2p3rx9je/MedChain | -f | /tmp/tmp2p3rx9je/MedChain/deploy/node.yml | up | -d | --force-recreate
  docker compose | --project-directory | /tmp/tmp2p3rx9je/MedChain | -f | /tmp/tmp2p3rx9je/MedChain/deploy/node.yml | exec | -T | node | python | -m | node.registered

===== Re-run on a laptop the organiser removed =====
exit code: 1
--- stdout ---

MedChain hospital installer 1.1.0
-------------------------------------------
  [ok] Docker Desktop is running
  [ok] Tailscale is connected: this laptop is 100.101.1.7 (friend-laptop.tail1234.ts.net)
  [ok] The hub at 127.0.0.1:50757 answers
  [ok] 359.7 GB free on /
  [ok] This laptop is already enrolled (st-marys-3f9a); keeping its keys

Downloading the MedChain program (ghcr.io/denimworld12/medchain-node:v1.1.0, about 2 GB the first time)...


Waiting for the hub to place this hospital (up to 3s)...

  [!] The organiser removed this laptop from the network: the hub refuses its keys.
      What to do: Delete the folder /tmp/tmpb58u1_g4/MedChain, ask the organiser for a new join code, then run the same command again.

  This laptop's hospital has been stopped; nothing else was changed.

--- docker calls ---
  docker info | --format | {{.ServerVersion}}
  docker compose | version
  docker pull | ghcr.io/denimworld12/medchain-node:v1.1.0
  docker compose | --project-directory | /tmp/tmpb58u1_g4/MedChain | -f | /tmp/tmpb58u1_g4/MedChain/deploy/node.yml | up | -d | --force-recreate
  docker compose | --project-directory | /tmp/tmpb58u1_g4/MedChain | -f | /tmp/tmpb58u1_g4/MedChain/deploy/node.yml | exec | -T | node | python | -m | node.registered
  docker compose | --project-directory | /tmp/tmpb58u1_g4/MedChain | -f | /tmp/tmpb58u1_g4/MedChain/deploy/node.yml | down

===== First install with no join code =====
exit code: 1
--- stdout ---

MedChain hospital installer 1.1.0
-------------------------------------------
  [ok] Docker Desktop is running
  [ok] Tailscale is connected: this laptop is 100.101.1.7 (friend-laptop.tail1234.ts.net)
  [ok] The hub at 127.0.0.1:50757 answers
  [ok] 359.7 GB free on /

Enrolling this laptop. The organiser gives you a join code (it works once, for 30 minutes).

  [!] No join code given.
      What to do: Set $env:MEDCHAIN_JOIN_CODE to the code the organiser gave you, then run the same command again.

  Fix that, then run the same command again. Nothing has been changed on this laptop.

--- docker calls ---
  docker info | --format | {{.ServerVersion}}
  docker compose | version

===== First install with a refused join code =====
exit code: 1
--- stdout ---

MedChain hospital installer 1.1.0
-------------------------------------------
  [ok] Docker Desktop is running
  [ok] Tailscale is connected: this laptop is 100.101.1.7 (friend-laptop.tail1234.ts.net)
  [ok] The hub at 127.0.0.1:50757 answers
  [ok] 359.7 GB free on /

Enrolling this laptop. The organiser gives you a join code (it works once, for 30 minutes).

Downloading the MedChain program (ghcr.io/denimworld12/medchain-node:v1.1.0, about 2 GB the first time)...

  [!] Enrollment failed (the reason is just above).
      What to do: If the code expired, was used or was mistyped, ask the organiser for a new join code, then run the same command again.

  Fix that, then run the same command again. Nothing has been changed on this laptop.

--- docker calls ---
  docker info | --format | {{.ServerVersion}}
  docker compose | version
  docker pull | ghcr.io/denimworld12/medchain-node:v1.1.0
  docker run | --rm | -v | /tmp/tmppes78ss_/MedChain:/kit | -e | MEDCHAIN_JOIN_CODE | -e | MEDCHAIN_DISPLAY_NAME | -e | MEDCHAIN_HOST_NAME | -e | MEDCHAIN_HOST_OS | -e | MEDCHAIN_HOST_BOOTED_AT | -e | MEDCHAIN_TAILSCALE_DEVICE | ghcr.io/denimworld12/medchain-node:v1.1.0 | python | -m | node.enroll | --hub | 127.0.0.1:50757 | --advertise | 100.101.1.7 | --port | 8000 | --out | /kit | --image-version | v1.1.0 | --image | ghcr.io/denimworld12/medchain-node | --also | friend-laptop.tail1234.ts.net
Evidence: install.sh and provision.py tests
============================= test session starts ==============================
platform linux -- Python 3.12.15, pytest-9.1.1, pluggy-1.6.0 -- /usr/local/bin/python3
rootdir: /w
configfile: pytest.ini
plugins: anyio-4.15.1
collecting ... collected 25 items

tests/unit/test_install_sh.py::test_an_unattended_install_enrolls_and_starts_the_hospital PASSED [  4%]
tests/unit/test_install_sh.py::test_an_unattended_install_reports_why_enrollment_failed PASSED [  8%]
tests/unit/test_install_sh.py::test_an_unattended_install_with_a_taken_name_stops_instead_of_asking PASSED [ 12%]
tests/unit/test_install_sh.py::test_a_bad_name_or_code_fails_before_the_download[env0-No join code given] PASSED [ 16%]
tests/unit/test_install_sh.py::test_a_bad_name_or_code_fails_before_the_download[env1-That is not a join code] PASSED [ 20%]
tests/unit/test_install_sh.py::test_a_bad_name_or_code_fails_before_the_download[env2-2 to 60 characters] PASSED [ 24%]
tests/unit/test_install_sh.py::test_a_bad_name_or_code_fails_before_the_download[env3-No hospital name given] PASSED [ 28%]
tests/unit/test_install_sh.py::test_a_rerun_with_medchain_port_moves_the_enrolled_node_without_a_new_code PASSED [ 32%]
tests/unit/test_install_sh.py::test_a_hospital_the_organiser_removed_is_told_so_instead_of_done PASSED [ 36%]
tests/unit/test_provision.py::test_kit_has_every_file_with_the_real_addresses_and_only_its_own_keys PASSED [ 40%]
tests/unit/test_provision.py::test_one_run_provisions_every_hospital_and_the_hub PASSED [ 44%]
tests/unit/test_provision.py::test_hub_kit_inside_the_repo_is_named_relative_to_it_and_a_magicdns_hub_listens_everywhere PASSED [ 48%]
tests/unit/test_provision.py::test_observer_address_and_token_flags PASSED [ 52%]
tests/unit/test_provision.py::test_the_node_yml_environment_and_the_example_env_load_as_a_node PASSED [ 56%]
tests/unit/test_provision.py::test_adding_a_hospital_later_reuses_the_network_and_admits_it PASSED [ 60%]
tests/unit/test_provision.py::test_a_changed_address_gets_a_new_certificate PASSED [ 64%]
tests/unit/test_provision.py::test_the_organisers_own_hospital_alone_is_enough_when_join_codes_add_the_rest PASSED [ 68%]
tests/unit/test_provision.py::test_rejects_bad_peer_lists[ , -extra0] PASSED [ 72%]
tests/unit/test_provision.py::test_rejects_bad_peer_lists[hospital-a=10.0.0.1:8001,hospital-a=10.0.0.2:8001-extra1] PASSED [ 76%]
tests/unit/test_provision.py::test_rejects_bad_peer_lists[hospital-a=ftp://10.0.0.1:8001,hospital-b=10.0.0.2:8002-extra2] PASSED [ 80%]
tests/unit/test_provision.py::test_rejects_bad_peer_lists[hospital-a=http://10.0.0.1:8001,hospital-b=10.0.0.2:8002-extra3] PASSED [ 84%]
tests/unit/test_provision.py::test_rejects_bad_peer_lists[hospital-a=10.0.0.1:8001,directory=10.0.0.2:8002-extra4] PASSED [ 88%]
tests/unit/test_provision.py::test_rejects_bad_peer_lists[hospital-a=10.0.0.1:8001,hospital-b=10.0.0.2:8002-extra5] PASSED [ 92%]
tests/unit/test_provision.py::test_rejects_a_plain_http_directory PASSED [ 96%]
tests/unit/test_provision.py::test_refuses_to_overwrite_a_kit_unless_forced PASSED [100%]

============================== 25 passed in 4.13s ==============================
Evidence: Image workflow check: old grep vs new jq on the real v1.1.0 manifest list
$ docker buildx imagetools inspect "$IMAGE:$VERSION" --format "{{json .Manifest.Manifests}}" | head -c 600
[
  {
    "mediaType": "application/vnd.oci.image.manifest.v1+json",
    "digest": "sha256:b6f0cb1eddb1b4e92d249f26b559f0bfedcb2995a01b962cd8d9279108c9d4e3",
    "size": 3338,
    "platform": {
      "architecture": "amd64",
      "os": "linux"
    }
  },
  {
    "mediaType": "application/vnd.oci.image.manifest.v1+json",
    "digest": "sha256:478c91ef9184eb81c9a8e882cce4314cadb4fd37e2a74c3e1fcddd9f78ee77a6",
    "size": 838,
    "annotations": {
      "vnd.docker.reference.digest": "sha256:b6f0cb1eddb1b4e92d249f26b559f0bfedcb2995a01b962cd8d9279108c9d4e3",
      "vnd.docker.reference.type": "at

--- OLD check (grep -q "\"architecture\":\"arm64\"") ---
exit=1
--- NEW check (jq -e ...) ---
true
exit=0
--- NEW check against an amd64-only list (should fail) ---
false
exit=1
- Outcome: ⚠️ 2 warnings across 1 run (22m42s)

What was verified live vs. only reviewed

Live-verified

  • install.ps1 re-run (the critical splat bug): real PowerShell 7.4.6 running the installer against a docker stub that records the exact argv and rejects unknown services the way Docker Compose does (tests/unit/test_install_ps1.py). The base commit's installer reproduces the issue exactly: Docker got up -d - - f o r c e - r e c r e a t e, said no such service: -, and the script exited 0. With the fix it gets up -d --force-recreate and finishes with "Done". The same harness covers: a removed laptop's re-run shows the removal message, stops the node, exits 1, and no longer says "Nothing has been changed"; a missing or malformed join code or a bad name is refused before docker pull; every failure exits 1, including pwsh -Command "... | iex"; and pasting into an open window (-NoExit) sets $LASTEXITCODE=1 without closing it.
  • Node image workflow check: the new jq check passes on the real published v1.1.0 and v1.0.0 manifest lists (amd64 + arm64) and fails on a one-architecture list. The old grep failed because the JSON is pretty-printed ("architecture": "arm64", with a space).
  • Copy buttons: clicked in a browser (vite dev server with a mock join-codes API). The code and the Windows install command reached the clipboard, and the button changed to "Copied".
  • Single-hospital provisioning inside the node image (Docker only, no host Python): ran the documented docker run --rm -v "${PWD}:/src" -w /src <image> python scripts/provision.py --zip --peers hospital-a=... --directory ... and it wrote the hospital kit, the directory kit with hub.env, and a hospitals.yaml holding one hospital. It used the local v1.0.0 image, because the 2 GB v1.1.0 download didn't finish in time. The script and code come from the mounted repo folder, so only the image's Python and libraries matter, and those requirements are the same.

Only reviewed against the code (not driven here)

  • Starting the hub without make: the documented docker compose --project-directory . --env-file kits/directory/hub.env -f deploy/hub.yml up -d --wait is exactly the command make hub runs (Makefile hub: target), and the issue reporter ran it successfully (healthy in 94 s). It wasn't started here because another hub was already running on this machine on the same ports.
  • Windows PowerShell 5.1: not available here. The splat fix is the one the reporter verified live on 5.1. The new code uses only 5.1-compatible features ($PSCommandPath, -cmatch, [Environment]::GetCommandLineArgs(), Get-Command Get-CimInstance as a guard).
  • install.sh (macOS/Linux): the same checks now run before the download, covered by tests/unit/test_install_sh.py with stubs (not live).
  • Organiser's own kit hospital on the Nodes page: not fixed. It's documented in the README as a known limit (out of scope: it needs a new way to pass host facts in on the kit path).

The proof for anything left unverified here is the issue #11 reporter re-running on a real Windows 11 laptop.

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

⚠️ **Review** - 1 info
  • ⚠️ README.md:615 - The README says the 'Only Docker installed' provision command "works in PowerShell and in a Mac or Linux terminal", but the example breaks across lines with a trailing \, and PowerShell does not treat that as a line continuation. On the Windows organiser laptop this section is written for, line 1 runs the container with \ as its command and fails, then line 2 runs python scripts/provision.py ... on the host, which has no Python. That is the same dead end issue v1.1.0: install.ps1 re-run always fails on Windows (--force-recreate splatted per character); organiser setup needs Python/make #11 reported. Fix: put the command on one line, as docs/MULTI_LAPTOP.md already does.
  • ℹ️ scripts/provision.py:35 - Two problems in the new docker-run example in the provision.py module docstring. First, the next paragraph was joined onto the code line (--directory ... Every link is HTTPS: each address goes into that hospital&#39;s), so the example and the prose are both garbled. Second, the docstring is not raw and uses a single \ before the newline, which Python reads as a line continuation inside the string, so the rendered text loses the break. The earlier example uses \\ for this reason. Fix: use \\ and put the prose back in its own paragraph.
  • ⚠️ README.md:791 - The intent asks for issue v1.1.0: install.ps1 re-run always fails on Windows (--force-recreate splatted per character); organiser setup needs Python/make #11's real findings to be fixed, and lists this one: "a hospital started from a kit (the organiser's own) shows the container's hostname and Linux/WSL2 on the Nodes page instead of the laptop's details". The change does not fix it. It only adds a README note ("Another: a hospital started from a kit ... shows what its container sees, the container's hostname and the Docker VM's Linux"). Please confirm that documenting this as a known limit is acceptable for this change, or whether kit-started nodes should get the host's facts (for example MEDCHAIN_HOST_* filled in when the kit is started).

🔧 Fix applied.
1 info still open:

  • ℹ️ README.md:618 - Since the fix round, the sentence "The command writes kits/hospital-a/ ... kits/hospital-d/" comes right after the new docker example. That example passes only --peers hospital-a=..., so it writes kits/hospital-a/ and kits/directory/ and nothing for hospitals b to d. Someone reading top to bottom will expect four hospital kits. Fix: say "the commands above write one kit per hospital in --peers (kits/hospital-a/ ...)", or move the docker paragraph below this sentence.
⚠️ **Test** - 2 warnings
  • ⚠️ Most of this change was not checked against the running product. The Windows installer was only run under pwsh 7 on Linux with fake docker and tailscale. Three parts were not driven at all: provisioning with only Docker (one hospital, run inside the published image), starting the hub with plain docker compose, and the Join codes Copy buttons, which have no screenshot. The 2 GB v1.1.0 image download was stopped at its time limit before it finished. Please decide whether to re-run local testing once the image is downloaded and a Windows machine is available, or rely on manual checking.
  • ⚠️ live validation verdict: inconclusive (1 of 8 scenarios were driven live against the product); untested: A friend re-runs the Windows install command on an enrolled laptop: docker compose up gets -d --force-recreate as separate whole arguments and the hospital starts ('Done'), A laptop the organiser removed re-runs the installer: it shows the removal message, stops the node, exits 1, and does not say 'Nothing has been changed', A friend runs the installer with no join code or a malformed code or name: it is refused before the 2 GB image is downloaded, with exit 1, Any installer failure exits non-zero, and a paste into an open window sets LASTEXITCODE instead of closing it, An organiser with only Docker runs the documented docker run ... medchain-node:v1.1.0 python scripts/provision.py --zip --peers &lt;own hospital only&gt; --directory ... and gets kits including kits/directory/hub.env, The organiser starts the hub without make, using docker compose --project-directory . --env-file kits/directory/hub.env -f deploy/hub.yml up -d --wait, On the dashboard's Join codes page the organiser presses Copy on the code and on the install commands and sees 'Copied'
  • Live validation: ⚠️ inconclusive - 1 of 8 scenarios driven live against the product
Scenario Result Live Evidence
A friend re-runs the Windows install command on an enrolled laptop: docker compose up gets -d --force-recreate as separate whole arguments and the hospital starts ('Done') ⏸️ untested no The earlier run did not establish a live result: real PowerShell 7.4.6 ran the real install.ps1, but docker and tailscale were fakes (see install_ps1_transcripts.txt and test_a_rerun_passes_force_recr…
A laptop the organiser removed re-runs the installer: it shows the removal message, stops the node, exits 1, and does not say 'Nothing has been changed' ⏸️ untested no The earlier run did not establish a live result: docker was a fake and the hub's refusal was simulated with an exit code (install_ps1_transcripts.txt). A live run needs a running hub that has removed…
A friend runs the installer with no join code or a malformed code or name: it is refused before the 2 GB image is downloaded, with exit 1 ⏸️ untested no The earlier run did not establish a live result: a fake docker recorded the calls instead of downloading (install_ps1_transcripts.txt showed no 'docker pull'; test_a_bad_name_or_code_fails_before_the_…
Any installer failure exits non-zero, and a paste into an open window sets LASTEXITCODE instead of closing it ⏸️ untested no The earlier run did not establish a live result: only unit tests ran (test_every_failure_exits_non_zero, test_pasted_into_an_open_window_it_sets_lastexitcode_instead_of_closing_it), with a fake docker…
Image workflow 'check it' step: the new jq check passes on the real published v1.1.0 (amd64 + arm64) and fails when arm64 is missing ✅ pass live image_workflow_check.txt
An organiser with only Docker runs the documented docker run ... medchain-node:v1.1.0 python scripts/provision.py --zip --peers &lt;own hospital only&gt; --directory ... and gets kits including kits/direc… ⏸️ untested no The 2 GB v1.1.0 image download was stopped at its time limit before it finished. Only the unit test test_the_organisers_own_hospital_alone_is_enough_when_join_codes_add_the_rest ran (it passed). Re-ru…
The organiser starts the hub without make, using docker compose --project-directory . --env-file kits/directory/hub.env -f deploy/hub.yml up -d --wait ⏸️ untested no This depends on the provisioned kit from the previous scenario, which needs the image that was not downloaded. It also needs ports free of the medchain-hub stack already running on this host.
On the dashboard's Join codes page the organiser presses Copy on the code and on the install commands and sees 'Copied' ⏸️ untested no This needs the hub from the previous scenario running with MEDCHAIN_ADMIN_PASSWORD set, then a browser to log in, create a code and click Copy. It was not reached because the image download was stoppe…
  • docker run medchain-pwsh-test2 ... python3 -m pytest -v tests/unit/test_install_ps1.py against the target install.ps1 (8 passed)
  • Same pytest run with the base commit's install.ps1 swapped in (7 of 8 failed, including 'no such service: -' and exit code 0 on failures)
  • Manual transcripts from real pwsh 7.4.6 with docker/tailscale stubs: enrolled re-run, removed-laptop re-run, missing join code, refused join code
  • python3 -m pytest -v tests/unit/test_install_sh.py tests/unit/test_provision.py in a container (25 passed)
  • docker buildx imagetools inspect ghcr.io/denimworld12/medchain-node:v1.1.0 --format &#39;{{json .Manifest.Manifests}}&#39; piped to the old grep check (exit 1) and the new jq check (true, exit 0), plus a negative jq run on an amd64-only list (false, exit 1)
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

…Docker (#11)

- install.ps1: keep --force-recreate an array (@(if ...)) so a re-run no longer
  hands Docker "- - f o r c e ..." ("no such service: -"); the removed-laptop
  check after it now surfaces, and ends "has been stopped", not "nothing changed"
- install.ps1: exit 1 on every failure (run as a file or a one-off -Command);
  pasted into an open window it sets $LASTEXITCODE instead of closing it
- install.ps1 / install.sh: ask for and check the name and the join code's
  format before the 2 GB image download
- tests/unit/test_install_ps1.py: runs the installer in real pwsh with a docker
  stub that records the exact argv and rejects unknown services like Compose
- provision.py: one hospital is enough when join codes add the rest; documented
  running it inside the published image, and the plain docker compose command
  next to make hub
- Join codes page: copy buttons for the code and both install commands
- Node image workflow: check the manifest's architectures with jq (the JSON is
  pretty-printed, so the grep never matched)
- README: kit hospitals show their container's facts on Nodes (known limit)
@Denimworld12

Copy link
Copy Markdown
Owner Author

Live verification of 23ce65d on Windows (the 7 scenarios marked ⏸️ untested)

Setup

  • Windows 11, Windows PowerShell 5.1.26100, real Docker Desktop and a real Tailscale IP, a real hub, and the published v1.1.0 image. No fakes.
  • Organiser: followed the PR's docs from a source copy of this branch.
  • Friend: this branch's install.ps1, served locally as text/plain (like raw.githubusercontent) and run with irm … | iex, the same shape as the dashboard command.

Organiser with only Docker

Scenario Result
docker run --rm -v "${PWD}:/src" -w /src …:v1.1.0 python scripts/provision.py --zip --peers "hospital-a=<ip>:8001" --directory "<ip>:8100", one hospital ✅ exit 0. Wrote kits/directory and kits/hospital-a (plus zips).
Hub without make: docker compose --project-directory . --env-file kits/directory/hub.env -f deploy/hub.yml up -d --wait ✅ all 4 services healthy
Own hospital without make: docker compose --project-directory kits/hospital-a -f kits/hospital-a/deploy/node.yml up -d ✅ registered, epoch 1
Join codes page in Chrome: Copy the code and Copy the Windows command ✅ The button changes to "Copied". The Windows clipboard held exactly the code, then the one-line command with the hub address.

Friend's installer on PS 5.1

Scenario Result
Name given, no code ✅ No join code given. Exit 1 in 1 s, before the download, no folder left.
Malformed code ABCD-1234 ✅ That is not a join code…. Exit 1, before the download.
1-character name ✅ …must be 2 to 60 characters. Exit 1, before the download.
Taken name (hospital a, unattended) ✅ That name is taken, exit 1. The code wasn't spent: it enrolled a hospital later (last row).
First install, name typed at the prompt (first X, then a real name), code from env ✅ X was rejected and the second line was used. Enrolled Riverside Clinic, Done, exit 0.
Re-run on the enrolled laptop (the #11 bug) ✅ keeping its keys → container recreated → Done, exit 0
Paste into an open window (powershell with no -File/-Command), failing run ✅ The window stays open: STILL OPEN; LASTEXITCODE=1
The same failure as powershell -Command "irm … | iex; 'AFTER'" ✅ Exit 1; AFTER isn't printed
Organiser Remove, then the friend re-runs ✅ The organiser removed this laptop… + This laptop's hospital has been stopped; nothing else was changed. Exit 1, container gone.
Recovery: delete MedChain, the unspent code, the same name ✅ Enrolled riverside-clinic-38bf, Done. The next run completed with missing: [].

Training with the organiser plus the friend completed with missing: [], before the Remove and again after the recovery.

Must do: merging alone doesn't reach friends

Every friend-facing reference still points at the v1.1.0 tag and image:

  • the dashboard default INSTALLER_VERSION (dashboard/server/index.js:29, deploy/hub.yml:114);
  • $InstallerVersion = "1.1.0" in install.ps1 and INSTALLER_VERSION=1.1.0 in install.sh, which also pick the image tag;
  • IMAGE_VERSION defaults in hub.yml, node.yml and the .env examples;
  • the URLs in the docs.

So after merging, the Join codes page still hands out the old, broken install.ps1. To fix it:

  1. Bump all of these to a new version (e.g. v1.1.1).
  2. Merge.
  3. Push the tag, so the image workflow publishes medchain-node:v1.1.1 and the raw URL exists.

Should fix: a laptop enrolled with an older hub is told "Done"

What happened: my first runs here found a MedChain folder left over from a previous hub at the same address, which the organiser had since re-provisioned with a new CA. The installer said already enrolled… keeping its keys → waited 60 s → it has not reached the hub yet; it keeps trying by itself → Done with exit 0.

What the node actually logs, forever:

directory registration failed (https://100.109.218.85:8100/register unreachable (ConnectError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate signature failure)); retrying in 15s

Why it matters: this happens whenever an organiser rebuilds the hub (new kits, or down -v) and friends re-run the command.

Suggested fix: have the node report registration: refused (or a new wrong_network) when the directory's certificate doesn't verify against the enrolled CA. The installer would then say: "This laptop was enrolled with a different hub: delete the folder …, ask for a new join code". Separately, the node's own log line should say "certificate mismatch", not "unreachable".

Nits

Not covered

  • install.sh live (no Mac here; its unit tests pass in CI).
  • Two physical machines.
  • Typing the hidden join code into a real console window (the code came from MEDCHAIN_JOIN_CODE; the name was typed at the prompt).

Verdict: the code changes work as described on real Windows 5.1. Approve once the version bump (must do) is done; the older-hub "Done" (should fix) can follow.

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.

1 participant