Skip to content
Merged
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: 2 additions & 2 deletions docs/code-navigation.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ Start with the issue's terms in `GLOSSARY.md`, then use this index to find their
| Command limit, Pass skip at its start | `src/command_limit.rs` — `hold_pass` (count and take a slot under the short lock, the lock of a `PassKind` for `Sharing::OneOfAKind`, the pre-Command-limit lock) and `hold_slot` (a Command on an Issue URL); `src/launch.rs` — `start`, which a Pickup run, Architect run and Security run call; `src/reservation.rs` — `Reservation::of_published`, an Architect plan or Security fix reserved before it is marked ready; `src/run.rs` and `src/processes.rs` take a slot for a hand-started Command | `tests/pickup_run.rs`, `tests/architect_run.rs`, `tests/process.rs`, `tests/user_config.rs` |
| Ticket run, Continuation, Issue branch | `src/run.rs`; `src/branch.rs` | `tests/fresh_run.rs`, `tests/continuation.rs`, `tests/numbered_branches.rs` |
| Worktree | `src/worktree.rs` and `src/worktree/` | `src/worktree/acquisition_tests.rs`, `src/worktree/cleanup_tests.rs` |
| Review run, pull-request Process input | `src/review.rs` — parsed Pull request URL; `src/review/reservation.rs` — origin reservation and `in-progress` lifetime; `src/processes/review.rs` — author Pass admission, Built-in and Custom pull-request Processes, captured-head sessions and recommendation delivery; `src/config/review.rs` — per-repository extra validation commands; `src/prompt.rs` — worktree validation and reporting instructions; `src/github/review.rs` — author/marker/base-head eligibility and filtered review input; `src/worktree/skill.rs` — head-branch checkout | `tests/review_run.rs`, `tests/review_pass.rs`, `tests/review_security.rs`, `tests/review_validation_after_security.rs` |
| Review run, pull-request Process input | `src/review.rs` — parsed Pull request URL; `src/review/reservation.rs` — origin reservation and `in-progress` lifetime; `src/processes/review.rs` — author Pass admission, Built-in and Custom pull-request Processes, captured-head sessions and recommendation delivery; `src/config/review.rs` — per-repository extra validation commands; `src/prompt.rs` — worktree validation and reporting instructions; `src/github/review.rs` — author/marker/base-head eligibility and filtered review input; `src/processes/review/delivery.rs` — push, CI watch and Repairs, delegating its mergeability gate to `src/pull_request.rs` — `ensure_review_ready`; `src/worktree/skill.rs` — head-branch checkout | `tests/review_run.rs`, `src/pull_request.rs` inline tests (Review readiness through `ensure_review_ready`), `tests/review_pass.rs`, `tests/review_security.rs`, `tests/review_validation_after_security.rs` |
| Fix run, unattended Fix Pass | `src/fix.rs` — Command-limit admission, local occupancy pass-over, candidate reservation and Delivery; `src/fix/base_ci.rs` — unscoped Pass's Base branch repair; `src/github/base_ci.rs` — tip CI, re-run and repair deduplication; `src/github/review.rs` — `fix_candidates`, `fix_candidate_branch`, current-head eligibility; `src/worktree.rs` — `occupying_checkout`; `src/ci.rs` — `needs_repair`; `src/processes/fix.rs` — Built-in sequence | `tests/fix_run.rs`, `tests/fix_pass.rs`, `tests/fix_base_ci.rs` |
| Spec run, Spec branch, Spec PR | `src/processes/spec.rs` — validated Built-in Spec sequence from `processes/spec-run.toml`; `src/spec_run.rs` — Ticket scheduling and accounting; Spec PR accounting and the Self-merge check of a Spec PR changed under its Spec run: `src/pull_request.rs` — `SpecPrChanged`, `ensure_spec_pr_unchanged`, `gate_self_merge_on`; `src/child_run.rs` — `SpecPr` | `tests/spec_run.rs`, `tests/process/spec_run.rs` |
| Ticket board, Tickets checklist, Unready Ticket, Startable Ticket | `src/spec_run/ticket_board.rs` — `TicketBoard`, `next_to_start`; `src/spec_run.rs` — `unstartable`, shared with `src/ready.rs`; `src/labels.rs` | Inline tests; `tests/spec_run.rs` |
| Delivery, Repair loop, Foreign commit | `src/delivery.rs` — `Delivery`; `src/delivery/repair_loop.rs`; Delivery stage: `src/delivery/stage.rs` — `Stage`, `Tracker`, its table to the `Stopped at:` and Command record stages | Inline tests; `tests/merge_run.rs` |
| Delivery, Repair loop, Foreign commit | `src/delivery.rs` — `Delivery`; `src/delivery/repair_loop.rs`; Delivery stage: `src/delivery/stage.rs` — `Stage`, `Tracker`, its table to the `Stopped at:` and Command record stages; pull-request readiness for Delivery, Fix and Review runs: `src/pull_request.rs` — `ensure_ready_and_mergeable`, `is_mergeable`, `ensure_review_ready`, one snapshot validation and mergeability poll | Inline tests, including `src/pull_request.rs` readiness tests through those operations; `tests/merge_run.rs` |
| Failed ticket run | `src/failed_run.rs` | `tests/failed_run.rs` |
| Recovery | `src/recovery.rs` — `Recovery`, its add-a-fact methods and `lines`; the Recovery comment, `Recovery::comment`, `comment` and `cause` | Inline tests in `src/recovery.rs`; `tests/failed_run.rs`, `tests/spec_run.rs` |
| CI watch, Check re-run, Abandoned job, Declined CI fix | `src/ci.rs` — `Watch`, `assess`, `after_repair`; Delivery constructs one watch in `src/delivery.rs` — `RunOutside`; `src/delivery/repair_loop.rs` requests assessments and reports completed CI-fix Repairs | Inline CI assessment and Repair loop tests; `src/github/execution_tests.rs`; `tests/ci.rs` |
Expand Down
1 change: 1 addition & 0 deletions src/github.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ pub(crate) fn operational_cause(error: &anyhow::Error) -> Option<&'static str> {
/// GitHub CLI operations bound to an immutable interruption policy.
/// Ordinary views stop for Command interruption; completion views finish
/// independently without changing the recorded request or other views.
#[derive(Clone)]
pub struct GitHub {
interruption: Interruption,
wait_for_quota: bool,
Expand Down
40 changes: 9 additions & 31 deletions src/processes/review/delivery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
use super::*;
use crate::ci::{self, Ci, FailedChecks, Watch};
use crate::github::review::ReviewInput;
use crate::pull_request::PullRequest;

pub(super) struct Delivery<'a> {
pub git: &'a Git,
Expand Down Expand Up @@ -221,37 +222,14 @@ impl Delivery<'_> {
Ok(())
}

/// Delegate to the pull-request owner's Review readiness for `head`.
fn require_mergeable(&self, head: &str) -> Result<()> {
let mut backoff = crate::poll::Backoff::new();
loop {
self.unchanged_head(head)?;
let observed = self
.github
.pr_snapshot(&self.pr.issue, &self.pr.url)?
.context("captured pull request disappeared during Review run")?;
ensure!(
observed.head_commit == head
&& observed.pr.number == self.pr.issue.number
&& observed.pr.url == self.pr.url
&& observed.pr.head == self.snapshot.branch
&& observed.pr.base == self.snapshot.base
&& observed.pr.is_open()
&& !observed.pr.is_draft
&& !observed.from_fork,
"pull request changed during Review run readiness"
);
self.unchanged_head(head)?;
match observed.mergeable {
crate::github::Mergeable::Yes => return Ok(()),
crate::github::Mergeable::No => bail!(
"pull request needs updating before merge; the author must resolve the conflict with {}",
self.snapshot.base
),
crate::github::Mergeable::Unknown => {
let state = (observed.head_commit, observed.mergeable);
crate::poll::sleep(backoff.observe(state, std::time::Instant::now()))?;
}
}
}
PullRequest::on_pull_request(
self.pr,
&self.snapshot.branch,
&self.snapshot.base,
self.github.clone(),
)
.ensure_review_ready(head)
}
}
Loading
Loading