Answer principles round 1: 1 🔴, 7 🟡 (0 misread); every effect is handed in as an argument, no test patches a global, and the traces principle scopes tools that run on their user's machine
CI / tests (pull_request) Successful in 3m43s

This commit is contained in:
2026-11-19 12:42:03 +01:00
parent 8ca612b7a4
commit cb3135bc8c
124 changed files with 1437 additions and 793 deletions
+4 -4
View File
@@ -130,17 +130,17 @@ class Act(unittest.TestCase):
class BlackBox(unittest.TestCase):
def setUp(self) -> None:
self.top = pathlib.Path(self.enterContext(tempfile.TemporaryDirectory())).resolve()
configured(self, self.top)
self.home = configured(self, self.top).parents[1]
def run_tool(self, *args: str) -> subprocess.CompletedProcess[str]:
return subprocess.run([sys.executable, str(TOOL), *args], capture_output=True, cwd=self.top, env=dict(os.environ), text=True)
return subprocess.run([sys.executable, str(TOOL), *args], capture_output=True, cwd=self.top, env=os.environ | {"HOME": str(self.home)}, text=True)
def test_a_file_record_opens_as_its_own_file_and_save_has_nothing_to_store(self):
opened = self.run_tool("open", "decisions")
self.assertEqual((opened.returncode, opened.stdout, opened.stderr), (0, f"{self.top}/docs/decisions.md\n", ""))
saved = self.run_tool("save", "decisions")
self.assertEqual((saved.returncode, saved.stdout, saved.stderr), (0, f"{self.top}/docs/decisions.md is the record itself, so nothing is left to store.\n", ""))
self.assertFalse((pathlib.Path(os.environ["HOME"]) / ".local").exists(), "a file record gets no copy")
self.assertFalse((self.home / ".local").exists(), "a file record gets no copy")
def test_the_goals_file_opens_as_the_config_names_it(self):
opened = self.run_tool("open", "goals-and-audience")
@@ -153,7 +153,7 @@ class BlackBox(unittest.TestCase):
self.assertIn("usage: project-record open|save <record>, where <record> is one of decisions, score-anchors, comprehension-history, reading-cost, changelog, goals-and-audience", ran.stderr)
def test_exits_1_saying_why_where_no_config_names_the_checkout(self):
(pathlib.Path(os.environ["HOME"]) / ".claude-projects" / self.top.name / "config.toml").unlink()
(self.home / ".claude-projects" / self.top.name / "config.toml").unlink()
ran = self.run_tool("open", "decisions")
self.assertEqual((ran.returncode, ran.stdout), (1, ""))
self.assertIn("no config names the checkout", ran.stderr)