diff options
| author | Christophe Besson <cbesson@gmail.com> | 2026-09-14 23:51:36 +0200 |
|---|---|---|
| committer | Christophe Besson <cbesson@gmail.com> | 2026-09-14 23:51:36 +0200 |
| commit | e12570f9d1aa2645e6bb223b1417fa0e81957b65 (patch) | |
| tree | d3eda196ed925dc4fbedcb7671b38bd1f05f552d /packages/meshbay-hub/tests/test_transport_contracts.py | |
| parent | cd2745cecff12e894e0dfa702bff6a90f0e8734e (diff) | |
| download | meshbay-e12570f9d1aa2645e6bb223b1417fa0e81957b65.tar.gz | |
fix(win): a service-mode daemon can be replaced, and the Node page can link one
Two live-reproduced bugs in Windows node start/stop, found sideloading the
0.14.0 build:
- node:start's crash-recovery step killed a service-mode daemon with
taskkill/CTRL_BREAK, both of which fail with "Access is denied" against a
process running under the Scheduled Task's own S4U logon session (a
different session from the Electron app's). The daemon it was meant to
replace just kept running, unreplaced, and schtasks /run on a task Windows
still considered Running was then a silent no-op too. Route through
winServiceTaskEnd() (schtasks /end) first, the way nodeServiceStop/
nodeServiceRestart already correctly do. service-mode.ps1 also now starts
the task right after registering it -- Register-ScheduledTask's own
AtStartup trigger does not run it immediately, so nothing was listening
until the next reboot.
- The Node page's Start button called node.start() with no arguments, so an
unlinked node (a fresh install, or one whose hub-side link was lost) could
never link on Start alone -- only create-group-page.js's own call passed
{hubUrl, username, token}. Reproduced on a fresh non-service install signed
in to the real hub: Start hung for ~105s and failed with "could not link",
pointing at a "Link Node" control that lives on Settings, not the Node
page (that message is fixed too).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Diffstat (limited to 'packages/meshbay-hub/tests/test_transport_contracts.py')
| -rw-r--r-- | packages/meshbay-hub/tests/test_transport_contracts.py | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/packages/meshbay-hub/tests/test_transport_contracts.py b/packages/meshbay-hub/tests/test_transport_contracts.py index ab942e4..f780073 100644 --- a/packages/meshbay-hub/tests/test_transport_contracts.py +++ b/packages/meshbay-hub/tests/test_transport_contracts.py @@ -534,3 +534,53 @@ def test_search_connects_in_one_place(): index = code[code.index("async function fetchGroupIndex("): code.index("async function fetchAllIndexes(")] assert "connectToGroup(" in pool and "connectToGroup(" in index + + +# node:start only links an unlinked node key to the hub account when it is +# given credentials to link it with (main.js's linkNodeKeyAndAwaitRunning on +# Windows, the equivalent inline block on Linux -- both gate on `opts.token`). +# create-group-page.js's own startNode() passes {hubUrl, username, token}; +# the Node page's Start button, reachable independently of that wizard, +# passed none. Reproduced live 2026-09-14 on a fresh non-service Windows +# install signed in to the real hub: Start on a node that had never been +# linked (the ordinary state for anyone who has not gone through Create +# Group yet) polled for up to 105s and failed with "could not link" -- +# cross-platform, since both mains share this same frontend call. +NODE_PAGE = STATIC / "node-page.js" + + +@pytest.fixture(scope="module") +def node_page(): + return NODE_PAGE.read_text(encoding="utf-8") + + +def test_node_page_start_button_can_link_an_unlinked_node(node_page): + fn = node_page[node_page.index("function NodeServicePanel("):] + fn = fn[:fn.index("\nfunction ") if "\nfunction " in fn else len(fn)] + start_call = fn[fn.index("act('start'"):] + start_call = start_call[:start_call.index(")}>")] + assert "hubUrl" in start_call and "HUB" in start_call, ( + "the Start button must pass hubUrl (HUB) through to node:start, or " + "an unlinked node can never link on Start alone") + assert "username" in start_call and "token" in start_call, ( + "the Start button must pass username and token through to " + "node:start -- linkNodeKeyAndAwaitRunning needs both to PUT the key") + + assert "import { HUB" in node_page or "import {HUB" in node_page, ( + "HUB must come from hub-client.js, the one file allowed to decide " + "where the hub is" + ) + + +def test_node_page_receives_the_session_it_hands_to_start(): + """app.js is what actually has to hand token/username down; a fixed + node-page.js reading them off undefined props is the same bug moved up + one file.""" + app_src = APP.read_text(encoding="utf-8") + marker = "route === '/node' && platform.capabilities.nodeAdmin" + route = app_src[app_src.index(marker):] + route = route[:route.index(";")] + assert "LazyNodePage" in route + assert "token=" in route and "username=" in route, ( + "app.js renders the Node page without the session NodeServicePanel " + "now expects, so its Start button's opts are undefined again") |