Hooks say when Scribe didn't answer; the CSS consumer map (milestone 302 steps 1–3) #127

Merged
bvandeusen merged 7 commits from dev into main 2026-08-23 14:18:32 -04:00
2 changed files with 24 additions and 19 deletions
Showing only changes of commit 31383bcebe - Show all commits
+4 -1
View File
@@ -102,7 +102,10 @@ def test_after_write_is_silent_where_it_has_nothing_to_say(tmp_path):
(loose / "a.css").write_text(".x {\n color: red;\n}\n") (loose / "a.css").write_text(".x {\n color: red;\n}\n")
assert _run(loose, env, session="s-loose") == "" assert _run(loose, env, session="s-loose") == ""
# A change that defines nothing (prose, a call-site edit) → nothing, even # A change that defines nothing (prose, a call-site edit) → nothing, even
# with the server unreachable (port 9 refuses): no definitions, no arms. # with the server unreachable (port 9 refuses): no definitions, no call
# owed, so not even the #2932 outage line. (a.css above is removed first:
# it DOES define a shape, and an unanswered call for it would rightly speak.)
(repo / "a.css").unlink()
(repo / "README.md").write_text("# notes\n") (repo / "README.md").write_text("# notes\n")
(repo / "b.py").write_text("def one():\n return one_more()\n") (repo / "b.py").write_text("def one():\n return one_more()\n")
assert _run(repo, env, session="s-quiet") == "" assert _run(repo, env, session="s-quiet") == ""
+20 -18
View File
@@ -1033,24 +1033,26 @@ def test_local_arm_finds_duplicates_in_every_language_family(
every Go/Kotlin/Rust project, which is exactly where the operator observed every Go/Kotlin/Rust project, which is exactly where the operator observed
recording never happening. Each case stages an existing copy and writes the recording never happening. Each case stages an existing copy and writes the
same definition to a second file; the hook must prove the duplication and same definition to a second file; the hook must prove the duplication and
ask for the record.""" ask for the record (the instance ANSWERS "nothing recorded" — since #2932
env = _hook_runtime_env() an unanswered call withholds the nudge, so a sink stands in for it)."""
repo = tmp_path / "repo" with http_sink(b'{"context":"","note_ids":[],"sync_note_ids":[]}') as (port, _seen):
repo.mkdir() env = dict(_hook_runtime_env(), SCRIBE_URL=f"http://127.0.0.1:{port}")
subprocess.run(["git", "init", "-q"], cwd=repo, check=True, env=env) repo = tmp_path / "repo"
(repo / fname).write_text(definition) repo.mkdir()
subprocess.run(["git", "add", "."], cwd=repo, check=True, env=env) subprocess.run(["git", "init", "-q"], cwd=repo, check=True, env=env)
ext = fname.rsplit(".", 1)[1] (repo / fname).write_text(definition)
out = subprocess.run( subprocess.run(["git", "add", "."], cwd=repo, check=True, env=env)
["bash", str(HOOK)], ext = fname.rsplit(".", 1)[1]
input=json.dumps({ out = subprocess.run(
"session_id": f"s-lang-{ext}", "cwd": str(repo), ["bash", str(HOOK)],
"tool_name": "Write", input=json.dumps({
"tool_input": {"file_path": str(repo / f"copy.{ext}"), "session_id": f"s-lang-{ext}", "cwd": str(repo),
"content": definition}, "tool_name": "Write",
}), "tool_input": {"file_path": str(repo / f"copy.{ext}"),
capture_output=True, text=True, env=env, "content": definition},
) }),
capture_output=True, text=True, env=env,
)
assert out.returncode == 0 assert out.returncode == 0
assert out.stdout.strip(), ( assert out.stdout.strip(), (
f"hook produced no output for {fname} — the local arm should have " f"hook produced no output for {fname} — the local arm should have "