From 2b673e5558c45dca308d3ef170643516f9c6e89a Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 17 Nov 2026 17:07:12 +0000 Subject: [PATCH 1/2] feat(finishingbot): report whether each pull request is ready to merge finishing-bot `audit --pr N --pr-repo o/r` now also reads the pull request from GitHub and adds one advisory analyzer, `pr_readiness`, whose findings flatten into the fleet report-back like the others: PRR-001 unresolved review conversations (count, a link to each) PRR-002 a reviewer whose latest review is CHANGES_REQUESTED PRR-003 head behind base PRR-004 merge conflict PRR-005 checks failing PRR-006 checks pending PRR-007 a required status context (rulesets and classic protection) that no check run or commit status on the head provides PRR-008 draft (informational) The verdict (ready / not ready with reasons / unknown, naming what could not be read; plus draft and auto-merge) becomes the envelope reason, so the grid row "finishingbot (release readiness)" states it. It never changes the exit status and gates nothing. The logic is pure (`evaluate` over a Snapshot of GitHub response shapes) and tested on responses recorded 2026-11-17: rsr-template-repo#435 yields exactly PRR-007 for `CI/gate`; standards#1619 yields one PRR-001 with 20 conversations; a clean PR yields no finding; one unresolved thread yields exactly one. Requests are REST plus GraphQL reviewThreads { isResolved }, via the crate's existing reqwest and tokio (no Cargo.toml change). Driver: --pr/--pr-repo; the token arrives as FLEET_PR_TOKEN, is unset before any adapter runs and is exported to finishing-bot alone (as GH_TOKEN, never on a command line); PRR findings are exempt from the no-path warning because they are change-scoped by design. The reusable workflow passes the caller's PR number and its read-only token. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01J4QvDj7XpKyxE4WbsgTsTh --- .../workflows/fleet-report-back-reusable.yml | 11 + bots/finishingbot/src/analyzers/mod.rs | 5 + bots/finishingbot/src/lib.rs | 1 + bots/finishingbot/src/main.rs | 162 ++- bots/finishingbot/src/pr_readiness/github.rs | 368 +++++ bots/finishingbot/src/pr_readiness/mod.rs | 1220 +++++++++++++++++ .../pr_readiness/rsr-template-repo-435.json | 1 + .../fixtures/pr_readiness/standards-1619.json | 1 + docs/REPORT-BACK.adoc | 18 +- scripts/fleet-report-back.sh | 56 +- tests/fleet-report-back-test.sh | 47 + 11 files changed, 1878 insertions(+), 12 deletions(-) create mode 100644 bots/finishingbot/src/pr_readiness/github.rs create mode 100644 bots/finishingbot/src/pr_readiness/mod.rs create mode 100644 bots/finishingbot/tests/fixtures/pr_readiness/rsr-template-repo-435.json create mode 100644 bots/finishingbot/tests/fixtures/pr_readiness/standards-1619.json diff --git a/.github/workflows/fleet-report-back-reusable.yml b/.github/workflows/fleet-report-back-reusable.yml index 3eed6e06..006543ab 100644 --- a/.github/workflows/fleet-report-back-reusable.yml +++ b/.github/workflows/fleet-report-back-reusable.yml @@ -240,6 +240,16 @@ jobs: MEMBERS: ${{ inputs.members }} ADAPTER_TIMEOUT: ${{ inputs.adapter-timeout-seconds }} FLEET_REF: ${{ job.workflow_sha }} + # Pull-request readiness (finishingbot, advisory): the PR number from + # the caller's event, and this job's read-only token. The driver + # takes FLEET_PR_TOKEN out of its environment before any adapter runs + # and hands it to finishing-bot alone. This job grants only + # `contents: read`; GitHub documents the pull-request, checks and + # rules reads as open to any caller for public data, and whatever the + # token cannot read is named in the row ("could not read: ..."), so a + # private repository's row says so rather than reading clean. + PR_NUMBER: ${{ github.event.pull_request.number }} + FLEET_PR_TOKEN: ${{ github.token }} run: | set -euo pipefail # The job limit (timeout-minutes) assumes at most 300 s per adapter; a @@ -255,6 +265,7 @@ jobs: args=(--repo . --out "$RUNNER_TEMP/report-backs" --bin-dir "$RUNNER_TEMP/fleet-bin" --enrolment "$ENROLMENT" --fleet-ref "$FLEET_REF" --timeout "$ADAPTER_TIMEOUT" --summary "$GITHUB_STEP_SUMMARY") + [ -z "${PR_NUMBER:-}" ] || args+=(--pr "$PR_NUMBER" --pr-repo "$GITHUB_REPOSITORY") IFS=',' read -r -a _m <<< "${MEMBERS:-}" for m in "${_m[@]}"; do m="${m// /}"; [ -n "$m" ] && args+=(--member "$m"); done bash "$FLEET_DIR/scripts/fleet-report-back.sh" "${args[@]}" diff --git a/bots/finishingbot/src/analyzers/mod.rs b/bots/finishingbot/src/analyzers/mod.rs index 124db560..e8057dfb 100644 --- a/bots/finishingbot/src/analyzers/mod.rs +++ b/bots/finishingbot/src/analyzers/mod.rs @@ -215,6 +215,11 @@ pub struct AuditResult { pub tooling: AnalysisResult, /// V1 release readiness pub v1_readiness: AnalysisResult, + /// Pull-request readiness, when a pull request was named (`audit --pr`). + /// ADVISORY: deliberately left out of the totals and of + /// `should_block_release`, so it never changes the exit status. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub pr_readiness: Option, } impl AuditResult { diff --git a/bots/finishingbot/src/lib.rs b/bots/finishingbot/src/lib.rs index b5e43f83..458b6b13 100644 --- a/bots/finishingbot/src/lib.rs +++ b/bots/finishingbot/src/lib.rs @@ -17,6 +17,7 @@ pub mod analyzers; pub mod baseline; pub mod config; pub mod error; +pub mod pr_readiness; pub use analyzers::{ claims::ClaimsAnalyzer, license::LicenseAnalyzer, placeholder::PlaceholderAnalyzer, diff --git a/bots/finishingbot/src/main.rs b/bots/finishingbot/src/main.rs index d3d40d76..266390ee 100644 --- a/bots/finishingbot/src/main.rs +++ b/bots/finishingbot/src/main.rs @@ -8,6 +8,7 @@ mod config; mod error; #[cfg(feature = "fleet")] mod fleet; +mod pr_readiness; use clap::{Parser, Subcommand}; use std::path::{Path, PathBuf}; @@ -59,6 +60,40 @@ enum Command { /// Fail on any warnings (strict mode) #[arg(long)] strict: bool, + + /// Also report whether this pull request is ready to review and + /// merge (advisory; never changes the exit status). Needs --pr-repo. + #[arg(long, value_name = "NUMBER", requires = "pr_repo")] + pr: Option, + + /// Repository of --pr, as owner/name + #[arg(long, value_name = "OWNER/NAME", requires = "pr")] + pr_repo: Option, + + /// GitHub Actions run doing this audit: its own checks are not + /// counted as pending + #[arg(long, value_name = "RUN_ID")] + exclude_run_id: Option, + }, + + /// Report whether a pull request is ready to review and merge (advisory) + PrReadiness { + /// Repository, as owner/name + #[arg(long, value_name = "OWNER/NAME", required_unless_present = "snapshot")] + repo: Option, + + /// Pull request number + #[arg(long, value_name = "NUMBER", required_unless_present = "snapshot")] + pr: Option, + + /// Evaluate a recorded snapshot (JSON) instead of reading GitHub + #[arg(long, value_name = "FILE", conflicts_with_all = ["repo", "pr"])] + snapshot: Option, + + /// GitHub Actions run doing this check: its own checks are not + /// counted as pending + #[arg(long, value_name = "RUN_ID")] + exclude_run_id: Option, }, /// Apply automatic fixes @@ -148,7 +183,24 @@ fn main() -> ExitCode { match cli.command { Some(Command::Init { format }) => handle_init(&config_path, &format), Some(Command::Show) => handle_show(&config), - Some(Command::Audit { strict }) => handle_audit(&cli.path, &config, strict, &cli.format), + Some(Command::Audit { + strict, + pr, + pr_repo, + exclude_run_id, + }) => { + let readiness = match (pr, pr_repo) { + (Some(n), Some(repo)) => Some(read_pr_readiness(&repo, n, exclude_run_id)), + _ => None, + }; + handle_audit(&cli.path, &config, strict, &cli.format, readiness) + } + Some(Command::PrReadiness { + repo, + pr, + snapshot, + exclude_run_id, + }) => handle_pr_readiness(repo, pr, snapshot, exclude_run_id, &cli.format), Some(Command::Fix { only }) => handle_fix(&cli.path, &config, only.as_deref()), Some(Command::License { list_allowed }) => handle_license(&cli.path, &config, list_allowed), Some(Command::Placeholders { action }) => handle_placeholders(&cli.path, &config, &action), @@ -163,11 +215,101 @@ fn main() -> ExitCode { }) => handle_fleet_mode(repo, context, session, output, config), None => { // Default to audit - handle_audit(&cli.path, &config, false, &cli.format) + handle_audit(&cli.path, &config, false, &cli.format, None) } } } +/// Read and evaluate one pull request's readiness. Never fails: a pull +/// request that cannot be read is a `skipped` report saying why. +fn read_pr_readiness( + repo: &str, + pr: u64, + exclude_run_id: Option, +) -> pr_readiness::PrReadiness { + use pr_readiness::{evaluate, github, EvalOptions, PrReadiness}; + let started = std::time::Instant::now(); + if !github::valid_repo_slug(repo) { + return PrReadiness::skipped(Some(pr), &format!("not an owner/name repository: {repo:?}")); + } + let client = match github::Client::from_env() { + Ok(c) => c, + Err(e) => return PrReadiness::skipped(Some(pr), &e), + }; + let rt = match tokio::runtime::Builder::new_current_thread() + .enable_all() + .build() + { + Ok(rt) => rt, + Err(e) => return PrReadiness::skipped(Some(pr), &format!("async runtime: {e}")), + }; + match rt.block_on(client.snapshot(repo, pr)) { + Ok(snapshot) => { + let mut r = evaluate(&snapshot, &EvalOptions { exclude_run_id }); + r.duration_ms = started.elapsed().as_millis() as u64; + r + } + Err(e) => PrReadiness::skipped(Some(pr), &e), + } +} + +fn handle_pr_readiness( + repo: Option, + pr: Option, + snapshot: Option, + exclude_run_id: Option, + format: &str, +) -> ExitCode { + use pr_readiness::{evaluate, EvalOptions, Snapshot}; + let report = if let Some(path) = snapshot { + let parsed = std::fs::read_to_string(&path) + .map_err(|e| e.to_string()) + .and_then(|t| serde_json::from_str::(&t).map_err(|e| e.to_string())); + match parsed { + Ok(s) => evaluate(&s, &EvalOptions { exclude_run_id }), + Err(e) => { + eprintln!("Error reading snapshot {}: {}", path.display(), e); + return ExitCode::FAILURE; + } + } + } else { + // clap guarantees both when no snapshot is given. + read_pr_readiness( + repo.as_deref().unwrap_or_default(), + pr.unwrap_or_default(), + exclude_run_id, + ) + }; + if format == "json" { + match serde_json::to_string_pretty(&report) { + Ok(json) => println!("{}", json), + Err(e) => eprintln!("JSON serialization error: {}", e), + } + } else { + print_pr_readiness(&report); + } + // Advisory: the verdict never sets the exit status; only a failure to + // evaluate at all does, so a caller can tell "not ready" from "broken". + if report.skipped.is_some() { + ExitCode::FAILURE + } else { + ExitCode::SUCCESS + } +} + +fn print_pr_readiness(r: &pr_readiness::PrReadiness) { + println!(); + println!("PULL REQUEST READINESS (advisory)"); + println!("{}", r.summary); + if let Some(u) = &r.url { + println!("{}", u); + } + for f in &r.findings { + println!(" [{}] {:?}: {}", f.id, f.severity, f.message); + } + println!(); +} + #[cfg(feature = "fleet")] fn handle_fleet_mode( repo: PathBuf, @@ -319,7 +461,13 @@ fn handle_show(config: &config::Config) -> ExitCode { ExitCode::SUCCESS } -fn handle_audit(path: &Path, config: &config::Config, strict: bool, format: &str) -> ExitCode { +fn handle_audit( + path: &Path, + config: &config::Config, + strict: bool, + format: &str, + pr_readiness: Option, +) -> ExitCode { use crate::analyzers::{ claims::ClaimsAnalyzer, license::LicenseAnalyzer, placeholder::PlaceholderAnalyzer, release::ReleaseAnalyzer, scm_files::ScmFilesAnalyzer, testing::TestingAnalyzer, @@ -402,6 +550,9 @@ fn handle_audit(path: &Path, config: &config::Config, strict: bool, format: &str } }; + // Advisory: carried in the report, never in the exit status below. + result.pr_readiness = pr_readiness; + // Output results if format == "json" { match serde_json::to_string_pretty(&result) { @@ -410,9 +561,12 @@ fn handle_audit(path: &Path, config: &config::Config, strict: bool, format: &str } } else { print_summary(&result); + if let Some(r) = &result.pr_readiness { + print_pr_readiness(r); + } } - // Determine exit code + // Determine exit code (pull-request readiness takes no part) if result.should_block_release() { ExitCode::FAILURE } else if strict && result.total_warnings() > 0 { diff --git a/bots/finishingbot/src/pr_readiness/github.rs b/bots/finishingbot/src/pr_readiness/github.rs new file mode 100644 index 00000000..77d7adcf --- /dev/null +++ b/bots/finishingbot/src/pr_readiness/github.rs @@ -0,0 +1,368 @@ +// SPDX-License-Identifier: MPL-2.0 +// SPDX-FileCopyrightText: 2026 Jonathan D.A. Jewell +//! Read a [`Snapshot`] of one pull request from GitHub. +//! +//! REST for everything except review-thread resolution, which only GraphQL +//! exposes (`reviewThreads { isResolved }`, readable by a workflow's +//! `GITHUB_TOKEN`). Read-only: every request is a GET, or a GraphQL query. +//! +//! The token comes from `GH_TOKEN`, else `GITHUB_TOKEN`; without one the REST +//! reads are attempted unauthenticated (public repositories, low rate limit) +//! and the review threads are recorded as unreadable. A source that fails is +//! recorded in `Snapshot::unreadable` with the reason, never dropped: the +//! verdict can then be `not_ready` or `unknown`, never `ready`. + +use super::{ + Branch, CheckRun, CombinedStatus, Compare, PullRequest, Review, ReviewThread, Rule, Snapshot, +}; +use serde::de::DeserializeOwned; +use serde_json::{json, Value}; +use std::time::Duration; + +/// Pages followed per list endpoint, at 100 items a page. +const MAX_PAGES: usize = 20; + +const THREADS_QUERY: &str = "query($owner:String!,$name:String!,$number:Int!,$after:String){\ +repository(owner:$owner,name:$name){pullRequest(number:$number){\ +reviewThreads(first:100,after:$after){pageInfo{hasNextPage endCursor}\ +nodes{isResolved isOutdated path line comments(first:1){nodes{url}}}}}}}"; + +/// `owner/name`, each part letters, digits, `.`, `_` or `-`. +pub fn valid_repo_slug(s: &str) -> bool { + let mut parts = s.split('/'); + let ok = |p: Option<&str>| { + p.is_some_and(|p| { + !p.is_empty() + && p.len() <= 100 + && p != "." + && p != ".." + && p.chars() + .all(|c| c.is_ascii_alphanumeric() || matches!(c, '.' | '_' | '-')) + }) + }; + ok(parts.next()) && ok(parts.next()) && parts.next().is_none() +} + +/// Percent-encode a branch name for a URL path (slashes kept: the branch +/// endpoints take them literally). +fn encode_branch(b: &str) -> String { + b.bytes() + .map(|c| { + if c.is_ascii_alphanumeric() || matches!(c, b'.' | b'_' | b'-' | b'/') { + (c as char).to_string() + } else { + format!("%{c:02X}") + } + }) + .collect() +} + +/// The `rel="next"` URL of a `Link` header. +fn next_link(link: &str) -> Option { + link.split(',').find_map(|part| { + let (url, rel) = part.split_once(';')?; + if rel.trim() == "rel=\"next\"" { + Some( + url.trim() + .trim_start_matches('<') + .trim_end_matches('>') + .to_string(), + ) + } else { + None + } + }) +} + +/// The value of a source that was read, or `None` with the reason recorded. +fn keep(unreadable: &mut Vec, what: &str, r: Result) -> Option { + match r { + Ok(v) => Some(v), + Err(e) => { + // Bounded: an error body can be long, and the reason rides into the + // one-line summary and the envelope. + let e: String = e.chars().take(200).collect(); + unreadable.push(format!("{what}: {e}")); + None + } + } +} + +/// A read-only GitHub client. +pub struct Client { + http: reqwest::Client, + api: String, + graphql: String, + token: Option, +} + +impl Client { + /// Configure from the environment: `GH_TOKEN` / `GITHUB_TOKEN`, + /// `GITHUB_API_URL`, `GITHUB_GRAPHQL_URL` (GitHub Actions sets the last two). + pub fn from_env() -> Result { + let token = ["GH_TOKEN", "GITHUB_TOKEN"] + .iter() + .filter_map(|k| std::env::var(k).ok()) + .find(|t| !t.trim().is_empty()); + let api = std::env::var("GITHUB_API_URL") + .unwrap_or_else(|_| "https://api.github.com".into()) + .trim_end_matches('/') + .to_string(); + let graphql = + std::env::var("GITHUB_GRAPHQL_URL").unwrap_or_else(|_| format!("{api}/graphql")); + let mut builder = reqwest::Client::builder() + .user_agent(concat!("finishing-bot/", env!("CARGO_PKG_VERSION"))) + .timeout(Duration::from_secs(30)); + // Extra trust roots from the standard SSL_CERT_FILE (a TLS-terminating + // egress proxy); unset on GitHub-hosted runners, so nothing changes there. + if let Some(path) = std::env::var_os("SSL_CERT_FILE") { + let pem = std::fs::read(&path) + .map_err(|e| format!("SSL_CERT_FILE {}: {e}", path.to_string_lossy()))?; + for cert in reqwest::Certificate::from_pem_bundle(&pem) + .map_err(|e| format!("SSL_CERT_FILE {}: {e}", path.to_string_lossy()))? + { + builder = builder.add_root_certificate(cert); + } + } + let http = builder.build().map_err(|e| format!("HTTP client: {e}"))?; + Ok(Self { + http, + api, + graphql, + token, + }) + } + + fn get(&self, url: &str) -> reqwest::RequestBuilder { + let r = self + .http + .get(url) + .header("Accept", "application/vnd.github+json") + .header("X-GitHub-Api-Version", "2022-11-28"); + match &self.token { + Some(t) => r.bearer_auth(t), + None => r, + } + } + + /// GET one URL; the body and the next-page URL. The token is only ever + /// sent to this client's own API base. + async fn get_page(&self, url: &str) -> Result<(Value, Option), String> { + if !url.starts_with(&self.api) { + return Err(format!("refusing to follow a URL outside {}", self.api)); + } + let resp = self + .get(url) + .send() + .await + .map_err(|e| format!("request failed: {e}"))?; + let status = resp.status(); + let next = resp + .headers() + .get("link") + .and_then(|v| v.to_str().ok()) + .and_then(next_link); + let body: Value = resp + .json() + .await + .map_err(|e| format!("HTTP {status}: unreadable body: {e}"))?; + if !status.is_success() { + let msg = body.get("message").and_then(Value::as_str).unwrap_or(""); + return Err(format!("HTTP {}: {msg}", status.as_u16())); + } + Ok((body, next)) + } + + async fn one(&self, path: &str) -> Result { + let (body, _) = self.get_page(&format!("{}{path}", self.api)).await?; + serde_json::from_value(body).map_err(|e| format!("unexpected shape: {e}")) + } + + /// Every page of a list endpoint; `key` names the array inside an object + /// page (check runs), `None` for a bare array page. + async fn all( + &self, + path: &str, + key: Option<&str>, + ) -> Result, String> { + let sep = if path.contains('?') { '&' } else { '?' }; + let mut url = Some(format!("{}{path}{sep}per_page=100", self.api)); + let mut out = Vec::new(); + for _ in 0..MAX_PAGES { + let Some(u) = url.take() else { break }; + let (body, next) = self.get_page(&u).await?; + let items = match key { + Some(k) => body.get(k).cloned().unwrap_or(Value::Null), + None => body, + }; + let page: Vec = + serde_json::from_value(items).map_err(|e| format!("unexpected shape: {e}"))?; + out.extend(page); + url = next; + } + if url.is_some() { + return Err(format!("more than {MAX_PAGES} pages; not all read")); + } + Ok(out) + } + + async fn review_threads(&self, repo: &str, pr: u64) -> Result, String> { + let Some(token) = &self.token else { + return Err("GraphQL needs a token (GH_TOKEN or GITHUB_TOKEN)".into()); + }; + let (owner, name) = repo.split_once('/').ok_or("bad repository slug")?; + let mut after: Option = None; + let mut out = Vec::new(); + for _ in 0..MAX_PAGES { + let body = json!({ + "query": THREADS_QUERY, + "variables": {"owner": owner, "name": name, "number": pr, "after": after}, + }); + let resp = self + .http + .post(&self.graphql) + .bearer_auth(token) + .json(&body) + .send() + .await + .map_err(|e| format!("request failed: {e}"))?; + let status = resp.status(); + let v: Value = resp + .json() + .await + .map_err(|e| format!("HTTP {status}: unreadable body: {e}"))?; + if let Some(err) = v.pointer("/errors/0/message").and_then(Value::as_str) { + return Err(format!("GraphQL: {err}")); + } + if !status.is_success() { + let msg = v.get("message").and_then(Value::as_str).unwrap_or(""); + return Err(format!("HTTP {}: {msg}", status.as_u16())); + } + let threads = v + .pointer("/data/repository/pullRequest/reviewThreads") + .ok_or("GraphQL: no reviewThreads in the response")?; + let nodes: Vec = + serde_json::from_value(threads.get("nodes").cloned().unwrap_or(Value::Null)) + .map_err(|e| format!("unexpected shape: {e}"))?; + out.extend(nodes); + if threads + .pointer("/pageInfo/hasNextPage") + .and_then(Value::as_bool) + != Some(true) + { + return Ok(out); + } + after = threads + .pointer("/pageInfo/endCursor") + .and_then(Value::as_str) + .map(String::from); + } + Err(format!("more than {MAX_PAGES} pages; not all read")) + } + + /// Read every source for `repo` (`owner/name`) pull request `pr`. Fails + /// only when the pull request itself cannot be read; any other source + /// that fails is recorded in `unreadable`. + pub async fn snapshot(&self, repo: &str, pr: u64) -> Result { + if !valid_repo_slug(repo) { + return Err(format!("not an owner/name repository slug: {repo:?}")); + } + let base = format!("/repos/{repo}"); + let pull: PullRequest = self + .one(&format!("{base}/pulls/{pr}")) + .await + .map_err(|e| format!("pull request {repo}#{pr}: {e}"))?; + let sha = pull.head.sha.clone(); + if sha.is_empty() || !sha.chars().all(|c| c.is_ascii_hexdigit()) { + return Err(format!("pull request {repo}#{pr}: no head commit")); + } + let branch = encode_branch(&pull.base.ref_name); + let mut unreadable = Vec::new(); + let compare: Option = keep( + &mut unreadable, + "compare", + self.one(&format!("{base}/compare/{branch}...{sha}")).await, + ); + let check_runs: Option> = keep( + &mut unreadable, + "check runs", + self.all( + &format!("{base}/commits/{sha}/check-runs"), + Some("check_runs"), + ) + .await, + ); + let status: Option = keep( + &mut unreadable, + "commit statuses", + self.one(&format!("{base}/commits/{sha}/status?per_page=100")) + .await, + ); + let rules: Option> = keep( + &mut unreadable, + "branch rules", + self.all(&format!("{base}/rules/branches/{branch}"), None) + .await, + ); + let branch_info: Option = keep( + &mut unreadable, + "branch protection", + self.one(&format!("{base}/branches/{branch}")).await, + ); + let reviews: Option> = keep( + &mut unreadable, + "reviews", + self.all(&format!("{base}/pulls/{pr}/reviews"), None).await, + ); + let review_threads = keep( + &mut unreadable, + "review threads", + self.review_threads(repo, pr).await, + ); + Ok(Snapshot { + pull, + compare, + check_runs, + status, + rules, + branch: branch_info, + reviews, + review_threads, + unreadable, + }) + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn repository_slugs_are_validated() { + assert!(valid_repo_slug("hyperpolymath/rsr-template-repo")); + assert!(valid_repo_slug("metadatastician/standards")); + for bad in ["", "a", "a/b/c", "../x", "a/..", "a/b c", "a/b?x=1", "/b"] { + assert!(!valid_repo_slug(bad), "{bad:?}"); + } + } + + #[test] + fn branch_names_are_encoded_for_paths() { + assert_eq!(encode_branch("main"), "main"); + assert_eq!(encode_branch("release/1.x"), "release/1.x"); + assert_eq!(encode_branch("a b#c"), "a%20b%23c"); + } + + #[test] + fn the_next_page_is_read_from_the_link_header() { + let h = r#"; rel="next", ; rel="last""#; + assert_eq!( + next_link(h).as_deref(), + Some("https://api.github.com/x?page=2") + ); + assert_eq!( + next_link(r#"; rel="prev""#), + None + ); + } +} diff --git a/bots/finishingbot/src/pr_readiness/mod.rs b/bots/finishingbot/src/pr_readiness/mod.rs new file mode 100644 index 00000000..2bfe768a --- /dev/null +++ b/bots/finishingbot/src/pr_readiness/mod.rs @@ -0,0 +1,1220 @@ +// SPDX-License-Identifier: MPL-2.0 +// SPDX-FileCopyrightText: 2026 Jonathan D.A. Jewell +//! Pull-request readiness: is this pull request ready for the owner to review +//! and merge? +//! +//! Each unmet condition is one [`Finding`]; a pull request with no finding and +//! every source read is `ready`. The conditions, in rule-id order: +//! +//! | Rule | Condition | +//! |---------|-------------------------------------------------------------------| +//! | PRR-001 | unresolved review conversations (count, a link to each thread) | +//! | PRR-002 | a reviewer whose latest review is CHANGES_REQUESTED | +//! | PRR-003 | head branch behind its base | +//! | PRR-004 | merge conflict | +//! | PRR-005 | check runs or commit statuses failing, timed out, cancelled, ... | +//! | PRR-006 | check runs or commit statuses still pending | +//! | PRR-007 | a required status context that nothing on the head provides | +//! | PRR-008 | the pull request is a draft (informational) | +//! +//! Auto-merge is reported in the verdict, not as a finding: it is a setting, +//! not an unmet condition. +//! +//! The report is ADVISORY. Nothing here decides whether a merge may happen: +//! the verdict never changes finishing-bot's exit status, and the verdict grid +//! row it feeds is advisory. +//! +//! This module is pure: [`evaluate`] reads a [`Snapshot`] (the GitHub REST and +//! GraphQL response shapes, only the fields read) and makes no request. The +//! requests live in [`github`], so the logic is tested on recorded responses. +//! +//! A pull-request finding names no file: it is a fact about the change as a +//! whole, and the grid grades a path-less finding as part of every change, +//! which is exactly the scope these findings have. + +pub mod github; + +use crate::analyzers::{Finding, Severity}; +use serde::{Deserialize, Serialize}; +use std::collections::BTreeMap; + +/// At most this many entries are listed in one finding's message; the rest +/// are counted. +const LIST_CAP: usize = 25; + +/// Check-run conclusions that mean the check did not pass. +const FAILING_CONCLUSIONS: &[&str] = &[ + "failure", + "timed_out", + "cancelled", + "action_required", + "startup_failure", +]; + +// ── inputs: GitHub response shapes, only the fields read ───────────────────── + +/// `GET /repos/{o}/{r}/pulls/{n}`. +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +pub struct PullRequest { + pub number: u64, + #[serde(default)] + pub html_url: String, + #[serde(default)] + pub state: String, + #[serde(default)] + pub draft: bool, + /// `None` while GitHub is still computing mergeability. + #[serde(default)] + pub mergeable: Option, + #[serde(default)] + pub mergeable_state: Option, + #[serde(default)] + pub auto_merge: Option, + #[serde(default)] + pub head: GitRef, + #[serde(default)] + pub base: GitRef, +} + +/// The `auto_merge` object of a pull request (present only when enabled). +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +pub struct AutoMerge { + #[serde(default)] + pub merge_method: Option, +} + +/// `head` / `base` of a pull request. +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +pub struct GitRef { + #[serde(default)] + pub sha: String, + #[serde(rename = "ref", default)] + pub ref_name: String, +} + +/// `GET /repos/{o}/{r}/compare/{base}...{head}`. +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +pub struct Compare { + #[serde(default)] + pub behind_by: Option, +} + +/// One element of `GET /repos/{o}/{r}/commits/{sha}/check-runs` `.check_runs`. +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +pub struct CheckRun { + #[serde(default)] + pub id: u64, + pub name: String, + #[serde(default)] + pub status: String, + #[serde(default)] + pub conclusion: Option, + #[serde(default)] + pub html_url: Option, + #[serde(default)] + pub details_url: Option, + #[serde(default)] + pub app: Option, +} + +/// The GitHub App that created a check run. +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +pub struct App { + #[serde(default)] + pub id: Option, + #[serde(default)] + pub slug: Option, +} + +/// `GET /repos/{o}/{r}/commits/{sha}/status` (the combined status). +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +pub struct CombinedStatus { + #[serde(default)] + pub statuses: Vec, +} + +/// One commit status (the latest per context, as the combined status gives). +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +pub struct CommitStatus { + pub context: String, + pub state: String, + #[serde(default)] + pub target_url: Option, +} + +/// One element of `GET /repos/{o}/{r}/rules/branches/{branch}`. +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +pub struct Rule { + #[serde(rename = "type")] + pub kind: String, + #[serde(default)] + pub parameters: Option, +} + +/// `GET /repos/{o}/{r}/branches/{branch}`: classic branch protection. +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +pub struct Branch { + #[serde(default)] + pub protection: Option, +} + +/// `protection` of a branch. +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +pub struct Protection { + #[serde(default)] + pub required_status_checks: Option, +} + +/// `protection.required_status_checks` of a branch. +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +pub struct ProtectionChecks { + #[serde(default)] + pub enforcement_level: Option, + #[serde(default)] + pub contexts: Vec, + #[serde(default)] + pub checks: Vec, +} + +/// A required check, as both rulesets and classic protection name it. +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +pub struct RequiredCheck { + pub context: String, + #[serde(default)] + pub integration_id: Option, +} + +/// One element of `GET /repos/{o}/{r}/pulls/{n}/reviews`. +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +pub struct Review { + #[serde(default)] + pub id: u64, + #[serde(default)] + pub user: Option, + pub state: String, + #[serde(default)] + pub submitted_at: Option, + #[serde(default)] + pub html_url: Option, +} + +/// A GitHub user (login only). +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +pub struct User { + pub login: String, +} + +/// One node of GraphQL `pullRequest.reviewThreads.nodes`. +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +pub struct ReviewThread { + #[serde(rename = "isResolved")] + pub is_resolved: bool, + #[serde(rename = "isOutdated", default)] + pub is_outdated: bool, + #[serde(default)] + pub path: Option, + #[serde(default)] + pub line: Option, + #[serde(default)] + pub comments: ThreadComments, +} + +/// `comments(first: 1)` of a review thread: the first comment's URL is the +/// thread's link. +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +pub struct ThreadComments { + #[serde(default)] + pub nodes: Vec, +} + +/// One comment of a review thread (its URL only). +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +pub struct ThreadComment { + #[serde(default)] + pub url: Option, +} + +/// Everything one evaluation reads. A source that is `None` could not be read +/// (the fetcher says why in `unreadable`); a pull request with an unread +/// source is never `ready`, because the missing source could hold the reason +/// it is not. +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +pub struct Snapshot { + pub pull: PullRequest, + #[serde(default)] + pub compare: Option, + #[serde(default)] + pub check_runs: Option>, + #[serde(default)] + pub status: Option, + #[serde(default)] + pub rules: Option>, + #[serde(default)] + pub branch: Option, + #[serde(default)] + pub reviews: Option>, + #[serde(default)] + pub review_threads: Option>, + /// "source: why" for every source that could not be read. + #[serde(default)] + pub unreadable: Vec, +} + +/// Evaluation options. +#[derive(Debug, Clone, Default)] +pub struct EvalOptions { + /// The GitHub Actions run doing this evaluation. Its own check runs are + /// necessarily still in progress, so they are not counted as pending (nor + /// as failing); they still count as PROVIDING a required context. + pub exclude_run_id: Option, +} + +// ── output ─────────────────────────────────────────────────────────────────── + +/// The verdict on one pull request. +#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +pub enum Verdict { + /// Every source read, nothing unmet. + Ready, + /// At least one condition unmet (see the findings). + NotReady, + /// Nothing unmet in what was read, but a source could not be read. + Unknown, + /// The evaluation did not run (see `skipped`). + #[default] + Skipped, +} + +impl Verdict { + fn words(self) -> &'static str { + match self { + Verdict::Ready => "ready", + Verdict::NotReady => "not ready", + Verdict::Unknown => "readiness unknown", + Verdict::Skipped => "readiness not evaluated", + } + } +} + +/// The readiness report. Serialised beside the audit analyzers, so it carries +/// the analyzer shape (`findings`, `files_checked`, `duration_ms`) the fleet +/// report-back driver reads, plus the verdict. +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +pub struct PrReadiness { + pub findings: Vec, + /// Always 0: readiness reads no file. Kept for the analyzer shape. + pub files_checked: usize, + pub duration_ms: u64, + pub verdict: Verdict, + /// One line per unmet condition, in rule order. + pub reasons: Vec, + pub pr: Option, + pub url: Option, + pub head_sha: Option, + pub base: Option, + pub draft: Option, + pub auto_merge: Option, + pub auto_merge_method: Option, + /// Required status contexts on the base branch (rulesets and classic + /// protection together). + pub required_contexts: Vec, + /// "source: why" for every source that could not be read. + pub unreadable: Vec, + /// Why the evaluation did not run at all. + pub skipped: Option, + /// One line: the verdict, its reasons, draft and auto-merge. + pub summary: String, +} + +impl PrReadiness { + /// A report for an evaluation that could not run. + pub fn skipped(pr: Option, why: &str) -> Self { + let summary = match pr { + Some(n) => format!("PR #{n}: readiness not evaluated: {why}"), + None => format!("readiness not evaluated: {why}"), + }; + Self { + pr, + skipped: Some(why.to_string()), + summary, + ..Self::default() + } + } +} + +// ── policy read from the base branch ───────────────────────────────────────── + +/// What the base branch's rules require, from rulesets and classic protection. +#[derive(Debug, Default)] +struct Policy { + /// context -> integration ids that may provide it (empty: any provider). + contexts: BTreeMap>, + /// The head must be up to date with the base. + strict: bool, + /// Every conversation must be resolved before merging. + thread_resolution: bool, + /// Approving reviews required (the most any rule asks for). + approvals: u64, +} + +impl Policy { + fn read(s: &Snapshot) -> Self { + let mut p = Policy::default(); + let add = |ctx: &str, id: Option, p: &mut Policy| { + let ids = p.contexts.entry(ctx.to_string()).or_default(); + if let Some(i) = id { + ids.push(i); + } + }; + for rule in s.rules.iter().flatten() { + let Some(params) = rule.parameters.as_ref() else { + continue; + }; + match rule.kind.as_str() { + "required_status_checks" => { + if params + .get("strict_required_status_checks_policy") + .and_then(|v| v.as_bool()) + == Some(true) + { + p.strict = true; + } + let checks: Vec = params + .get("required_status_checks") + .cloned() + .and_then(|v| serde_json::from_value(v).ok()) + .unwrap_or_default(); + for c in checks { + add(&c.context, c.integration_id, &mut p); + } + } + "pull_request" => { + if params + .get("required_review_thread_resolution") + .and_then(|v| v.as_bool()) + == Some(true) + { + p.thread_resolution = true; + } + if let Some(n) = params + .get("required_approving_review_count") + .and_then(|v| v.as_u64()) + { + p.approvals = p.approvals.max(n); + } + } + _ => {} + } + } + let classic = s + .branch + .as_ref() + .and_then(|b| b.protection.as_ref()) + .and_then(|pr| pr.required_status_checks.as_ref()); + if let Some(rsc) = classic { + if rsc.enforcement_level.as_deref() != Some("off") { + for c in &rsc.contexts { + add(c, None, &mut p); + } + for c in &rsc.checks { + add(&c.context, c.integration_id, &mut p); + } + } + } + // A context whose rules name providing apps may be provided by any of + // those apps; one no rule binds to an app may be provided by anyone. + p + } +} + +// ── evaluation ─────────────────────────────────────────────────────────────── + +fn list(items: &[String]) -> String { + if items.len() <= LIST_CAP { + items.join("; ") + } else { + format!( + "{}; and {} more", + items[..LIST_CAP].join("; "), + items.len() - LIST_CAP + ) + } +} + +fn short(sha: &str) -> &str { + sha.get(..7).unwrap_or(sha) +} + +/// The run id in an Actions check-run URL (`.../actions/runs//job/...`). +fn run_id_of(url: &str) -> Option { + let rest = url.split("/actions/runs/").nth(1)?; + rest.split(|c: char| !c.is_ascii_digit()) + .next()? + .parse() + .ok() +} + +fn is_own_run(cr: &CheckRun, opts: &EvalOptions) -> bool { + let Some(own) = opts.exclude_run_id else { + return false; + }; + [cr.details_url.as_deref(), cr.html_url.as_deref()] + .into_iter() + .flatten() + .any(|u| run_id_of(u) == Some(own)) +} + +/// The latest check run per (app, name): a re-run supersedes the attempt it +/// replaces, as on the pull request's merge box. +fn latest_check_runs(runs: &[CheckRun]) -> Vec<&CheckRun> { + let mut latest: BTreeMap<(String, String), &CheckRun> = BTreeMap::new(); + for cr in runs { + let app = cr + .app + .as_ref() + .and_then(|a| a.slug.clone()) + .unwrap_or_default(); + let key = (app, cr.name.clone()); + match latest.get(&key) { + Some(prev) if prev.id >= cr.id => {} + _ => { + latest.insert(key, cr); + } + } + } + latest.into_values().collect() +} + +fn link_of(cr: &CheckRun) -> String { + match cr.html_url.as_deref().or(cr.details_url.as_deref()) { + Some(u) => format!("{} <{}>", cr.name, u), + None => cr.name.clone(), + } +} + +fn finding(id: &str, name: &str, severity: Severity, message: String, fix: &str) -> Finding { + Finding::new(id, name, severity, &message).with_suggestion(fix) +} + +/// Evaluate one pull request. Pure: reads only `s`. +pub fn evaluate(s: &Snapshot, opts: &EvalOptions) -> PrReadiness { + let pr = &s.pull; + let policy = Policy::read(s); + let mut findings = Vec::new(); + + // PRR-001: unresolved review conversations. + if let Some(threads) = &s.review_threads { + let open: Vec<&ReviewThread> = threads.iter().filter(|t| !t.is_resolved).collect(); + if !open.is_empty() { + let outdated = open.iter().filter(|t| t.is_outdated).count(); + let links: Vec = open + .iter() + .map(|t| { + let at = match (&t.path, t.line) { + (Some(p), Some(l)) => format!("{p}:{l}"), + (Some(p), None) => p.clone(), + _ => "conversation".to_string(), + }; + match t.comments.nodes.first().and_then(|c| c.url.as_deref()) { + Some(u) => format!("{at} <{u}>"), + None => at, + } + }) + .collect(); + let required = if policy.thread_resolution { + "; the base branch requires every conversation resolved before merging" + } else { + "" + }; + let outdated_note = if outdated > 0 { + format!(" ({outdated} on outdated code)") + } else { + String::new() + }; + findings.push(finding( + "PRR-001", + "Unresolved review conversations", + if policy.thread_resolution { + Severity::Error + } else { + Severity::Warning + }, + format!( + "{} unresolved review conversation(s){outdated_note}{required}: {}", + open.len(), + list(&links) + ), + "Answer or resolve each conversation.", + )); + } + } + + // PRR-002: a reviewer whose latest review requests changes. COMMENTED and + // PENDING reviews do not change a reviewer's standing; DISMISSED clears it. + if let Some(reviews) = &s.reviews { + let mut ordered: Vec<&Review> = reviews + .iter() + .filter(|r| r.state != "COMMENTED" && r.state != "PENDING") + .collect(); + ordered.sort_by(|a, b| { + (a.submitted_at.as_deref().unwrap_or(""), a.id) + .cmp(&(b.submitted_at.as_deref().unwrap_or(""), b.id)) + }); + let mut standing: BTreeMap<&str, &Review> = BTreeMap::new(); + for r in ordered { + if let Some(u) = &r.user { + standing.insert(u.login.as_str(), r); + } + } + let blocking: Vec = standing + .iter() + .filter(|(_, r)| r.state == "CHANGES_REQUESTED") + .map(|(login, r)| match &r.html_url { + Some(u) => format!("{login} <{u}>"), + None => (*login).to_string(), + }) + .collect(); + if !blocking.is_empty() { + findings.push(finding( + "PRR-002", + "Changes requested", + if policy.approvals > 0 { + Severity::Error + } else { + Severity::Warning + }, + format!( + "{} reviewer(s) whose latest review requests changes: {}", + blocking.len(), + list(&blocking) + ), + "Address the requested changes and ask for a re-review, or have the review dismissed.", + )); + } + } + + // PRR-003: behind the base branch. + if let Some(behind) = s.compare.as_ref().and_then(|c| c.behind_by) { + if behind > 0 { + let strict = if policy.strict { + "; the base branch requires the head to be up to date before merging" + } else { + "" + }; + findings.push(finding( + "PRR-003", + "Behind base branch", + if policy.strict { + Severity::Error + } else { + Severity::Warning + }, + format!( + "head {} is {behind} commit(s) behind {}{strict}", + short(&pr.head.sha), + pr.base.ref_name + ), + "Update the branch from its base (merge or rebase), then let the checks run again.", + )); + } + } + + // PRR-004: merge conflict. + if pr.mergeable == Some(false) || pr.mergeable_state.as_deref() == Some("dirty") { + findings.push(finding( + "PRR-004", + "Merge conflict", + Severity::Error, + format!( + "head {} does not merge cleanly into {}", + short(&pr.head.sha), + pr.base.ref_name + ), + "Resolve the conflicts against the base branch.", + )); + } + + // PRR-005 / PRR-006: checks failing, and checks still pending. + let mut failing = Vec::new(); + let mut pending = Vec::new(); + if let Some(runs) = &s.check_runs { + for cr in latest_check_runs(runs) { + if is_own_run(cr, opts) { + continue; + } + let req = if policy.contexts.contains_key(&cr.name) { + " (required)" + } else { + "" + }; + if cr.status != "completed" { + pending.push(format!("{}{req} [{}]", link_of(cr), cr.status)); + } else if let Some(c) = cr.conclusion.as_deref() { + if FAILING_CONCLUSIONS.contains(&c) { + failing.push(format!("{}{req} [{c}]", link_of(cr))); + } + } + } + } + if let Some(st) = &s.status { + for cs in &st.statuses { + let req = if policy.contexts.contains_key(&cs.context) { + " (required)" + } else { + "" + }; + let name = match &cs.target_url { + Some(u) if !u.is_empty() => format!("{} <{u}>", cs.context), + _ => cs.context.clone(), + }; + match cs.state.as_str() { + "failure" | "error" => failing.push(format!("{name}{req} [{}]", cs.state)), + "pending" => pending.push(format!("{name}{req} [pending]")), + _ => {} + } + } + } + if !failing.is_empty() { + findings.push(finding( + "PRR-005", + "Checks failing", + Severity::Error, + format!( + "{} check(s) on head {} did not pass: {}", + failing.len(), + short(&pr.head.sha), + list(&failing) + ), + "Fix the cause and re-run; a cancelled or timed-out check needs a re-run to count.", + )); + } + if !pending.is_empty() { + findings.push(finding( + "PRR-006", + "Checks pending", + Severity::Info, + format!( + "{} check(s) on head {} had not finished when readiness was read: {}", + pending.len(), + short(&pr.head.sha), + list(&pending) + ), + "Wait for the checks to finish; a check queued for a long time may need a runner or a re-run.", + )); + } + + // PRR-007: a required context that nothing on the head provides. A check + // run provides it when its name matches (and, if the rule names providing + // apps, its app is one of them); a commit status provides it by context. + // Presence is enough here: a provided-but-failing context is PRR-005. + if s.check_runs.is_some() || s.status.is_some() { + let runs = s.check_runs.as_deref().unwrap_or(&[]); + let statuses = s.status.as_ref().map(|c| &c.statuses[..]).unwrap_or(&[]); + let missing: Vec = policy + .contexts + .iter() + .filter(|(ctx, ids)| { + let by_run = runs.iter().any(|cr| { + &cr.name == *ctx + && (ids.is_empty() + || cr + .app + .as_ref() + .and_then(|a| a.id) + .is_none_or(|id| ids.contains(&id))) + }); + let by_status = statuses.iter().any(|cs| &cs.context == *ctx); + !(by_run || by_status) + }) + .map(|(ctx, _)| format!("`{ctx}`")) + .collect(); + if !missing.is_empty() { + findings.push(finding( + "PRR-007", + "Required status context not provided", + Severity::Error, + format!( + "{} required status context(s) on {} have no check run or commit status on head {}: {}. \ + Until something on the pull request produces each one, it cannot merge whatever reviewers approve", + missing.len(), + pr.base.ref_name, + short(&pr.head.sha), + list(&missing) + ), + "Make a workflow on this pull request produce the exact context name, or have the owner correct the rule that requires it.", + )); + } + } + + // PRR-008: draft (informational, but a draft cannot be merged). + if pr.draft { + findings.push(finding( + "PRR-008", + "Draft", + Severity::Info, + format!("pull request #{} is a draft", pr.number), + "Mark it ready for review when the work is done.", + )); + } + + let reasons: Vec = findings + .iter() + .map(|f| match f.id.as_str() { + "PRR-007" => format!( + "{}: {}", + f.name, + f.message.split(". Until").next().unwrap_or("") + ), + _ => f.name.to_lowercase(), + }) + .collect(); + let verdict = if !findings.is_empty() { + Verdict::NotReady + } else if !s.unreadable.is_empty() { + Verdict::Unknown + } else { + Verdict::Ready + }; + let mut summary = format!("PR #{} {}", pr.number, verdict.words()); + if !findings.is_empty() { + let short_reasons: Vec = findings.iter().map(reason_word).collect(); + summary.push_str(&format!(": {}", short_reasons.join("; "))); + } + if !s.unreadable.is_empty() { + summary.push_str(&format!("; could not read: {}", s.unreadable.join("; "))); + } + let auto = match &pr.auto_merge { + Some(a) => format!( + "on ({})", + a.merge_method.as_deref().unwrap_or("method unknown") + ), + None => "off".to_string(), + }; + summary.push_str(&format!( + "; draft: {}; auto-merge: {auto}", + if pr.draft { "yes" } else { "no" } + )); + + PrReadiness { + findings, + files_checked: 0, + duration_ms: 0, + verdict, + reasons, + pr: Some(pr.number), + url: Some(pr.html_url.clone()).filter(|u| !u.is_empty()), + head_sha: Some(pr.head.sha.clone()).filter(|u| !u.is_empty()), + base: Some(pr.base.ref_name.clone()).filter(|u| !u.is_empty()), + draft: Some(pr.draft), + auto_merge: Some(pr.auto_merge.is_some()), + auto_merge_method: pr.auto_merge.as_ref().and_then(|a| a.merge_method.clone()), + required_contexts: policy.contexts.keys().cloned().collect(), + unreadable: s.unreadable.clone(), + skipped: None, + summary, + } +} + +/// A short phrase for one finding, for the one-line summary. +fn reason_word(f: &Finding) -> String { + let n = f + .message + .split(|c: char| !c.is_ascii_digit()) + .next() + .unwrap_or(""); + match f.id.as_str() { + "PRR-001" => format!("{n} unresolved conversation(s)"), + "PRR-002" => format!("changes requested by {n} reviewer(s)"), + "PRR-003" => "behind base".to_string(), + "PRR-004" => "merge conflict".to_string(), + "PRR-005" => format!("{n} check(s) failing"), + "PRR-006" => format!("{n} check(s) pending"), + "PRR-007" => { + let names: Vec<&str> = f.message.split('`').skip(1).step_by(2).collect(); + format!("required context(s) not provided: {}", names.join(", ")) + } + "PRR-008" => "draft".to_string(), + _ => f.name.to_lowercase(), + } +} + +#[cfg(test)] +mod tests { + //! Fixtures in `tests/fixtures/pr_readiness/` are GitHub responses recorded + //! on 2026-11-17 and trimmed to the fields this module reads; each file + //! says where it came from in its `_source` key. Expected results come + //! from the hub's prototype run of the same day + //! (pr-readiness-2026-11-17.txt). + use super::*; + + fn load(name: &str) -> Snapshot { + let path = format!( + "{}/tests/fixtures/pr_readiness/{name}", + env!("CARGO_MANIFEST_DIR") + ); + let text = std::fs::read_to_string(&path).unwrap_or_else(|e| panic!("{path}: {e}")); + serde_json::from_str(&text).unwrap_or_else(|e| panic!("{path}: {e}")) + } + + fn ids(r: &PrReadiness) -> Vec<&str> { + r.findings.iter().map(|f| f.id.as_str()).collect() + } + + #[test] + fn rsr_template_435_is_missing_ci_gate_and_nothing_else() { + let r = evaluate(&load("rsr-template-repo-435.json"), &EvalOptions::default()); + assert_eq!(ids(&r), vec!["PRR-007"]); + assert_eq!(r.verdict, Verdict::NotReady); + assert_eq!(r.required_contexts, vec!["CI/gate".to_string()]); + let f = &r.findings[0]; + assert_eq!(f.severity, Severity::Error); + assert!(f.message.contains("`CI/gate`"), "{}", f.message); + assert!(f.file.is_none()); + assert_eq!(r.auto_merge, Some(true)); + assert_eq!(r.auto_merge_method.as_deref(), Some("squash")); + assert!( + r.summary + .contains("required context(s) not provided: CI/gate"), + "{}", + r.summary + ); + assert!( + r.summary.contains("auto-merge: on (squash)"), + "{}", + r.summary + ); + } + + #[test] + fn a_clean_pull_request_yields_no_finding_and_is_ready() { + // Negative control: #435 with the one thing it lacks supplied. + let mut s = load("rsr-template-repo-435.json"); + s.check_runs.as_mut().unwrap().push(CheckRun { + id: 1, + name: "CI/gate".into(), + status: "completed".into(), + conclusion: Some("success".into()), + ..CheckRun::default() + }); + let r = evaluate(&s, &EvalOptions::default()); + assert!(r.findings.is_empty(), "{:?}", ids(&r)); + assert_eq!(r.verdict, Verdict::Ready); + assert!(r.reasons.is_empty()); + } + + #[test] + fn a_commit_status_also_provides_a_required_context() { + let mut s = load("rsr-template-repo-435.json"); + s.status.as_mut().unwrap().statuses.push(CommitStatus { + context: "CI/gate".into(), + state: "success".into(), + target_url: None, + }); + assert!(evaluate(&s, &EvalOptions::default()).findings.is_empty()); + } + + #[test] + fn a_check_run_from_another_app_does_not_provide_an_app_bound_context() { + let mut s = load("rsr-template-repo-435.json"); + s.rules = Some(vec![Rule { + kind: "required_status_checks".into(), + parameters: Some(serde_json::json!({ + "required_status_checks": [{"context": "app-bound / check", "integration_id": 15368}] + })), + }]); + s.check_runs.as_mut().unwrap().push(CheckRun { + id: 2, + name: "app-bound / check".into(), + status: "completed".into(), + conclusion: Some("success".into()), + app: Some(App { + id: Some(1), + slug: Some("someone-else".into()), + }), + ..CheckRun::default() + }); + assert_eq!(ids(&evaluate(&s, &EvalOptions::default())), vec!["PRR-007"]); + s.check_runs.as_mut().unwrap().last_mut().unwrap().app = Some(App { + id: Some(15368), + slug: Some("github-actions".into()), + }); + assert!(evaluate(&s, &EvalOptions::default()).findings.is_empty()); + } + + #[test] + fn standards_1619_has_twenty_unresolved_conversations_in_one_finding() { + let r = evaluate(&load("standards-1619.json"), &EvalOptions::default()); + let f: Vec<&Finding> = r.findings.iter().filter(|f| f.id == "PRR-001").collect(); + assert_eq!(f.len(), 1); + assert!( + f[0].message + .starts_with("20 unresolved review conversation(s)"), + "{}", + f[0].message + ); + assert_eq!(f[0].message.matches("")); + // rsr-template-repo requires conversation resolution too. + assert_eq!(r.findings[0].severity, Severity::Error); + } + + #[test] + fn latest_review_decides_changes_requested() { + let mut s = load("rsr-template-repo-435.json"); + s.check_runs = Some(vec![]); + s.rules = Some(vec![]); + let rv = |id, who: &str, state: &str, at: &str| Review { + id, + user: Some(User { login: who.into() }), + state: state.into(), + submitted_at: Some(at.into()), + html_url: None, + }; + // alice requested changes then approved; bob requested changes then + // only commented; carol's request was dismissed. + s.reviews = Some(vec![ + rv(1, "alice", "CHANGES_REQUESTED", "2026-11-01T00:00:00Z"), + rv(2, "alice", "APPROVED", "2026-11-02T00:00:00Z"), + rv(3, "bob", "CHANGES_REQUESTED", "2026-11-01T00:00:00Z"), + rv(4, "bob", "COMMENTED", "2026-11-03T00:00:00Z"), + rv(5, "carol", "CHANGES_REQUESTED", "2026-11-01T00:00:00Z"), + rv(6, "carol", "DISMISSED", "2026-11-04T00:00:00Z"), + ]); + let r = evaluate(&s, &EvalOptions::default()); + assert_eq!(ids(&r), vec!["PRR-002"]); + assert!(r.findings[0].message.starts_with("1 reviewer(s)")); + assert!(r.findings[0].message.contains("bob")); + assert!(!r.findings[0].message.contains("alice")); + // No approvals are required on that base, so it is advisory. + assert_eq!(r.findings[0].severity, Severity::Warning); + } + + #[test] + fn failing_and_pending_checks_are_separate_and_reruns_supersede() { + let mut s = load("rsr-template-repo-435.json"); + s.rules = Some(vec![]); + let cr = |id, name: &str, status: &str, concl: Option<&str>, url: &str| CheckRun { + id, + name: name.into(), + status: status.into(), + conclusion: concl.map(Into::into), + details_url: Some(url.into()), + ..CheckRun::default() + }; + s.check_runs = Some(vec![ + cr( + 10, + "lint", + "completed", + Some("cancelled"), + "https://github.com/o/r/actions/runs/7/job/1", + ), + cr( + 11, + "lint", + "completed", + Some("success"), + "https://github.com/o/r/actions/runs/8/job/2", + ), + cr( + 12, + "test", + "completed", + Some("timed_out"), + "https://github.com/o/r/actions/runs/8/job/3", + ), + cr( + 13, + "build", + "queued", + None, + "https://github.com/o/r/actions/runs/8/job/4", + ), + cr( + 14, + "Fleet report-backs", + "in_progress", + None, + "https://github.com/o/r/actions/runs/99/job/5", + ), + ]); + s.status = Some(CombinedStatus { + statuses: vec![CommitStatus { + context: "ci/legacy".into(), + state: "error".into(), + target_url: None, + }], + }); + let r = evaluate( + &s, + &EvalOptions { + exclude_run_id: Some(99), + }, + ); + assert_eq!(ids(&r), vec!["PRR-005", "PRR-006"]); + assert!( + r.findings[0].message.starts_with("2 check(s)"), + "{}", + r.findings[0].message + ); + assert!(r.findings[0].message.contains("test")); + assert!(r.findings[0].message.contains("ci/legacy [error]")); + assert!( + !r.findings[0].message.contains("lint"), + "the re-run superseded the cancelled lint" + ); + assert!( + r.findings[1].message.starts_with("1 check(s)"), + "own run 99 is excluded" + ); + assert_eq!(r.findings[1].severity, Severity::Info); + // Without the exclusion, the evaluating run itself reads as pending. + let r = evaluate(&s, &EvalOptions::default()); + let pending = r.findings.iter().find(|f| f.id == "PRR-006").unwrap(); + assert!(pending.message.starts_with("2 check(s)")); + } + + #[test] + fn behind_conflict_and_draft() { + let mut s = load("rsr-template-repo-435.json"); + s.check_runs = Some(vec![]); + s.rules = Some(vec![]); + s.compare = Some(Compare { behind_by: Some(3) }); + s.pull.mergeable = Some(false); + s.pull.mergeable_state = Some("dirty".into()); + s.pull.draft = true; + s.pull.auto_merge = None; + let r = evaluate(&s, &EvalOptions::default()); + assert_eq!(ids(&r), vec!["PRR-003", "PRR-004", "PRR-008"]); + // No strict up-to-date rule now, so behind is a warning. + assert_eq!(r.findings[0].severity, Severity::Warning); + assert_eq!(r.findings[2].severity, Severity::Info); + assert!( + r.summary.ends_with("draft: yes; auto-merge: off"), + "{}", + r.summary + ); + } + + #[test] + fn mergeability_still_being_computed_is_not_a_conflict() { + let mut s = load("rsr-template-repo-435.json"); + s.pull.mergeable = None; + s.pull.mergeable_state = Some("unknown".into()); + assert!(!ids(&evaluate(&s, &EvalOptions::default())).contains(&"PRR-004")); + } + + #[test] + fn an_unread_source_makes_a_clean_result_unknown_not_ready() { + let mut s = load("rsr-template-repo-435.json"); + s.check_runs.as_mut().unwrap().push(CheckRun { + id: 1, + name: "CI/gate".into(), + status: "completed".into(), + conclusion: Some("success".into()), + ..CheckRun::default() + }); + s.review_threads = None; + s.unreadable = vec!["review threads: GraphQL needs a token".into()]; + let r = evaluate(&s, &EvalOptions::default()); + assert!(r.findings.is_empty()); + assert_eq!(r.verdict, Verdict::Unknown); + assert!( + r.summary.contains("could not read: review threads"), + "{}", + r.summary + ); + } + + #[test] + fn classic_protection_contexts_count_unless_enforcement_is_off() { + let mut s = load("rsr-template-repo-435.json"); + s.rules = Some(vec![]); + s.branch = Some(Branch { + protection: Some(Protection { + required_status_checks: Some(ProtectionChecks { + enforcement_level: Some("non_admins".into()), + contexts: vec!["legacy/ci".into()], + checks: vec![], + }), + }), + }); + assert_eq!(ids(&evaluate(&s, &EvalOptions::default())), vec!["PRR-007"]); + s.branch + .as_mut() + .unwrap() + .protection + .as_mut() + .unwrap() + .required_status_checks + .as_mut() + .unwrap() + .enforcement_level = Some("off".into()); + assert!(evaluate(&s, &EvalOptions::default()).findings.is_empty()); + } + + #[test] + fn long_lists_are_capped_and_counted() { + let items: Vec = (0..30).map(|i| i.to_string()).collect(); + assert!(list(&items).ends_with("; and 5 more")); + assert_eq!(list(&items[..2]), "0; 1"); + } + + #[test] + fn run_id_is_read_from_actions_urls_only() { + assert_eq!( + run_id_of("https://github.com/o/r/actions/runs/44124672727/job/1"), + Some(44124672727) + ); + assert_eq!(run_id_of("https://sonarcloud.io/dashboard?id=x"), None); + } + + #[test] + fn skipped_report_says_why() { + let r = PrReadiness::skipped(Some(5), "no token"); + assert_eq!(r.verdict, Verdict::Skipped); + assert_eq!(r.summary, "PR #5: readiness not evaluated: no token"); + assert!(r.findings.is_empty()); + } +} diff --git a/bots/finishingbot/tests/fixtures/pr_readiness/rsr-template-repo-435.json b/bots/finishingbot/tests/fixtures/pr_readiness/rsr-template-repo-435.json new file mode 100644 index 00000000..c91ae140 --- /dev/null +++ b/bots/finishingbot/tests/fixtures/pr_readiness/rsr-template-repo-435.json @@ -0,0 +1 @@ +{"_source":"hyperpolymath/rsr-template-repo PR 435, recorded 2026-11-17 via GitHub REST (pulls, compare main...head, check-runs, status, rules/branches/main, branches/main, reviews); trimmed to the fields read. review_threads: 0 unresolved per the hub prototype run of 2026-11-17 (GraphQL was not reachable from the recording session).","branch":{"protection":{"enabled":false,"required_status_checks":{"checks":[],"contexts":[],"enforcement_level":"off"}}},"check_runs":[{"app":{"id":347564,"slug":"coderabbitai"},"conclusion":"neutral","details_url":"https://coderabbit.ai?utm_source=cr_app&utm_medium=github","html_url":"https://github.com/hyperpolymath/rsr-template-repo/runs/133819010458","id":133819010458,"name":"CodeRabbit","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137320/job/133789993243","html_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137320/job/133789993243","id":133789993243,"name":"Fork governance verdict","status":"completed"},{"app":{"id":57789,"slug":"github-advanced-security"},"conclusion":"success","details_url":"https://github.com/hyperpolymath/rsr-template-repo/runs/133788922596","html_url":"https://github.com/hyperpolymath/rsr-template-repo/runs/133788922596","id":133788922596,"name":"Hypatia","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137418/job/133788805170","html_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137418/job/133788805170","id":133788805170,"name":"ℹ️ ADVISORY: Dogfooding compliance summary (non-gating)","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137322/job/133788743662","html_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137322/job/133788743662","id":133788743662,"name":"Deposit findings for gitbot-fleet","status":"completed"},{"app":{"id":57789,"slug":"github-advanced-security"},"conclusion":"success","details_url":"https://github.com/hyperpolymath/rsr-template-repo/runs/133788630389","html_url":"https://github.com/hyperpolymath/rsr-template-repo/runs/133788630389","id":133788630389,"name":"CodeQL","status":"completed"},{"app":{"id":12526,"slug":"sonarqubecloud"},"conclusion":"success","details_url":"https://sonarcloud.io/dashboard?id=hyperpolymath_rsr-template-repo2&pullRequest=435","html_url":"https://github.com/hyperpolymath/rsr-template-repo/runs/133788519501","id":133788519501,"name":"SonarCloud Code Analysis","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"skipped","details_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137205/job/133788391535","html_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137205/job/133788391535","id":133788391535,"name":"automerge","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"skipped","details_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008128888/job/133788342206","html_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008128888/job/133788342206","id":133788342206,"name":"Email on push","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"skipped","details_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137418/job/133788335061","html_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137418/job/133788335061","id":133788335061,"name":"Publish the lane badges","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"skipped","details_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137418/job/133788334932","html_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137418/job/133788334932","id":133788334932,"name":"Validate DEED manifests","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"skipped","details_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137418/job/133788334649","html_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137418/job/133788334649","id":133788334649,"name":"Validate K9 contracts","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137622/job/133788333606","html_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137622/job/133788333606","id":133788333606,"name":"SonarQube","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137418/job/133788333460","html_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137418/job/133788333460","id":133788333460,"name":"Validate eclexiaiser manifest","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137531/job/133788333367","html_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137531/job/133788333367","id":133788333367,"name":"lint","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137418/job/133788333317","html_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137418/job/133788333317","id":133788333317,"name":"RSR oracle — dogfood this repo","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137418/job/133788333292","html_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137418/job/133788333292","id":133788333292,"name":"🟡 CHECK: Groove manifest check","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137531/job/133788333289","html_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137531/job/133788333289","id":133788333289,"name":"docs","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137418/job/133788333231","html_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137418/job/133788333231","id":133788333231,"name":"Canon lockstep","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137481/job/133788333215","html_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137481/job/133788333215","id":133788333215,"name":"check","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137495/job/133788333166","html_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137495/job/133788333166","id":133788333166,"name":"Hypatia Neurosymbolic Analysis","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137386/job/133788333107","html_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137386/job/133788333107","id":133788333107,"name":"Dogfooding compliance summary","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137541/job/133788333014","html_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137541/job/133788333014","id":133788333014,"name":"Squabble CI chains & required-context gate","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137418/job/133788332945","html_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137418/job/133788332945","id":133788332945,"name":"🔴 GATE: Empty-linter (invisible characters)","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137531/job/133788332913","html_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137531/job/133788332913","id":133788332913,"name":"mint-gates","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137320/job/133788332895","html_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137320/job/133788332895","id":133788332895,"name":"K9-DEED conformance","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137320/job/133788332881","html_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137320/job/133788332881","id":133788332881,"name":"DEED syntax","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137375/job/133788332786","html_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137375/job/133788332786","id":133788332786,"name":"Proven 3-outcome test & bench suite","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137321/job/133788332748","html_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137321/job/133788332748","id":133788332748,"name":"Rust standalone tools and workspace gate","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137201/job/133788332691","html_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137201/job/133788332691","id":133788332691,"name":"🔴 GATE: Empty-linter (invisible characters)","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137322/job/133788332673","html_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137322/job/133788332673","id":133788332673,"name":"panic-attack & pons-asinorum deep recon","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137278/job/133788332662","html_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137278/job/133788332662","id":133788332662,"name":"lint-workflows","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137345/job/133788332627","html_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137345/job/133788332627","id":133788332627,"name":"openssf-compliance","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137199/job/133788332545","html_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137199/job/133788332545","id":133788332545,"name":"Estate Governance Policy","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137199/job/133788332515","html_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137199/job/133788332515","id":133788332515,"name":"K9 conformance","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137364/job/133788332504","html_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137364/job/133788332504","id":133788332504,"name":"🟡 CHECK: Validate eclexiaiser manifest","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137320/job/133788332491","html_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137320/job/133788332491","id":133788332491,"name":"Fleet report-backs","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137199/job/133788332409","html_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137199/job/133788332409","id":133788332409,"name":"Deed conformance","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137199/job/133788332371","html_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137199/job/133788332371","id":133788332371,"name":"Debt ratchet","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137370/job/133788332345","html_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137370/job/133788332345","id":133788332345,"name":"check","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137297/job/133788332335","html_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137297/job/133788332335","id":133788332335,"name":"scan / shell-secrets","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137322/job/133788332288","html_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137322/job/133788332288","id":133788332288,"name":"Patch Bridge CVE triage","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137297/job/133788332229","html_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137297/job/133788332229","id":133788332229,"name":"scan / rust-secrets","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137227/job/133788332225","html_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137227/job/133788332225","id":133788332225,"name":"🟡 CHECK: Groove manifest check","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137213/job/133788332153","html_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137213/job/133788332153","id":133788332153,"name":"estate-rules","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137199/job/133788332134","html_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137199/job/133788332134","id":133788332134,"name":"Existing A2ML (advisory)","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137190/job/133788332084","html_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137190/job/133788332084","id":133788332084,"name":"actions.lock is in sync with the workflow YAML","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137297/job/133788331973","html_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137297/job/133788331973","id":133788331973,"name":"scan / gitleaks","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137178/job/133788331850","html_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008137178/job/133788331850","id":133788331850,"name":"Central Estate CI/CD Audit","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008129582/job/133788312225","html_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008129582/job/133788312225","id":133788312225,"name":"Analyze (javascript-typescript)","status":"completed"},{"app":{"id":5061919,"slug":"semgrep-code-hyperpolymath"},"conclusion":"success","details_url":"https://semgrep.dev/orgs/cc_studio/projects/6671408/scans/270463050","html_url":"https://github.com/hyperpolymath/rsr-template-repo/runs/133788312183","id":133788312183,"name":"semgrep-cloud-platform/scan","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008129582/job/133788312143","html_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008129582/job/133788312143","id":133788312143,"name":"Analyze (actions)","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008129582/job/133788311942","html_url":"https://github.com/hyperpolymath/rsr-template-repo/actions/runs/44008129582/job/133788311942","id":133788311942,"name":"Analyze (rust)","status":"completed"},{"app":{"id":46505,"slug":"gitguardian"},"conclusion":"success","details_url":"https://dashboard.gitguardian.com","html_url":"https://github.com/hyperpolymath/rsr-template-repo/runs/133788310662","id":133788310662,"name":"GitGuardian Security Checks","status":"completed"}],"compare":{"behind_by":0},"pull":{"auto_merge":{"merge_method":"squash"},"base":{"ref":"main","sha":"0044ad92f9e6ef258b89f3e9b5ee7b748a4db2d2"},"draft":false,"head":{"ref":"claude/kyaml-label-pin-check","sha":"4af3735ac356c3d27db3609f86bd45c290a1be13"},"html_url":"https://github.com/hyperpolymath/rsr-template-repo/pull/435","mergeable":true,"mergeable_state":"blocked","number":435,"state":"open"},"review_threads":[],"reviews":[],"rules":[{"parameters":null,"type":"deletion"},{"parameters":null,"type":"non_fast_forward"},{"parameters":null,"type":"required_signatures"},{"parameters":{"allowed_merge_methods":["merge","squash","rebase"],"dismiss_stale_reviews_on_push":true,"require_code_owner_review":false,"require_extra_approval_for_unattributed_changes":true,"require_last_push_approval":false,"required_approving_review_count":0,"required_review_thread_resolution":true,"required_reviewers":[]},"type":"pull_request"},{"parameters":{"do_not_enforce_on_create":false,"required_status_checks":[{"context":"CI/gate"}],"strict_required_status_checks_policy":true},"type":"required_status_checks"},{"parameters":{"max_coverage_drop":5,"minimum_coverage":80},"type":"code_coverage"},{"parameters":null,"type":"required_linear_history"}],"status":{"statuses":[]}} diff --git a/bots/finishingbot/tests/fixtures/pr_readiness/standards-1619.json b/bots/finishingbot/tests/fixtures/pr_readiness/standards-1619.json new file mode 100644 index 00000000..e6389109 --- /dev/null +++ b/bots/finishingbot/tests/fixtures/pr_readiness/standards-1619.json @@ -0,0 +1 @@ +{"_source":"metadatastician/standards PR 1619, recorded 2026-11-17 via GitHub REST (pulls, compare, check-runs, status, rules/branches/main, branches/main, reviews, review comments); trimmed to the fields read. review_threads is RECONSTRUCTED: GraphQL was not reachable from the recording session, so one thread per top-level review comment (29) was built from the REST review comments, and the hub prototype's count of 20 unresolved was reproduced by marking the 9 oldest resolved. Which 9 were really resolved is not recorded.","branch":{"protection":{"enabled":false,"required_status_checks":{"checks":[],"contexts":[],"enforcement_level":"off"}}},"check_runs":[{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838508/job/133781242727","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838508/job/133781242727","id":133781242727,"name":"Repo self-tests","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838558/job/133779196057","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838558/job/133779196057","id":133779196057,"name":"Post the fork governance summary / Post the fork governance summary","status":"completed"},{"app":{"id":57789,"slug":"github-advanced-security"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/runs/133779051782","html_url":"https://github.com/metadatastician/standards/runs/133779051782","id":133779051782,"name":"Hypatia","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838558/job/133778597644","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838558/job/133778597644","id":133778597644,"name":"Hypatia verdict grid / Hypatia Neurosymbolic Analysis","status":"completed"},{"app":{"id":57789,"slug":"github-advanced-security"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/runs/133777843884","html_url":"https://github.com/metadatastician/standards/runs/133777843884","id":133777843884,"name":"CodeQL","status":"completed"},{"app":{"id":57789,"slug":"github-advanced-security"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/runs/133777816530","html_url":"https://github.com/metadatastician/standards/runs/133777816530","id":133777816530,"name":"Scorecard","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838642/job/133777782740","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838642/job/133777782740","id":133777782740,"name":"Call CI Pipeline / Pipeline report","status":"completed"},{"app":{"id":347564,"slug":"coderabbitai"},"conclusion":"neutral","details_url":"https://coderabbit.ai?utm_source=cr_app&utm_medium=github","html_url":"https://github.com/metadatastician/standards/runs/133777704783","id":133777704783,"name":"CodeRabbit","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838813/job/133777682699","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838813/job/133777682699","id":133777682699,"name":"governance / Validate Hypatia Baseline","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"skipped","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838642/job/133777656845","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838642/job/133777656845","id":133777656845,"name":"Call CI Pipeline / Rust / Cargo test","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"skipped","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838642/job/133777656829","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838642/job/133777656829","id":133777656829,"name":"Call CI Pipeline / Rust / Cargo audit (security)","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"skipped","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838642/job/133777655690","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838642/job/133777655690","id":133777655690,"name":"Call CI Pipeline / Rust / llvm-cov line coverage","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"skipped","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838642/job/133777655386","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838642/job/133777655386","id":133777655386,"name":"Call CI Pipeline / Rust / Cargo check + clippy + fmt","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"skipped","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838642/job/133777612596","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838642/job/133777612596","id":133777612596,"name":"Call CI Pipeline / V","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"skipped","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838642/job/133777612538","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838642/job/133777612538","id":133777612538,"name":"Call CI Pipeline / Deno (tier 2)","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"skipped","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838642/job/133777612485","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838642/job/133777612485","id":133777612485,"name":"Call CI Pipeline / ReScript","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"skipped","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838642/job/133777612465","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838642/job/133777612465","id":133777612465,"name":"Call CI Pipeline / Haskell","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838642/job/133777610895","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838642/job/133777610895","id":133777610895,"name":"Call CI Pipeline / Rust / Detect Cargo.toml","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838642/job/133777610773","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838642/job/133777610773","id":133777610773,"name":"Call CI Pipeline / Nickel","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"skipped","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838311/job/133777607462","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838311/job/133777607462","id":133777607462,"name":"Idris2 — this repository's proofs","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"skipped","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838311/job/133777607179","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838311/job/133777607179","id":133777607179,"name":"Agda — lol/proofs","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"skipped","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838311/job/133777607115","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838311/job/133777607115","id":133777607115,"name":"Idris2 — AVOW consent proofs","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838311/job/133777606128","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838311/job/133777606128","id":133777606128,"name":"Trust pipeline summary","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"skipped","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838686/job/133777595792","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838686/job/133777595792","id":133777595792,"name":"ci / Compile + test","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004840349/job/133777549529","html_url":"https://github.com/metadatastician/standards/actions/runs/44004840349/job/133777549529","id":133777549529,"name":"github-advanced-security","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"skipped","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838813/job/133777540584","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838813/job/133777540584","id":133777540584,"name":"governance / Deed conformance","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"skipped","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838813/job/133777540463","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838813/job/133777540463","id":133777540463,"name":"governance / K9 conformance","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"skipped","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838599/job/133777539806","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838599/job/133777539806","id":133777539806,"name":"scorecard / Run Scorecard","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838813/job/133777539168","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838813/job/133777539168","id":133777539168,"name":"governance / Live Actions policy (credentialed advisory)","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838813/job/133777539116","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838813/job/133777539116","id":133777539116,"name":"governance / Trusted-base reduction policy","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838813/job/133777539109","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838813/job/133777539109","id":133777539109,"name":"governance / Guix packaging policy (Nix retired)","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838813/job/133777539028","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838813/job/133777539028","id":133777539028,"name":"governance / Exemption ratchet","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838813/job/133777539026","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838813/job/133777539026","id":133777539026,"name":"governance / Licence consistency","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838813/job/133777539022","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838813/job/133777539022","id":133777539022,"name":"governance / Language / package anti-pattern policy","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838813/job/133777539016","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838813/job/133777539016","id":133777539016,"name":"governance / JS runtimes — deno","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838813/job/133777539001","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838813/job/133777539001","id":133777539001,"name":"governance / Code quality + docs","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838813/job/133777538987","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838813/job/133777538987","id":133777538987,"name":"governance / JS runtimes — pnpm","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838813/job/133777538962","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838813/job/133777538962","id":133777538962,"name":"governance / JS runtimes — environment provisions Bun first","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838813/job/133777538961","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838813/job/133777538961","id":133777538961,"name":"governance / Security policy checks","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838813/job/133777538943","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838813/job/133777538943","id":133777538943,"name":"governance / Debt ratchet","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838813/job/133777538934","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838813/job/133777538934","id":133777538934,"name":"governance / Workflow security linter","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838813/job/133777538933","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838813/job/133777538933","id":133777538933,"name":"governance / Actions lockfile verify","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838813/job/133777538919","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838813/job/133777538919","id":133777538919,"name":"governance / Well-Known (RFC 9116 + RSR)","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838813/job/133777538820","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838813/job/133777538820","id":133777538820,"name":"governance / JS runtimes — bun","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838813/job/133777538792","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838813/job/133777538792","id":133777538792,"name":"governance / Failing deeds (advisory)","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838813/job/133777538707","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838813/job/133777538707","id":133777538707,"name":"governance / UUID v8 conformance","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838813/job/133777538691","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838813/job/133777538691","id":133777538691,"name":"governance / Allowlist Preflight","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838813/job/133777538650","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838813/job/133777538650","id":133777538650,"name":"governance / Check Workflow Staleness","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838813/job/133777538623","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838813/job/133777538623","id":133777538623,"name":"governance / Touched deeds pass deed_lint","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838813/job/133777538588","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838813/job/133777538588","id":133777538588,"name":"governance / Existing A2ML (advisory)","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838813/job/133777538516","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838813/job/133777538516","id":133777538516,"name":"governance / No new A2ML","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838642/job/133777538410","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838642/job/133777538410","id":133777538410,"name":"Call CI Pipeline / Secret scanning / gitleaks","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838642/job/133777538363","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838642/job/133777538363","id":133777538363,"name":"Call CI Pipeline / Secret scanning / rust-secrets","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838642/job/133777538355","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838642/job/133777538355","id":133777538355,"name":"Call CI Pipeline / Secret scanning / shell-secrets","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838813/job/133777538320","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838813/job/133777538320","id":133777538320,"name":"governance / UUID v7 conformance","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838558/job/133777538232","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838558/job/133777538232","id":133777538232,"name":"Fleet report-backs","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838717/job/133777538217","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838717/job/133777538217","id":133777538217,"name":"scan / shell-secrets","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838558/job/133777538122","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838558/job/133777538122","id":133777538122,"name":"K9-DEED conformance / validate","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838558/job/133777538108","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838558/job/133777538108","id":133777538108,"name":"DEED syntax / lint","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838717/job/133777538100","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838717/job/133777538100","id":133777538100,"name":"scan / gitleaks","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838447/job/133777538049","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838447/job/133777538049","id":133777538049,"name":"analyze-actions / analyze","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838642/job/133777538045","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838642/job/133777538045","id":133777538045,"name":"Call CI Pipeline / Detect ecosystems","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838717/job/133777537870","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838717/job/133777537870","id":133777537870,"name":"scan / rust-secrets","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838558/job/133777537830","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838558/job/133777537830","id":133777537830,"name":"Capture previous bot-authored Hypatia grid","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838599/job/133777537739","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838599/job/133777537739","id":133777537739,"name":"scorecard / Run Scorecard PR","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838686/job/133777537716","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838686/job/133777537716","id":133777537716,"name":"ci / Detect mix.exs","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838447/job/133777537706","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838447/job/133777537706","id":133777537706,"name":"analyze-js / analyze","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838538/job/133777537547","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838538/job/133777537547","id":133777537547,"name":"actions.lock is in sync with the workflow YAML","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838575/job/133777537363","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838575/job/133777537363","id":133777537363,"name":"AffineScript Verify","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838508/job/133777537321","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838508/job/133777537321","id":133777537321,"name":"Hypatia single-scan projection contract","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838460/job/133777537296","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838460/job/133777537296","id":133777537296,"name":"squabble / Squabble chains (cycles and dead upstreams block)","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838508/job/133777537214","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838508/job/133777537214","id":133777537214,"name":"Repo self-tests (heavy)","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838508/job/133777536942","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838508/job/133777536942","id":133777536942,"name":"Repo self-tests (light)","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838460/job/133777536929","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838460/job/133777536929","id":133777536929,"name":"squabble / Squabble fight report (advisory)","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838383/job/133777536813","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838383/job/133777536813","id":133777536813,"name":"Rust coverage (playbook-to-recipe)","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838383/job/133777536732","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838383/job/133777536732","id":133777536732,"name":"Rust coverage (js-runtimes)","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838383/job/133777536683","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838383/job/133777536683","id":133777536683,"name":"Rust coverage (ecosystem-ingest)","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838383/job/133777536666","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838383/job/133777536666","id":133777536666,"name":"Rust coverage (k9-init)","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838431/job/133777536610","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838431/job/133777536610","id":133777536610,"name":"uses ⊆ actions.lock","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838383/job/133777536601","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838383/job/133777536601","id":133777536601,"name":"Rust coverage (uuid-v8)","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838471/job/133777536548","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838471/job/133777536548","id":133777536548,"name":"Check Documentation Format","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838384/job/133777536494","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838384/job/133777536494","id":133777536494,"name":"Required contexts are producible","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838339/job/133777536362","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838339/job/133777536362","id":133777536362,"name":"Canon self-conformance","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838339/job/133777536315","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838339/job/133777536315","id":133777536315,"name":"Canon / spine lockstep","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838383/job/133777536237","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838383/job/133777536237","id":133777536237,"name":"Rust coverage (inline-annotations-extractor)","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838314/job/133777536073","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838314/job/133777536073","id":133777536073,"name":"K9-SVC contractile validation","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838339/job/133777536045","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838339/job/133777536045","id":133777536045,"name":"Standards map integrity","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838347/job/133777535972","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838347/job/133777535972","id":133777535972,"name":"Reject non-v8 UUID literals","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838311/job/133777535684","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838311/job/133777535684","id":133777535684,"name":"Detect proof changes","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838362/job/133777535625","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838362/job/133777535625","id":133777535625,"name":"Lockfile self-consistency","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838284/job/133777535501","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838284/job/133777535501","id":133777535501,"name":"Verify CLAIMS.a2ml + conformance","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838313/job/133777535480","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838313/job/133777535480","id":133777535480,"name":"Scan for hand-authored JavaScript/TypeScript","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838357/job/133777535341","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838357/job/133777535341","id":133777535341,"name":"SPARK Theatre Gate","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838248/job/133777535286","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838248/job/133777535286","id":133777535286,"name":"test","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838234/job/133777535073","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838234/job/133777535073","id":133777535073,"name":"Converted JSON stays canonical","status":"completed"},{"app":{"id":15368,"slug":"github-actions"},"conclusion":"success","details_url":"https://github.com/metadatastician/standards/actions/runs/44004838234/job/133777534657","html_url":"https://github.com/metadatastician/standards/actions/runs/44004838234/job/133777534657","id":133777534657,"name":"Report non-canonical JSON (report-only)","status":"completed"},{"app":{"id":46505,"slug":"gitguardian"},"conclusion":"success","details_url":"https://dashboard.gitguardian.com","html_url":"https://github.com/metadatastician/standards/runs/133777525292","id":133777525292,"name":"GitGuardian Security Checks","status":"completed"},{"app":{"id":5061649,"slug":"semgrep-code-metadatastician"},"conclusion":"success","details_url":"https://semgrep.dev/orgs/cc_studio/projects/6671085/scans/270450111","html_url":"https://github.com/metadatastician/standards/runs/133777524685","id":133777524685,"name":"semgrep-cloud-platform/scan","status":"completed"}],"compare":{"behind_by":14},"pull":{"auto_merge":{"merge_method":"squash"},"base":{"ref":"main","sha":"830b0d3758370b7496b83f61e6ec90d9e31080ec"},"draft":false,"head":{"ref":"claude/eager-noether-1seyvi","sha":"fae34b22ffbef01665419799bc9996d846865956"},"html_url":"https://github.com/metadatastician/standards/pull/1619","mergeable":true,"mergeable_state":"blocked","number":1619,"state":"open"},"review_threads":[{"comments":{"nodes":[{"url":"https://github.com/metadatastician/standards/pull/1619#discussion_r4590538869"}]},"isOutdated":false,"isResolved":true,"line":6,"path":"CODE_OF_CONDUCT.md"},{"comments":{"nodes":[{"url":"https://github.com/metadatastician/standards/pull/1619#discussion_r4590538874"}]},"isOutdated":true,"isResolved":true,"line":null,"path":"CONTRIBUTING.md"},{"comments":{"nodes":[{"url":"https://github.com/metadatastician/standards/pull/1619#discussion_r4590538879"}]},"isOutdated":true,"isResolved":true,"line":null,"path":"CONTRIBUTING.md"},{"comments":{"nodes":[{"url":"https://github.com/metadatastician/standards/pull/1619#discussion_r4590538885"}]},"isOutdated":true,"isResolved":true,"line":null,"path":"CONTRIBUTING.md"},{"comments":{"nodes":[{"url":"https://github.com/metadatastician/standards/pull/1619#discussion_r4591888329"}]},"isOutdated":true,"isResolved":true,"line":null,"path":"3-practice/CONTRIBUTING.adoc"},{"comments":{"nodes":[{"url":"https://github.com/metadatastician/standards/pull/1619#discussion_r4592151878"}]},"isOutdated":true,"isResolved":true,"line":null,"path":"3-practice/CONTRIBUTING.adoc"},{"comments":{"nodes":[{"url":"https://github.com/metadatastician/standards/pull/1619#discussion_r4592151900"}]},"isOutdated":true,"isResolved":true,"line":null,"path":"CONTRIBUTING.md"},{"comments":{"nodes":[{"url":"https://github.com/metadatastician/standards/pull/1619#discussion_r4592151917"}]},"isOutdated":false,"isResolved":true,"line":6,"path":"CODE_OF_CONDUCT.md"},{"comments":{"nodes":[{"url":"https://github.com/metadatastician/standards/pull/1619#discussion_r4592151928"}]},"isOutdated":true,"isResolved":true,"line":null,"path":"CONTRIBUTING.md"},{"comments":{"nodes":[{"url":"https://github.com/metadatastician/standards/pull/1619#discussion_r4592151940"}]},"isOutdated":true,"isResolved":false,"line":null,"path":"CITATION.cff"},{"comments":{"nodes":[{"url":"https://github.com/metadatastician/standards/pull/1619#discussion_r4592965732"}]},"isOutdated":false,"isResolved":false,"line":123,"path":"3-practice/CODE_OF_CONDUCT.adoc"},{"comments":{"nodes":[{"url":"https://github.com/metadatastician/standards/pull/1619#discussion_r4592965745"}]},"isOutdated":true,"isResolved":false,"line":null,"path":"3-practice/CODE_OF_CONDUCT.adoc"},{"comments":{"nodes":[{"url":"https://github.com/metadatastician/standards/pull/1619#discussion_r4592965756"}]},"isOutdated":true,"isResolved":false,"line":null,"path":"3-practice/CONTRIBUTING.adoc"},{"comments":{"nodes":[{"url":"https://github.com/metadatastician/standards/pull/1619#discussion_r4592965771"}]},"isOutdated":true,"isResolved":false,"line":null,"path":"3-practice/CONTRIBUTING.adoc"},{"comments":{"nodes":[{"url":"https://github.com/metadatastician/standards/pull/1619#discussion_r4592973433"}]},"isOutdated":true,"isResolved":false,"line":null,"path":"3-practice/CONTRIBUTING.adoc"},{"comments":{"nodes":[{"url":"https://github.com/metadatastician/standards/pull/1619#discussion_r4592973442"}]},"isOutdated":true,"isResolved":false,"line":null,"path":"3-practice/CONTRIBUTING.adoc"},{"comments":{"nodes":[{"url":"https://github.com/metadatastician/standards/pull/1619#discussion_r4592973450"}]},"isOutdated":true,"isResolved":false,"line":null,"path":"3-practice/CONTRIBUTING.adoc"},{"comments":{"nodes":[{"url":"https://github.com/metadatastician/standards/pull/1619#discussion_r4592973462"}]},"isOutdated":false,"isResolved":false,"line":165,"path":"3-practice/CONTRIBUTING.adoc"},{"comments":{"nodes":[{"url":"https://github.com/metadatastician/standards/pull/1619#discussion_r4592973466"}]},"isOutdated":false,"isResolved":false,"line":172,"path":"3-practice/CONTRIBUTING.adoc"},{"comments":{"nodes":[{"url":"https://github.com/metadatastician/standards/pull/1619#discussion_r4592973478"}]},"isOutdated":false,"isResolved":false,"line":123,"path":"3-practice/CODE_OF_CONDUCT.adoc"},{"comments":{"nodes":[{"url":"https://github.com/metadatastician/standards/pull/1619#discussion_r4593615738"}]},"isOutdated":true,"isResolved":false,"line":null,"path":"3-practice/CONTRIBUTING.adoc"},{"comments":{"nodes":[{"url":"https://github.com/metadatastician/standards/pull/1619#discussion_r4593615747"}]},"isOutdated":true,"isResolved":false,"line":null,"path":"3-practice/CONTRIBUTING.adoc"},{"comments":{"nodes":[{"url":"https://github.com/metadatastician/standards/pull/1619#discussion_r4593624643"}]},"isOutdated":true,"isResolved":false,"line":null,"path":"3-practice/CODE_OF_CONDUCT.adoc"},{"comments":{"nodes":[{"url":"https://github.com/metadatastician/standards/pull/1619#discussion_r4593624651"}]},"isOutdated":true,"isResolved":false,"line":null,"path":"3-practice/CONTRIBUTING.adoc"},{"comments":{"nodes":[{"url":"https://github.com/metadatastician/standards/pull/1619#discussion_r4593734324"}]},"isOutdated":false,"isResolved":false,"line":128,"path":"3-practice/CODE_OF_CONDUCT.adoc"},{"comments":{"nodes":[{"url":"https://github.com/metadatastician/standards/pull/1619#discussion_r4594259649"}]},"isOutdated":true,"isResolved":false,"line":null,"path":"3-practice/CODE_OF_CONDUCT.adoc"},{"comments":{"nodes":[{"url":"https://github.com/metadatastician/standards/pull/1619#discussion_r4594271819"}]},"isOutdated":true,"isResolved":false,"line":null,"path":"3-practice/CODE_OF_CONDUCT.adoc"},{"comments":{"nodes":[{"url":"https://github.com/metadatastician/standards/pull/1619#discussion_r4594271831"}]},"isOutdated":true,"isResolved":false,"line":null,"path":"3-practice/CODE_OF_CONDUCT.adoc"},{"comments":{"nodes":[{"url":"https://github.com/metadatastician/standards/pull/1619#discussion_r4594271836"}]},"isOutdated":false,"isResolved":false,"line":110,"path":"3-practice/CONTRIBUTING.adoc"}],"reviews":[{"html_url":"https://github.com/metadatastician/standards/pull/1619#pullrequestreview-5926082160","id":5926082160,"state":"COMMENTED","submitted_at":"2026-11-16T19:24:11Z","user":{"login":"copilot-pull-request-reviewer[bot]"}},{"html_url":"https://github.com/metadatastician/standards/pull/1619#pullrequestreview-5926271471","id":5926271471,"state":"COMMENTED","submitted_at":"2026-11-16T19:36:36Z","user":{"login":"chatgpt-codex-connector[bot]"}},{"html_url":"https://github.com/metadatastician/standards/pull/1619#pullrequestreview-5926935084","id":5926935084,"state":"COMMENTED","submitted_at":"2026-11-16T20:20:40Z","user":{"login":"copilot-pull-request-reviewer[bot]"}},{"html_url":"https://github.com/metadatastician/standards/pull/1619#pullrequestreview-5927961316","id":5927961316,"state":"COMMENTED","submitted_at":"2026-11-16T21:23:39Z","user":{"login":"copilot-pull-request-reviewer[bot]"}},{"html_url":"https://github.com/metadatastician/standards/pull/1619#pullrequestreview-5927961655","id":5927961655,"state":"COMMENTED","submitted_at":"2026-11-16T21:23:40Z","user":{"login":"hyperpolymath"}},{"html_url":"https://github.com/metadatastician/standards/pull/1619#pullrequestreview-5927962438","id":5927962438,"state":"COMMENTED","submitted_at":"2026-11-16T21:23:43Z","user":{"login":"hyperpolymath"}},{"html_url":"https://github.com/metadatastician/standards/pull/1619#pullrequestreview-5927963303","id":5927963303,"state":"COMMENTED","submitted_at":"2026-11-16T21:23:46Z","user":{"login":"hyperpolymath"}},{"html_url":"https://github.com/metadatastician/standards/pull/1619#pullrequestreview-5927964075","id":5927964075,"state":"COMMENTED","submitted_at":"2026-11-16T21:23:48Z","user":{"login":"hyperpolymath"}},{"html_url":"https://github.com/metadatastician/standards/pull/1619#pullrequestreview-5928055823","id":5928055823,"state":"COMMENTED","submitted_at":"2026-11-16T21:29:21Z","user":{"login":"hyperpolymath"}},{"html_url":"https://github.com/metadatastician/standards/pull/1619#pullrequestreview-5928056187","id":5928056187,"state":"COMMENTED","submitted_at":"2026-11-16T21:29:22Z","user":{"login":"copilot-pull-request-reviewer[bot]"}},{"html_url":"https://github.com/metadatastician/standards/pull/1619#pullrequestreview-5928112705","id":5928112705,"state":"COMMENTED","submitted_at":"2026-11-16T21:33:11Z","user":{"login":"chatgpt-codex-connector[bot]"}},{"html_url":"https://github.com/metadatastician/standards/pull/1619#pullrequestreview-5928395488","id":5928395488,"state":"COMMENTED","submitted_at":"2026-11-16T21:52:21Z","user":{"login":"hyperpolymath"}},{"html_url":"https://github.com/metadatastician/standards/pull/1619#pullrequestreview-5928396052","id":5928396052,"state":"COMMENTED","submitted_at":"2026-11-16T21:52:23Z","user":{"login":"copilot-pull-request-reviewer[bot]"}},{"html_url":"https://github.com/metadatastician/standards/pull/1619#pullrequestreview-5928468060","id":5928468060,"state":"COMMENTED","submitted_at":"2026-11-16T21:56:46Z","user":{"login":"chatgpt-codex-connector[bot]"}},{"html_url":"https://github.com/metadatastician/standards/pull/1619#pullrequestreview-5929482593","id":5929482593,"state":"COMMENTED","submitted_at":"2026-11-16T23:04:45Z","user":{"login":"hyperpolymath"}},{"html_url":"https://github.com/metadatastician/standards/pull/1619#pullrequestreview-5929483124","id":5929483124,"state":"COMMENTED","submitted_at":"2026-11-16T23:04:48Z","user":{"login":"copilot-pull-request-reviewer[bot]"}},{"html_url":"https://github.com/metadatastician/standards/pull/1619#pullrequestreview-5929483150","id":5929483150,"state":"COMMENTED","submitted_at":"2026-11-16T23:04:48Z","user":{"login":"hyperpolymath"}},{"html_url":"https://github.com/metadatastician/standards/pull/1619#pullrequestreview-5929483720","id":5929483720,"state":"COMMENTED","submitted_at":"2026-11-16T23:04:51Z","user":{"login":"hyperpolymath"}},{"html_url":"https://github.com/metadatastician/standards/pull/1619#pullrequestreview-5929484352","id":5929484352,"state":"COMMENTED","submitted_at":"2026-11-16T23:04:54Z","user":{"login":"hyperpolymath"}},{"html_url":"https://github.com/metadatastician/standards/pull/1619#pullrequestreview-5929484857","id":5929484857,"state":"COMMENTED","submitted_at":"2026-11-16T23:04:56Z","user":{"login":"hyperpolymath"}},{"html_url":"https://github.com/metadatastician/standards/pull/1619#pullrequestreview-5929555904","id":5929555904,"state":"COMMENTED","submitted_at":"2026-11-16T23:10:51Z","user":{"login":"coderabbitai[bot]"}},{"html_url":"https://github.com/metadatastician/standards/pull/1619#pullrequestreview-5929565556","id":5929565556,"state":"COMMENTED","submitted_at":"2026-11-16T23:11:43Z","user":{"login":"chatgpt-codex-connector[bot]"}},{"html_url":"https://github.com/metadatastician/standards/pull/1619#pullrequestreview-5930380373","id":5930380373,"state":"COMMENTED","submitted_at":"2026-11-17T00:20:55Z","user":{"login":"hyperpolymath"}},{"html_url":"https://github.com/metadatastician/standards/pull/1619#pullrequestreview-5930380811","id":5930380811,"state":"COMMENTED","submitted_at":"2026-11-17T00:20:57Z","user":{"login":"copilot-pull-request-reviewer[bot]"}},{"html_url":"https://github.com/metadatastician/standards/pull/1619#pullrequestreview-5930380905","id":5930380905,"state":"COMMENTED","submitted_at":"2026-11-17T00:20:58Z","user":{"login":"hyperpolymath"}},{"html_url":"https://github.com/metadatastician/standards/pull/1619#pullrequestreview-5930381406","id":5930381406,"state":"COMMENTED","submitted_at":"2026-11-17T00:21:00Z","user":{"login":"hyperpolymath"}},{"html_url":"https://github.com/metadatastician/standards/pull/1619#pullrequestreview-5930381886","id":5930381886,"state":"COMMENTED","submitted_at":"2026-11-17T00:21:03Z","user":{"login":"hyperpolymath"}},{"html_url":"https://github.com/metadatastician/standards/pull/1619#pullrequestreview-5930382426","id":5930382426,"state":"COMMENTED","submitted_at":"2026-11-17T00:21:06Z","user":{"login":"hyperpolymath"}},{"html_url":"https://github.com/metadatastician/standards/pull/1619#pullrequestreview-5930383018","id":5930383018,"state":"COMMENTED","submitted_at":"2026-11-17T00:21:09Z","user":{"login":"hyperpolymath"}},{"html_url":"https://github.com/metadatastician/standards/pull/1619#pullrequestreview-5930383512","id":5930383512,"state":"COMMENTED","submitted_at":"2026-11-17T00:21:11Z","user":{"login":"hyperpolymath"}},{"html_url":"https://github.com/metadatastician/standards/pull/1619#pullrequestreview-5930383968","id":5930383968,"state":"COMMENTED","submitted_at":"2026-11-17T00:21:14Z","user":{"login":"hyperpolymath"}},{"html_url":"https://github.com/metadatastician/standards/pull/1619#pullrequestreview-5930384524","id":5930384524,"state":"COMMENTED","submitted_at":"2026-11-17T00:21:17Z","user":{"login":"hyperpolymath"}},{"html_url":"https://github.com/metadatastician/standards/pull/1619#pullrequestreview-5930384957","id":5930384957,"state":"COMMENTED","submitted_at":"2026-11-17T00:21:20Z","user":{"login":"hyperpolymath"}},{"html_url":"https://github.com/metadatastician/standards/pull/1619#pullrequestreview-5930451660","id":5930451660,"state":"COMMENTED","submitted_at":"2026-11-17T00:27:25Z","user":{"login":"coderabbitai[bot]"}},{"html_url":"https://github.com/metadatastician/standards/pull/1619#pullrequestreview-5930463800","id":5930463800,"state":"COMMENTED","submitted_at":"2026-11-17T00:28:28Z","user":{"login":"chatgpt-codex-connector[bot]"}},{"html_url":"https://github.com/metadatastician/standards/pull/1619#pullrequestreview-5930557198","id":5930557198,"state":"COMMENTED","submitted_at":"2026-11-17T00:37:22Z","user":{"login":"copilot-pull-request-reviewer[bot]"}},{"html_url":"https://github.com/metadatastician/standards/pull/1619#pullrequestreview-5930614082","id":5930614082,"state":"COMMENTED","submitted_at":"2026-11-17T00:43:06Z","user":{"login":"chatgpt-codex-connector[bot]"}},{"html_url":"https://github.com/metadatastician/standards/pull/1619#pullrequestreview-5930941038","id":5930941038,"state":"COMMENTED","submitted_at":"2026-11-17T01:14:52Z","user":{"login":"copilot-pull-request-reviewer[bot]"}},{"html_url":"https://github.com/metadatastician/standards/pull/1619#pullrequestreview-5930942195","id":5930942195,"state":"COMMENTED","submitted_at":"2026-11-17T01:14:58Z","user":{"login":"hyperpolymath"}},{"html_url":"https://github.com/metadatastician/standards/pull/1619#pullrequestreview-5930942800","id":5930942800,"state":"COMMENTED","submitted_at":"2026-11-17T01:15:00Z","user":{"login":"hyperpolymath"}},{"html_url":"https://github.com/metadatastician/standards/pull/1619#pullrequestreview-5930943149","id":5930943149,"state":"COMMENTED","submitted_at":"2026-11-17T01:15:02Z","user":{"login":"copilot-pull-request-reviewer[bot]"}},{"html_url":"https://github.com/metadatastician/standards/pull/1619#pullrequestreview-5930943357","id":5930943357,"state":"COMMENTED","submitted_at":"2026-11-17T01:15:03Z","user":{"login":"hyperpolymath"}},{"html_url":"https://github.com/metadatastician/standards/pull/1619#pullrequestreview-5930943849","id":5930943849,"state":"COMMENTED","submitted_at":"2026-11-17T01:15:06Z","user":{"login":"hyperpolymath"}},{"html_url":"https://github.com/metadatastician/standards/pull/1619#pullrequestreview-5930944305","id":5930944305,"state":"COMMENTED","submitted_at":"2026-11-17T01:15:08Z","user":{"login":"hyperpolymath"}},{"html_url":"https://github.com/metadatastician/standards/pull/1619#pullrequestreview-5931322746","id":5931322746,"state":"COMMENTED","submitted_at":"2026-11-17T01:49:14Z","user":{"login":"hyperpolymath"}},{"html_url":"https://github.com/metadatastician/standards/pull/1619#pullrequestreview-5931323464","id":5931323464,"state":"COMMENTED","submitted_at":"2026-11-17T01:49:18Z","user":{"login":"copilot-pull-request-reviewer[bot]"}},{"html_url":"https://github.com/metadatastician/standards/pull/1619#pullrequestreview-5931361624","id":5931361624,"state":"COMMENTED","submitted_at":"2026-11-17T01:52:52Z","user":{"login":"chatgpt-codex-connector[bot]"}},{"html_url":"https://github.com/metadatastician/standards/pull/1619#pullrequestreview-5931380037","id":5931380037,"state":"COMMENTED","submitted_at":"2026-11-17T01:54:39Z","user":{"login":"coderabbitai[bot]"}},{"html_url":"https://github.com/metadatastician/standards/pull/1619#pullrequestreview-5931863159","id":5931863159,"state":"COMMENTED","submitted_at":"2026-11-17T02:41:32Z","user":{"login":"hyperpolymath"}},{"html_url":"https://github.com/metadatastician/standards/pull/1619#pullrequestreview-5931863678","id":5931863678,"state":"COMMENTED","submitted_at":"2026-11-17T02:41:34Z","user":{"login":"hyperpolymath"}},{"html_url":"https://github.com/metadatastician/standards/pull/1619#pullrequestreview-5931863841","id":5931863841,"state":"COMMENTED","submitted_at":"2026-11-17T02:41:35Z","user":{"login":"copilot-pull-request-reviewer[bot]"}},{"html_url":"https://github.com/metadatastician/standards/pull/1619#pullrequestreview-5931864053","id":5931864053,"state":"COMMENTED","submitted_at":"2026-11-17T02:41:37Z","user":{"login":"hyperpolymath"}},{"html_url":"https://github.com/metadatastician/standards/pull/1619#pullrequestreview-5931864618","id":5931864618,"state":"COMMENTED","submitted_at":"2026-11-17T02:41:39Z","user":{"login":"hyperpolymath"}},{"html_url":"https://github.com/metadatastician/standards/pull/1619#pullrequestreview-5931884159","id":5931884159,"state":"COMMENTED","submitted_at":"2026-11-17T02:43:17Z","user":{"login":"coderabbitai[bot]"}}],"rules":[{"parameters":null,"type":"deletion"},{"parameters":null,"type":"non_fast_forward"},{"parameters":null,"type":"required_linear_history"},{"parameters":{"secret_types":["provider_patterns","generic_patterns","custom_patterns"]},"type":"require_secret_scanning_alert_resolution"},{"parameters":null,"type":"repository_delete"},{"parameters":null,"type":"repository_transfer"},{"parameters":{"internal":true,"private":true,"public":false},"type":"repository_visibility"},{"parameters":null,"type":"required_signatures"},{"parameters":{"allowed_merge_methods":["squash","rebase"],"dismiss_stale_reviews_on_push":true,"require_code_owner_review":true,"require_extra_approval_for_unattributed_changes":true,"require_last_push_approval":false,"required_approving_review_count":0,"required_review_thread_resolution":true,"required_reviewers":[]},"type":"pull_request"},{"parameters":{"review_draft_pull_requests":true,"review_on_push":true},"type":"copilot_code_review"}],"status":{"statuses":[]}} diff --git a/docs/REPORT-BACK.adoc b/docs/REPORT-BACK.adoc index c476d21a..2bdc379a 100644 --- a/docs/REPORT-BACK.adoc +++ b/docs/REPORT-BACK.adoc @@ -161,10 +161,26 @@ that emits a path-less finding; rhodibot and seambot already comply. that is wanted is the enrolment manifest's call. | finishingbot -| `finishing-bot --path --format json audit` +| `finishing-bot --path --format json audit [--pr N --pr-repo o/r --exclude-run-id ID]` | Eight analyzers (license, placeholders, claims, release, SCM files, testing, tooling, v1 readiness) flattened to one list. Exits 1 when findings block a release; that is still a run. + When the driver is given `--pr`/`--pr-repo` (the reusable passes the caller's + pull request), `audit` also reads whether that pull request is ready to + review and merge, as one more analyzer, `pr_readiness`: PRR-001 unresolved + review conversations (count, a link to each), PRR-002 a reviewer whose latest + review requests changes, PRR-003 behind base, PRR-004 merge conflict, + PRR-005 checks failing, PRR-006 checks pending (the evaluating run's own + checks excluded), PRR-007 a required status context (rulesets and classic + protection) that no check run or commit status on the head provides, PRR-008 + draft. Severity follows the base branch's rules (unresolved conversations + and behind-base are `error` only where the rules require resolution or an + up-to-date head). These findings carry no path by design: they are about the + change as a whole. The one-line verdict (`ready`, `not ready` with reasons, + or `readiness unknown` naming what could not be read; draft and auto-merge) + is the envelope `reason`. Advisory: it never changes the exit status. Review + threads are read through GraphQL `reviewThreads { isResolved }`; the token is + `FLEET_PR_TOKEN`, which the driver hands to finishing-bot alone. | glambot | `glambot --path --format json audit` diff --git a/scripts/fleet-report-back.sh b/scripts/fleet-report-back.sh index 6c14f81d..f0089b4b 100755 --- a/scripts/fleet-report-back.sh +++ b/scripts/fleet-report-back.sh @@ -47,7 +47,7 @@ # Usage: # fleet-report-back.sh --repo DIR --out DIR [--enrolment FILE] [--bin-dir DIR] # [--member NAME]... [--fleet-ref SHA] [--summary FILE] -# [--timeout SECONDS] +# [--timeout SECONDS] [--pr NUMBER --pr-repo OWNER/NAME] # fleet-report-back.sh --plan [--enrolment FILE] [--member NAME]... # # --repo the checkout to report on (its root; paths are made relative) @@ -60,7 +60,12 @@ # checkout's HEAD, else "unknown" # --summary append a Markdown table of the members and their status # --timeout seconds allowed per adapter (default 300) -# --plan print "membercrate-dirbinary" for every member +# --pr, --pr-repo the pull request whose head DIR is: finishingbot then also +# reports whether it is ready to review and merge (advisory). +# The token is read from FLEET_PR_TOKEN, which the driver +# removes from its own environment at once and hands to +# finishing-bot alone (as GH_TOKEN), never to another adapter +# --plan print "membercrate-dirbinary" for every member # that would run, so a workflow can build only those crates # # Exit 0 whenever envelopes were written (whatever they say); 2 on usage @@ -201,7 +206,12 @@ default_title_of() { # ── argument parsing ───────────────────────────────────────────────────────── repo="" out="" enrol="__default__" bindir="" fleet_ref="" summary="" plan=false -timeout_s=300 +timeout_s=300 pr_number="" pr_repo="" +# The pull-request token is for finishing-bot alone: take it out of the +# environment before anything else runs, so no other adapter (some execute the +# scanned repository's code) can inherit it. +pr_token="${FLEET_PR_TOKEN:-}" +unset FLEET_PR_TOKEN members=() while [ $# -gt 0 ]; do case "$1" in @@ -213,6 +223,8 @@ while [ $# -gt 0 ]; do --fleet-ref) fleet_ref="$2"; shift 2 ;; --summary) summary="$2"; shift 2 ;; --timeout) timeout_s="$2"; shift 2 ;; + --pr) pr_number="$2"; shift 2 ;; + --pr-repo) pr_repo="$2"; shift 2 ;; --plan) plan=true; shift ;; -h|--help) usage ;; *) echo "unknown option: $1" >&2; usage ;; @@ -231,6 +243,12 @@ command -v jq >/dev/null 2>&1 || { echo "jq is required" >&2; exit 2; } # GNU timeout reads 0 as "no limit", which would let one hung adapter spend the # whole job; the limit must be a positive integer. [[ "$timeout_s" =~ ^[1-9][0-9]*$ ]] || { echo "--timeout must be a positive integer (0 would disable the limit)" >&2; exit 2; } +# --pr and --pr-repo come from the calling workflow's event: both or neither, +# and each in its one valid form. +if [ -n "$pr_number$pr_repo" ]; then + [[ "$pr_number" =~ ^[1-9][0-9]{0,9}$ ]] || { echo "--pr must be a pull request number (with --pr-repo)" >&2; exit 2; } + [[ "$pr_repo" =~ ^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$ ]] || { echo "--pr-repo must be owner/name (with --pr)" >&2; exit 2; } +fi # ── enrolment ──────────────────────────────────────────────────────────────── # Which members run. An explicit --member list wins; otherwise every reporter @@ -517,11 +535,18 @@ translate_panicbot() { # member # to temporary capture files and ADAPTER_RC to the exit status (124 on timeout) # without propagating it. The caller must remove the files; creation failures # are not caught. +# ADAPTER_ENV (NAME=value words) is added to this one adapter's environment and +# reset afterwards, so a value meant for one adapter never reaches the next. +ADAPTER_ENV=() run_adapter() { # binary args... ; sets ADAPTER_OUT, ADAPTER_ERR, ADAPTER_RC local bin="$1"; shift ADAPTER_OUT=$(mktemp); ADAPTER_ERR=$(mktemp); ADAPTER_RC=0 # --bin-dir is also prepended to PATH: panicbot finds panic-attack with `which`. - ( cd "$repo" && PATH="${bindir:+$bindir:}$PATH" RUST_LOG=off timeout "$timeout_s" "$bin" "$@" ) > "$ADAPTER_OUT" 2> "$ADAPTER_ERR" || ADAPTER_RC=$? + # Exported inside the subshell, never passed as arguments: a token on a + # command line is visible to every process on the runner. + ( cd "$repo" && for kv in ${ADAPTER_ENV[@]+"${ADAPTER_ENV[@]}"}; do export "${kv?}"; done \ + && PATH="${bindir:+$bindir:}$PATH" RUST_LOG=off timeout "$timeout_s" "$bin" "$@" ) > "$ADAPTER_OUT" 2> "$ADAPTER_ERR" || ADAPTER_RC=$? + ADAPTER_ENV=() } # Print up to 240 characters of the first nonblank ADAPTER_ERR line excluding # Stack backtrace headers, or an ADAPTER_RC diagnostic if no line is selected. @@ -683,8 +708,22 @@ run_member() { | { rule_id: ("SEAM-" + (.check // "?" | tostring)), severity: (.severity // "unknown" | tostring), file: ((.location // "") | rel), line: 0, message: (.message // "" | tostring) } ]' ;; finishingbot|finishbot|finishing-bot) - run_adapter "$bin" --path "$repo" --format json audit - translate_or_error "$m" "$SHAPE_ANALYZERS [ .[] | .findings[] | $FINDING ]" ;; + # With --pr, `audit` also reads the pull request's readiness from GitHub + # (review conversations, change requests, behind/conflict, checks, and + # required contexts nothing on the head provides) and prints it as one + # more analyzer, `pr_readiness`, whose PRR-* findings flatten like the + # rest. It is advisory: it never changes the adapter's exit status. Its + # one-line verdict becomes the envelope reason, so the grid shows it. + local fargs=(--path "$repo" --format json audit) + if [ -n "$pr_number" ]; then + fargs+=(--pr "$pr_number" --pr-repo "$pr_repo") + # The evaluating Actions run's own checks are in progress by definition. + [[ "${GITHUB_RUN_ID:-}" =~ ^[0-9]+$ ]] && fargs+=(--exclude-run-id "$GITHUB_RUN_ID") + [ -z "$pr_token" ] || ADAPTER_ENV=("GH_TOKEN=$pr_token") + fi + run_adapter "$bin" "${fargs[@]}" + translate_or_error "$m" "$SHAPE_ANALYZERS [ .[] | .findings[] | $FINDING ]" \ + 'if type == "object" and (.pr_readiness | type) == "object" then (.pr_readiness.summary // "" | tostring | .[0:400]) else "" end' ;; glambot) run_adapter "$bin" --path "$repo" --format json audit # An analyzer that could not run (git-seo missing) reports `skipped`; say so @@ -711,7 +750,10 @@ for m in "${members[@]+"${members[@]}"}"; do # fork-governance SPEC section 3.0: absence of a location is not evidence of # absence of a defect), so a repository-level rule that omits its path makes # the row identical on every pull request. Say so, loudly, at the source. - unpathed=$(jq -r '[.findings[] | select((.file // "") == "")] | length' "$out/$m.json") + # finishingbot's PRR-* pull-request readiness findings are the exception by + # design: they are facts about the change as a whole, which is exactly the + # scope a path-less finding is graded at. + unpathed=$(jq -r '[.findings[] | select((.file // "") == "" and ((.rule_id // "") | startswith("PRR-") | not))] | length' "$out/$m.json") if [ "$unpathed" -gt 0 ]; then echo "fleet-report-back: WARNING: $m reported $unpathed finding(s) with no path; the grid grades those as part of every change. The adapter must name the file each rule is about (the expected path, for a missing-file rule)." >&2 fi diff --git a/tests/fleet-report-back-test.sh b/tests/fleet-report-back-test.sh index 7aa91e2e..c5a8426d 100755 --- a/tests/fleet-report-back-test.sh +++ b/tests/fleet-report-back-test.sh @@ -32,6 +32,9 @@ # 10. the build-helper unit suite (stubbed Cargo, no Rust builds or network). # 11. ponsbot: translation, status mapping (never a pass), SPECULATIVE carried at # info, gating read from the enrolment; panicbot envelope-parity failure modes. +# 12. finishingbot pull-request readiness: --pr/--pr-repo reach finishing-bot with +# the evaluating run id, the token reaches finishing-bot alone, the verdict +# is the envelope reason, PRR findings need no path, bad --pr is refused. # # Run: bash tests/fleet-report-back-test.sh @@ -670,6 +673,50 @@ else fi check "ponsbot and panicbot runs never change the scanned tree" "$repo_before" "$(repo_state)" +# 12. finishingbot pull-request readiness ───────────────────────────────────── +# The stub asserts the --pr invocation, records the token it was handed, and +# prints the pr_readiness analyzer the way finishing-bot does (one PRR-007 with +# no path, and the one-line summary). A second stub records what token an +# adapter that must NOT receive it sees. +stub finishing-bot '[ "$1 $3 $4 $5" = "--path --format json audit" ] || { echo "bad args: $*" >&2; exit 9; } +printf "%s|%s\n" "${GH_TOKEN:-none}" "${FLEET_PR_TOKEN:-none}" > "$PRT_DIR/finishing.token" +printf "%s\n" "${*:6}" > "$PRT_DIR/finishing.args" +if [ "${6:-}" = "--pr" ]; then +cat < "$PRT_DIR/cipher.token"; echo "[]"' +# Start from no ambient token (a developer shell may carry one), so the checks +# below see only what the driver hands out. +unset GH_TOKEN GITHUB_TOKEN +export PRT_DIR="$TMP/prt"; mkdir -p "$PRT_DIR" +FLEET_PR_TOKEN=sekrit GITHUB_RUN_ID=4242 run "$TMP/prr" --enrolment "" --member finishingbot --member cipherbot --pr 435 --pr-repo hyperpolymath/rsr-template-repo +check "readiness: finishing-bot gets --pr, --pr-repo and the evaluating run" "--pr 435 --pr-repo hyperpolymath/rsr-template-repo --exclude-run-id 4242" "$(cat "$PRT_DIR/finishing.args")" +check "readiness: finishing-bot alone receives the token, as GH_TOKEN" "sekrit|none" "$(cat "$PRT_DIR/finishing.token")" +check "readiness: no other adapter sees the token" "none|none" "$(cat "$PRT_DIR/cipher.token")" +check "readiness: the token never reaches the log" 0 "$(grep -c sekrit "$TMP/prr.log" || true)" +check "readiness: PRR findings are carried in the envelope" "PRR-007|error|" \ + "$(field "$TMP/prr/finishingbot.json" '.findings[] | "\(.rule_id)|\(.severity)|\(.file)"')" +check "readiness: the verdict line is the envelope reason, status ran" \ + "ran|PR #435 not ready: required context(s) not provided: CI/gate; draft: no; auto-merge: on (squash)" \ + "$(field "$TMP/prr/finishingbot.json" '"\(.status)|\(.reason)"')" +check "readiness: a path-less PRR finding is not warned about (it is change-scoped by design)" 0 \ + "$(grep -c 'WARNING: finishingbot' "$TMP/prr.log" || true)" + +run "$TMP/prr-none" --enrolment "" --member finishingbot +check "readiness: without --pr finishing-bot gets no --pr and no token" "|none|none" \ + "$(cat "$PRT_DIR/finishing.args")|$(cat "$PRT_DIR/finishing.token")" +check "readiness: without --pr the reason stays empty" "ran|null" "$(field "$TMP/prr-none/finishingbot.json" '"\(.status)|\(.reason)"')" + +for bad in "--pr 0 --pr-repo o/r" "--pr 12 --pr-repo o/r/x" "--pr 12" "--pr-repo o/r" "--pr 1;id --pr-repo o/r"; do + rc=0; read -r -a badargs <<< "$bad" + bash "$DRIVER" --repo "$REPO" --out "$TMP/prr-bad" --bin-dir "$BIN" --enrolment "" --member finishingbot "${badargs[@]}" > /dev/null 2>&1 || rc=$? + check "readiness: refuses '$bad' as a usage error" 2 "$rc" +done + # 8. the real renderer ───────────────────────────────────────────────────────── GRID="${STANDARDS_DIR:-}/scripts/verdict-grid.sh" if [ -n "${STANDARDS_DIR:-}" ] && [ -f "$GRID" ]; then From aa428ce7da4e4eaa28d36d7cc20baa25b0b649ac Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 17 Nov 2026 17:10:32 +0000 Subject: [PATCH 2/2] fix(finishingbot): a missing required context is "not yet" while checks run Dogfooding on this PR (gitbot-fleet#693) showed PRR-007 naming `CI/gate`, `scan / rust-secrets` and `scan / shell-secrets` as missing while 47 checks were still queued: a job waiting on `needs:`, or a called workflow's job, has no check run until it starts. Claiming the absence as settled then would be an overclaim. PRR-007 is now a warning ("not provided yet", checks still running) while any check run or status on the head is unfinished, and the error ("every check has finished, so nothing on the pull request produces them") only once all have. rsr-template-repo#435 (all 54 checks finished, no `CI/gate`) still yields the error. New unit test covers both states. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01J4QvDj7XpKyxE4WbsgTsTh --- bots/finishingbot/src/pr_readiness/mod.rs | 56 ++++++++++++++++++++--- docs/REPORT-BACK.adoc | 4 +- 2 files changed, 52 insertions(+), 8 deletions(-) diff --git a/bots/finishingbot/src/pr_readiness/mod.rs b/bots/finishingbot/src/pr_readiness/mod.rs index 2bfe768a..b187c00d 100644 --- a/bots/finishingbot/src/pr_readiness/mod.rs +++ b/bots/finishingbot/src/pr_readiness/mod.rs @@ -729,14 +729,35 @@ pub fn evaluate(s: &Snapshot, opts: &EvalOptions) -> PrReadiness { }) .map(|(ctx, _)| format!("`{ctx}`")) .collect(); - if !missing.is_empty() { + // A job waiting on `needs:` (or a called workflow's jobs) has no check + // run until it starts, so while anything on the head is unfinished a + // missing context may still appear: say "not yet", at warning. Only + // once every check has finished is the absence a settled fact. + let unfinished = runs.iter().any(|cr| cr.status != "completed") + || statuses.iter().any(|cs| cs.state == "pending"); + if !missing.is_empty() && unfinished { + findings.push(finding( + "PRR-007", + "Required status context not provided yet", + Severity::Warning, + format!( + "{} required status context(s) on {} have no check run or commit status on head {} yet: {}. \ + Checks were still running, so a job that has not started can still produce them", + missing.len(), + pr.base.ref_name, + short(&pr.head.sha), + list(&missing) + ), + "Re-read once the checks finish; if a context is still missing then, nothing on this pull request produces it.", + )); + } else if !missing.is_empty() { findings.push(finding( "PRR-007", "Required status context not provided", Severity::Error, format!( "{} required status context(s) on {} have no check run or commit status on head {}: {}. \ - Until something on the pull request produces each one, it cannot merge whatever reviewers approve", + Every check has finished, so nothing on the pull request produces them, and it cannot merge whatever reviewers approve", missing.len(), pr.base.ref_name, short(&pr.head.sha), @@ -761,11 +782,7 @@ pub fn evaluate(s: &Snapshot, opts: &EvalOptions) -> PrReadiness { let reasons: Vec = findings .iter() .map(|f| match f.id.as_str() { - "PRR-007" => format!( - "{}: {}", - f.name, - f.message.split(". Until").next().unwrap_or("") - ), + "PRR-007" => format!("{}: {}", f.name, f.message.split(". ").next().unwrap_or("")), _ => f.name.to_lowercase(), }) .collect(); @@ -903,6 +920,31 @@ mod tests { assert!(r.reasons.is_empty()); } + #[test] + fn a_missing_context_while_checks_run_is_not_yet_settled() { + // gitbot-fleet#693 on 2026-11-17: `CI/gate` (a `needs:` job) had no + // check run while 47 checks were still queued. That is "not yet", + // a warning, not the settled error #435 gets once all checks finished. + let mut s = load("rsr-template-repo-435.json"); + s.check_runs.as_mut().unwrap().push(CheckRun { + id: 3, + name: "lint".into(), + status: "queued".into(), + ..CheckRun::default() + }); + let r = evaluate(&s, &EvalOptions::default()); + let f = r.findings.iter().find(|f| f.id == "PRR-007").unwrap(); + assert_eq!(f.severity, Severity::Warning); + assert!(f.message.contains("yet: `CI/gate`"), "{}", f.message); + assert_eq!(r.verdict, Verdict::NotReady); + // Settled case for contrast: every check finished. + let settled = evaluate(&load("rsr-template-repo-435.json"), &EvalOptions::default()); + assert_eq!(settled.findings[0].severity, Severity::Error); + assert!(settled.findings[0] + .message + .contains("Every check has finished")); + } + #[test] fn a_commit_status_also_provides_a_required_context() { let mut s = load("rsr-template-repo-435.json"); diff --git a/docs/REPORT-BACK.adoc b/docs/REPORT-BACK.adoc index 2bdc379a..8141811a 100644 --- a/docs/REPORT-BACK.adoc +++ b/docs/REPORT-BACK.adoc @@ -172,7 +172,9 @@ that emits a path-less finding; rhodibot and seambot already comply. review requests changes, PRR-003 behind base, PRR-004 merge conflict, PRR-005 checks failing, PRR-006 checks pending (the evaluating run's own checks excluded), PRR-007 a required status context (rulesets and classic - protection) that no check run or commit status on the head provides, PRR-008 + protection) that no check run or commit status on the head provides (a + `warning` "not yet" while checks are unfinished, since a `needs:` job has no + check run until it starts; an `error` once every check has finished), PRR-008 draft. Severity follows the base branch's rules (unresolved conversations and behind-base are `error` only where the rules require resolution or an up-to-date head). These findings carry no path by design: they are about the