Answer stability round 1: 0 🔴, 2 🟡 (0 misread); name the signed-out check beside its message, and report a signal as a shell does; the 🟢 for a claude that cannot start is declined, as the home's build fails first
This commit is contained in:
@@ -19,7 +19,7 @@ LINKED = ("CLAUDE.md", "agents", "bin", "principles", "rules", "skills")
|
||||
CLONE = "{clone}"
|
||||
# Stands for the reports folder, which holds every chunk's review folder, in the clone's settings.json. Every value that holds it is a path, so unlike CLONE it isn't shell-quoted.
|
||||
REPORTS = "{reports}"
|
||||
# What `unready` says first where nobody has signed in to the home yet; `claude-release` runs there anyway, since /login is typed in that claude.
|
||||
# What `unready` says first where nobody has signed in to the home yet.
|
||||
SIGNED_OUT = "nobody is signed in to the loop's Claude home"
|
||||
# The file in the home that names the clone, its commit and the reports folder the home was built from.
|
||||
BUILT_FROM = "built-from"
|
||||
@@ -50,6 +50,11 @@ def unready(home: pathlib.Path, clone: pathlib.Path, reports: pathlib.Path, clau
|
||||
return f"{SIGNED_OUT}; run `CLAUDE_CONFIG_DIR={shlex.quote(str(home))} claude` and type /login there, once"
|
||||
|
||||
|
||||
def only_signed_out(reason: str) -> bool:
|
||||
"""Whether a reason `unready` gave is that nobody has signed in yet, which is typed away in a claude that runs in the home."""
|
||||
return reason.startswith(SIGNED_OUT)
|
||||
|
||||
|
||||
def signed_in(status: str) -> bool | None:
|
||||
"""Whether `claude auth status` printed that someone is signed in, by a /login or by a token in the environment; None where it printed no such answer."""
|
||||
try:
|
||||
|
||||
@@ -8,7 +8,7 @@ import unittest
|
||||
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
|
||||
|
||||
from failure import Failure
|
||||
from claude_home.home import unready
|
||||
from claude_home.home import only_signed_out, unready
|
||||
|
||||
SETTINGS = {
|
||||
"enabledPlugins": {"code-review@official": True, "frontend-design@official": False, "lsp@other": True},
|
||||
@@ -141,6 +141,7 @@ class Home(unittest.TestCase):
|
||||
self.status = SIGNED_OUT
|
||||
|
||||
self.assertEqual(self.unready(), f"nobody is signed in to the loop's Claude home; run `CLAUDE_CONFIG_DIR={self.home} claude` and type /login there, once")
|
||||
self.assertTrue(only_signed_out(self.unready() or ""))
|
||||
|
||||
def test_a_status_that_says_nobody_is_signed_in_or_out_quotes_what_claude_said(self) -> None:
|
||||
for stdout, stderr, said in (("", "Error: the settings\nare broken\n", "Error: the settings are broken"), ("Not logged in\n", "", "Not logged in"), ('{"authMethod": "none"}', "", '{"authMethod": "none"}'), ("3", "", "3"), ('{"loggedIn": "yes"}', "", '{"loggedIn": "yes"}'), ("", "", "it printed nothing and exited 1")):
|
||||
@@ -192,6 +193,7 @@ class Home(unittest.TestCase):
|
||||
reason = unready(self.home, self.clone, self.reports, missing, lambda *args, cwd=None: "1a2b3c\n")
|
||||
|
||||
self.assertEqual(reason, f"could not build the loop's Claude home, {self.home}: [Errno 2] No such file or directory: 'claude'")
|
||||
self.assertFalse(only_signed_out(reason))
|
||||
|
||||
def test_a_claude_that_is_stopped_after_its_time_stops(self) -> None:
|
||||
def stalled(args: list[str]) -> subprocess.CompletedProcess[str]:
|
||||
|
||||
Reference in New Issue
Block a user