Skip to content
Open
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,3 +212,7 @@ them alone proves succession.
variable in CI, so a failure class exists that cannot reproduce locally. Before calling a
scheduler change clean, run the affected tests both ways, including
`GITHUB_ACTIONS=true python3 -m pytest <paths>`.
- Scheduler credential fixtures must provide distinct synthetic selected and workflow
tokens, not only a source label. Keep missing-token and same-token rejection tests;
never weaken production credential proof to restore a green fixture. Actions callable
doubles must accept and assert the real keyword arguments, including `stdin`.
17 changes: 10 additions & 7 deletions tests/test_pr_review_merge_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -1787,11 +1787,12 @@ def map(self, func, items):
),
)
cancelled = []
monkeypatch.setattr(
sched,
"run_github_actions",
lambda args, stdin=None: cancelled.append(args),
)
def record_cancel(args, *, stdin=None):
assert stdin is None
cancelled.append(args)
return ""

monkeypatch.setattr(sched, "run_github_actions", record_cancel)
monkeypatch.setattr(sched, "require_github_actions_control_actor", lambda x: None)

run_ids = sched.cancel_stale_opencode_runs("owner/repo", "workflow", make_pr(), dry_run=False)
Expand All @@ -1802,7 +1803,8 @@ def map(self, func, items):


def test_force_cancel_failure_logs_reason_and_does_not_raise(monkeypatch, capsys):
def fail_cancel(args, stdin=None):
def fail_cancel(args, *, stdin=None):
assert stdin is None
raise RuntimeError(
"Command failed (1): gh api -X POST "
"repos/owner/repo/actions/runs/29263154177/force-cancel; "
Expand All @@ -1827,7 +1829,8 @@ def fail_cancel(args, stdin=None):


def test_force_cancel_multiple_runs_reports_only_failures(monkeypatch):
def maybe_fail(args, stdin=None):
def maybe_fail(args, *, stdin=None):
assert stdin is None
if "runs/2/force-cancel" in " ".join(args):
raise RuntimeError("GitHub returned HTTP 500")
return ""
Expand Down
Loading