GeezerVison is showing github.com — hold-work: guard a held or stopped copy's home in the CLI; tests and docs (#313 follow-ups) · Issue #368 · scuttletoby/t3code
hold-work: guard a held or stopped copy's home in the CLI; tests and docs (#313 follow-ups) #368
Description
Follow-ups from the two round-2 SAFE lenses on #313 (hold-work: a held server does not start T3 Connect; fixes #190): state #313 (comment) and security #313 (comment). Recommendation: one PR for 1-3 (a marker file makes 2 and 3 cheap); 4 and 5 are docs.
- The CLI refusal has no test at its call site (
cli/connect.ts ~512-514, in disconnectCloud). Deleting the call keeps every test green (both lenses' mutation). A later upstream merge could drop it, and t3 connect unlink on a held home would send the relay delete again. Add a connect.test.ts case: unlink on a held home is refused and no relay delete is sent.
- A stopped (or never started) copy is protected only by the docs. Unlink or logout pointed at a copy's home still deletes the live link, because the copy keeps the live server's link files and
server-runtime.json. Cheap guard: the held boot (or the copy step) writes a marker file in the copy's home; the CLI refuses unlink/logout whenever it exists, running or not; only an explicit flag or removing the marker clears it.
t3 connect link and t3 up turning Connect on are not refused on a held copy's home (possible, not proven): a refresh of an expired copied sign-in token may rotate it and break the live home's token. Add the same refusal (and the marker from 2) on the CLI link path.
- Docs: a managed policy that turns Connect off makes
CloudLink.make unlink at start-up, before the wrapper exists, so a held start can delete the copy's own link files (nothing reaches the relay). The docs and PR body say a held start "changes no link file": add this exception. Also list HeldHooksWaker among the relay readers (safe: it runs only when a tunnel connects).
- Test nit: in the boot test, "relay reached after the normal start" is already met by agent activity requests, so it does not show that stopping released the tunnel; assert on the tunnel registration itself.
State question for the fix: what happens when the copy is started twice, stopped half-way through start-up, or made from a home linked before this change?
🤖 Generated with Claude Code
Metadata
Metadata
Development
No branches or pull requestsIssue actions