Answer stability round 1: 0 🔴, 3 🟡 (0 misread); bound the forge's CLI with a timeout in one runner, and read a pull request from a deleted fork
CI / tests (pull_request) Successful in 3m20s
CI / tests (pull_request) Successful in 3m20s
This commit is contained in:
@@ -83,7 +83,7 @@ import typing
|
||||
|
||||
from git_cli.git_repo import commit_exists, default_branch, file_at, git, top
|
||||
from failure import Failure
|
||||
from forge.commands import Forge, forge_of, Run
|
||||
from forge.commands import Forge, forge_of, Run, runner
|
||||
from chunk_preflight.gathered import Gathered, ItemFacts, LeftWorktree, NamedPath, Ran, Worktree
|
||||
from chunk_preflight.facts import JOINING_DETAILS, render
|
||||
from project_config.main import located
|
||||
@@ -149,7 +149,7 @@ def preflight(root: pathlib.Path, timeout: float, make: bool, item_id: int | Non
|
||||
if isinstance(config, Failure):
|
||||
return config
|
||||
outside = None if config.tracked("plan") else config.plan_label
|
||||
forge_run = forge_runner(root, timeout)
|
||||
forge_run = runner(str(root), timeout)
|
||||
held = project_plan(config, ref, str(root), forge_run=forge_run)
|
||||
plan = planned(held.plan, held.cut, ref, config.branch, outside, item_id)
|
||||
item = plan if isinstance(plan, NoItem) else item_facts(root, ref, plan, timeout, make)
|
||||
@@ -189,16 +189,6 @@ def left_worktrees(root: pathlib.Path, forge_run: Run) -> tuple[LeftWorktree, ..
|
||||
return tuple(LeftWorktree(path, branch, pull) for path, branch, pull in merged if isinstance(pull, str))
|
||||
|
||||
|
||||
def forge_runner(root: pathlib.Path, timeout: float) -> Run:
|
||||
"""Runs the forge's CLI at root, stopped after timeout seconds: what it printed, or a Failure with why it failed."""
|
||||
def run(command: list[str]) -> str | Failure:
|
||||
done = ran(command, root, timeout)
|
||||
if isinstance(done, Failure):
|
||||
return Failure(f"`{' '.join(command[:3])}` {done.reason}")
|
||||
return Failure(f"`{' '.join(command[:3])}` exited {done.code}: {done.stderr.strip()}") if done.code else done.stdout
|
||||
return run
|
||||
|
||||
|
||||
def pull_listing(root: pathlib.Path, branch: str, timeout: float) -> tuple[Forge, Ran | Failure] | None:
|
||||
url = git("remote", "get-url", "origin")
|
||||
if isinstance(url, Failure):
|
||||
|
||||
Reference in New Issue
Block a user