Answer stability round 1: 0 🔴, 2 🟡 (0 misread); refuse a release cloned in the person's own Claude home, and bound build-release's start
This commit is contained in:
@@ -33,7 +33,7 @@ class Git(typing.Protocol):
|
||||
|
||||
|
||||
def unready(home: pathlib.Path, clone: pathlib.Path, reports: pathlib.Path, own: pathlib.Path, claude: Claude, git: Git) -> str | None:
|
||||
"""Builds the home from clone, or refreshes it where the clone's commit or the reports folder changed since. own is the person's own Claude home, whose instructions the home keeps out. Then why a claude cannot run in the home yet, said for the person to act on; None where one can."""
|
||||
"""Builds the home from clone, or refreshes it where the clone's commit or the reports folder changed since; own is the person's own Claude home, whose instructions the home keeps out. Then says why a claude cannot run in the home yet, said for the person to act on; None where one can."""
|
||||
try:
|
||||
built = refreshed(home, clone, reports, own, claude, git)
|
||||
if isinstance(built, Failure):
|
||||
@@ -71,6 +71,9 @@ def printed(done: subprocess.CompletedProcess[str]) -> str:
|
||||
|
||||
|
||||
def refreshed(home: pathlib.Path, clone: pathlib.Path, reports: pathlib.Path, own: pathlib.Path, claude: Claude, git: Git) -> Failure | None:
|
||||
# The home links to the clone's rules/, and Claude Code applies the exclusion of own's files to a link's target too: a clone in own would run without its rules.
|
||||
if clone.resolve().is_relative_to(own.resolve()):
|
||||
return Failure(f"the release is cloned in your own Claude home, {own}, whose instructions the loop keeps out; clone it elsewhere, as README.md → Install says")
|
||||
commit = git("rev-parse", "HEAD", cwd=str(clone))
|
||||
if isinstance(commit, Failure):
|
||||
return commit
|
||||
|
||||
@@ -77,6 +77,14 @@ class Home(unittest.TestCase):
|
||||
|
||||
self.assertEqual(self.settings()["claudeMdExcludes"], [f"{self.own}/**"])
|
||||
|
||||
def test_a_clone_in_the_persons_own_home_stops_since_the_exclusion_would_drop_the_setups_rules(self) -> None:
|
||||
for own in (self.clone, self.clone.parent):
|
||||
with self.subTest(own=own):
|
||||
self.own = own
|
||||
|
||||
self.assertEqual(self.unready(), f"could not build the loop's Claude home, {self.home}: the release is cloned in your own Claude home, {own}, whose instructions the loop keeps out; clone it elsewhere, as README.md → Install says")
|
||||
self.assertFalse((self.home / "settings.json").exists())
|
||||
|
||||
def test_a_moved_reports_folder_refreshes_the_home(self) -> None:
|
||||
self.unready()
|
||||
self.reports = self.temp / "elsewhere" / "build-release" / "larv-review"
|
||||
|
||||
@@ -10,7 +10,7 @@ RELEASE_ROOT = pathlib.Path(__file__).resolve().parents[2]
|
||||
|
||||
# Each folder below is named relative to the person's home folder.
|
||||
|
||||
# The person's own Claude home. No claude the loop starts runs there, and neither entry point reads or writes it: its name is for prose and for rule-hook's rules that guard it.
|
||||
# The person's own Claude home. No claude the loop starts runs there, and neither entry point reads or writes it: its name is for prose, for rule-hook's rules that guard it, and for the instructions the loop's home keeps out.
|
||||
CLAUDE_HOME = ".claude"
|
||||
# The name of the setup's own folder, in the config home and in the state home.
|
||||
SETUP = "build-release"
|
||||
|
||||
Reference in New Issue
Block a user