test(hooks): the two tests that read a refused connection as "nothing recorded" now answer through a sink, and the silence case removes the shape it had left behind (#2932)
CI & Build / Python lint (push) Successful in 3s
CI & Build / Plugin hooks (push) Successful in 10s
CI & Build / integration (push) Successful in 27s
CI & Build / TypeScript typecheck (push) Successful in 34s
CI & Build / Python tests (push) Successful in 1m7s
CI & Build / Build & push image (push) Successful in 16s

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-23 11:05:42 -04:00
co-authored by Claude Fable 5
parent 0ab94b2a00
commit 31383bcebe
2 changed files with 24 additions and 19 deletions
+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")
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") == ""
+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
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 "