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
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:
@@ -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") == ""
|
||||||
|
|||||||
@@ -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 "
|
||||||
|
|||||||
Reference in New Issue
Block a user