diff --git a/tests/test_after_write_hook.py b/tests/test_after_write_hook.py index 01dfb11..8ac6501 100644 --- a/tests/test_after_write_hook.py +++ b/tests/test_after_write_hook.py @@ -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") assert _run(loose, env, session="s-loose") == "" # 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 / "b.py").write_text("def one():\n return one_more()\n") assert _run(repo, env, session="s-quiet") == "" diff --git a/tests/test_write_path_trigger.py b/tests/test_write_path_trigger.py index e938f4d..8b0c7d6 100644 --- a/tests/test_write_path_trigger.py +++ b/tests/test_write_path_trigger.py @@ -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 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 - ask for the record.""" - env = _hook_runtime_env() - repo = tmp_path / "repo" - repo.mkdir() - subprocess.run(["git", "init", "-q"], cwd=repo, check=True, env=env) - (repo / fname).write_text(definition) - subprocess.run(["git", "add", "."], cwd=repo, check=True, env=env) - ext = fname.rsplit(".", 1)[1] - out = subprocess.run( - ["bash", str(HOOK)], - input=json.dumps({ - "session_id": f"s-lang-{ext}", "cwd": str(repo), - "tool_name": "Write", - "tool_input": {"file_path": str(repo / f"copy.{ext}"), - "content": definition}, - }), - capture_output=True, text=True, env=env, - ) + ask for the record (the instance ANSWERS "nothing recorded" — since #2932 + an unanswered call withholds the nudge, so a sink stands in for it).""" + with http_sink(b'{"context":"","note_ids":[],"sync_note_ids":[]}') as (port, _seen): + env = dict(_hook_runtime_env(), SCRIBE_URL=f"http://127.0.0.1:{port}") + repo = tmp_path / "repo" + repo.mkdir() + subprocess.run(["git", "init", "-q"], cwd=repo, check=True, env=env) + (repo / fname).write_text(definition) + subprocess.run(["git", "add", "."], cwd=repo, check=True, env=env) + ext = fname.rsplit(".", 1)[1] + out = subprocess.run( + ["bash", str(HOOK)], + input=json.dumps({ + "session_id": f"s-lang-{ext}", "cwd": str(repo), + "tool_name": "Write", + "tool_input": {"file_path": str(repo / f"copy.{ext}"), + "content": definition}, + }), + capture_output=True, text=True, env=env, + ) assert out.returncode == 0 assert out.stdout.strip(), ( f"hook produced no output for {fname} — the local arm should have "