oliver-zehentleitner / maity
cli: `maity resume --hub` on a joined clone keeps the stored hub (refuse another origin)
tsk-h1kcv3bd82gg Done Maity Coder Claude 004
On a clone that has already joined, maity resume --hub <url> replaces the hub stored in the clone's state and saves it. A clone's hub should change only through a new join.
Done when:
maity resume --hub(and every other command that takes--hub) on a clone whose state already names a hub is refused unless the URL has the same origin as the stored one, with a clear message that names the stored hub's origin and says a new join is the way to change it; nothing is written.- A first join from the page, where no state exists yet, works as before.
- Tests: another origin on a joined clone is refused and state.json is unchanged, byte for byte; the same origin passes; a first join passes.
- cli/README.md and the help text say it; changelog fragment; a Keep the Why entry on why the hub is fixed per clone.
Security leg on the PR.
Notes
Maity Test Team · Nov 21, 2026, 09:37 UTC
#2065 tester result (maity-test-team#mmza), self-picked.
Build: origin/main
4da566f12db4cead265d784a3fa48f8199302537(the change landed in59237fc5aedc769fbac5c638555d1f4546473c91). CLI from a scratch full tree at that commit, venv fromcli/requirements/dev.txt(hash-pinned) plus an editable install:maity 0.1.0a17(archive, build unknown). Local FakeHub on loopback HTTP only. No prod writes; prod was not contacted.Result: pass.
Unit tests in
cli/tests/test_cli.pyfor this card: 46 passed, 0 failed (185 deselected in that file), 12.77s. That includes the origin tables,--hubrefusal and same-origin cases forresumeandhelp, first join from the page,joinas the way to another hub, fail-closedhelp --hub, IPv6 spelling, empty userinfo, and the placed-session rules.Behavioural checks against the venv
maitybinary and a local FakeHub, with a throwaway clone and a dedicatedMAITY_STATE_DIR(not the team state directory): 18 passed, 0 failed.resume --hubandhelp --hubwith another host, and with the same host on another port: exit 4; the message names the stored hub and the given URL as another origin, and says the hub changes only by a new join (maity join <url> --code <code>); every file in the state directory unchanged (sha256); nothing sent to the fake hub. 4/4.- Same origin with four spellings (exact URL, trailing slash, a path, scheme in uppercase): exit 0 for both commands; the stored hub URL stayed as it was. 8/8, plus a check that the stored spelling was kept.
- First
resume --hubwith only the page-driven credential and nostate.json: exit 0, the hub is stored. - After the credential is removed,
maity jointo the fake hub stores that hub (exit 0,--no-resume). - Under
MAITY_PLACEMENT=plc-0003:maity joinis refused (exit 4, nothing sent, state unchanged);resume --hubandhelp --hubwith no stored hub are refused (exit 4, nothing fetched).
Help text for
resume --hubandhelp --hub, andcli/README.md, state the rule.Contrast, not this build: the installed CLI 0.1.0a10 (build 18b31f993fa6) still accepts
--hubfor another origin. Against a reachable second loopback hub it exited 0 and rewrote the stored hub to that other origin. Against an unreachablehttps://elsewhere.exampleit exited 1 with an SSL error and did not rewrite the hub; it did create anenv-secretfile. I did not upgrade the installed CLI.Not tested: prod (read or write); IDNA, trailing-dot and IPv6 canonicalisation at the process CLI (those tables are in the unit tests, all passed);
help --hubfail-closed when git cannot read a clone (unit tests, passed); writingstate.jsonby hand.I am not claiming or closing the card.