Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions tests/test_head_review.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@
ReviewTimerUp,
StuckMerge,
)
from agent_comms.team.team_hud import TeamBoardPublicationStore, TeamHud
from agent_comms.transport.connector_caller import DirectorCaller
from agent_comms.transport.tool_caller import PeerCaller, ThreadCaller
from agent_comms.transport.tools.orders import CommsHeadVerdictTool
Expand All @@ -121,17 +122,16 @@
QUALIFIED = VerdictReason("The source stage is reviewed while paired implementation remains incomplete")


@pytest.mark.parametrize('roast,fields', (
('The decision could be improved because the same required checks are repeated across fields',
{'why', 'roast.blunt'}),
('Maybe improve this', {'why', 'roast.words', 'roast.because', 'roast.blunt'}),
@pytest.mark.parametrize('roast,fix,fields', (
(' ', 'Put the repeated checks on their existing declaring parent class', {'why', 'roast'}),
('', ' ', {'why', 'roast', 'fix'}),
))
def test_back_collects_missing_and_invalid_fields(roast: str, fields: set[str]) -> None:
def test_back_collects_missing_and_invalid_fields(roast: str, fix: str, fields: set[str]) -> None:
with pytest.raises(RecordProblems) as refused:
judge.JudgeVerb.parse([
'back', '--pr', '1', '--head', 'a' * 40, '--at', 'owner.py:1',
'--roast', roast,
'--fix', 'Put the repeated checks on their existing declaring parent class',
'--fix', fix,
])
assert refused.value.problems.keys() >= fields

Expand Down Expand Up @@ -1339,10 +1339,10 @@ def test_acceptance_over_the_growth_limit_needs_a_reason_naming_each_growing_fil
back = cli("judge", "back", "--as", "colleague", "--repo", request.repo.to_wire(),
"--pr", str(request.pr),
"--head", head, "--at", "owner.py:2",
"--roast", "The decision could be improved because it repeats the required checks across fields",
"--roast", " ",
"--fix", "Put the repeated checks on their existing declaring parent class")
assert back.returncode == 1, back.stdout + back.stderr
assert "why" in back.stderr and "roast.blunt" in back.stderr
assert "why" in back.stderr and "roast" in back.stderr
assert comms.goals.todos.get(todo.id) == before

accepted = cli(*common, "--serves", before.order.checked().edits[0], "--growth",
Expand Down Expand Up @@ -1385,9 +1385,9 @@ def test_judge_ok_keeps_every_repeated_growth_reason():
growth = verb.head_operation().growth
assert all(growth.names(f"src/{name}") for name in ("first.py", "second.py", "third.py"))
assert not growth.names("src/fourth.py")
with pytest.raises(ToolRefusedError, match="12\\+ words"):
with pytest.raises(ToolRefusedError, match="1\\+ words"):
judge.JudgeVerb.parse(["ok", "--pr", "8", "--head", "abc123def", "--why", ACCEPTED.text,
"--growth", reasons[0], "--growth", "short.py grows"]).head_operation()
"--growth", reasons[0], "--growth", " "]).head_operation()


def test_an_armed_head_with_a_red_required_check_is_a_stuck_merge_every_pass(head_bus):
Expand Down Expand Up @@ -1465,7 +1465,7 @@ def test_retained_head_verdict_precedes_the_published_lost_packet(
owner = comms.registry.require('colleague').incarnation
ping = replace(RulePing.capture(lost), since=RecordedEventTime(published))
packet = TeamDecisions(owner, (ping,), (ping,), ())
TeamUpdateStore.record(comms.root, packet)
TeamBoardPublicationStore.write_all(comms.root, (TeamHud.for_failure(owner, packet),))
comms.threads.set_heartbeat_delivery('colleague', OnHeartbeatDelivery)
original, = packet.send(comms, ())
previous = TeamUpdate.latest(comms, owner)
Expand Down Expand Up @@ -1494,7 +1494,7 @@ def test_retained_head_verdict_precedes_the_published_lost_packet(
owner, published=TeamUpdate.published(comms, owner))
assert delivery.packet.handled[0].since == ping.since
assert (delivery.open_pings == ()) is cleared
TeamUpdateStore.record(comms.root, delivery.packet)
TeamBoardPublicationStore.write_all(comms.root, (TeamHud.for_failure(owner, delivery.packet),))
delivery.packet.send(comms, ())
assert TeamUpdate.latest(comms, owner) == (delivery.packet,)
assert (TeamUpdate.current_board(comms, comms.registry.require('colleague').incarnation) == ()) is cleared
Expand Down
Loading