Repository navigation
Conversation
…t-in digest and nudges The overview no longer says "not recorded yet". Each signal is recorded where it happens, for every pull request and repository: - default-branch check runs, statuses and job waits from the webhook, into one record per repository with red episodes and runner waits (common::pr_ci); pull requests blocked by a red main - CoderHelm's findings, each time the reviewer stores a review, from raised to verified fixed at a later head (common::pr_findings) - every run's end state, stop reason and cost on the pull request's history, at close and nightly (common::pr_runs), with a test that every ending maps to exactly one of six states - closed pull requests' files, for single-reviewer paths and sensitive-path merges against each repository's list, defaulting to auth, payments, secrets, infra and migrations (common::pr_settings, GET/PUT /api/prs/settings) - open Dependabot alerts with no pull request; code scanning says it needs the security events permission The overview read moves into common::pr_overview_read so the page and the weekly digest share it. The digest (Monday, to the team's channels or its members by email) and private nudges (at the stage's p85, then two and four working days later, then never) are both off until a team turns them on. Incident case ya_overview_signals_recorded pins it. Merges origin/main.
* Retry a refused merge and ask a person only the contested hunk A conflict round whose merge was refused no longer asks a person to resolve the conflict. It runs again in a fresh step against the base's newest head while the base moves between tries and under the round's step ceiling. Out of tries, a person is asked only when both sides changed the same lines with incompatible intent and the model's merge was refused on both tries: a typed product decision showing the two versions (keep A, keep B, or combine). Anything else stops as CoderHelm's own problem. * Keep hand-off text out of the conflict round tests and Debug The tests asserted on the typed question and the PR comment with the values in their failure messages, and AfterRefused derived Debug over a PersonOnly. The messages no longer carry those values, and AfterRefused prints only its variant and the reason code.
…check lives in the shared reader Blocked by main is unknown, not 0, until a default-branch check reports; the findings funnel and cost per merged pull request are named in missing while nothing is recorded in the window. xw checks the team filter where the run join now lives.
| if started > 0 && created > 0 && payload["action"] == "created" { | ||
| changed |= self.note_queue(QueueSample { | ||
| at: started, | ||
| secs: started - created, | ||
| label: String::new(), | ||
| }); | ||
| } |
There was a problem hiding this comment.
🔴 Blocking (critical path, no proof): Runner queue p95 mixes two sources that count the same job and measure different things (correctness, not verified)
A check_run created event records a sample of started_at - check_suite.created_at with an empty label. A workflow_job in_progress event records started_at - job.created_at with the runner label (around line 330). The dedupe in note_queue compares the whole sample (at, secs, label), so one Actions job produces two samples with different keys, and every job is counted twice. The check_run figure is also not a runner wait. It runs from the suite's creation to the check run's own started_at. For a job that needs another, the check run is created only after the earlier job finishes, so the sample includes the earlier job's whole run time. That inflates the p95 the overview shows as 'runner queue'. Take queue samples from workflow_job only, since it has a real queued-to-started pair and the label. Keep the check_run path only for checks that have no workflow_job.
| "green" => { | ||
| if let Some(open) = self.episodes.last_mut().filter(|e| e.to == 0) { | ||
| open.to = at.max(open.from); | ||
| open.fixed_sha = self.sha.clone(); | ||
| } | ||
| } |
There was a problem hiding this comment.
🔴 Blocking (critical path, no proof): An episode can close as soon as the first check on a new head completes green (correctness, not verified)
When a new head arrives, note_check clears checks and tracks only what has been reported since. rollup returns green once every known check is completed without failure. If the first completed check on a new head is a success and the head's other checks haven't reported yet, the episode closes immediately. Examples are a downstream job with needs, or a workflow whose check run is created later. fixed_sha and to then point at that head. When a later check fails, a second episode opens, so red time is understated and the fix is attributed to a head that didn't fix it. This relies on GitHub creating dependent jobs' check runs only when their predecessors finish. I haven't confirmed that against a real payload. A safer close rule would be to require a settling period with no new check on the head, or to require a minimum set of checks, such as the names that were failing in the open episode, to be present and green.
| //! `workflow_job` events GitHub already sends for every repository the | ||
| //! app is installed on. No GitHub read is spent. | ||
| //! - An episode starts when the default branch's newest head has a failing | ||
| //! check and ends when a later head has its checks green again |
There was a problem hiding this comment.
💬 Nit: Module doc lists check_suite events but apply_event doesn't handle them (convention)
The header says the record is written from check_run, check_suite, status and workflow_job events. The match event_type in apply_event handles only check_run, status and workflow_job, and check_suite falls to _ => false. Either handle it or correct the doc.
| self.findings | ||
| .values_mut() | ||
| .filter(|f| f.path == p.path.trim()) | ||
| .find(|f| !f.title.is_empty() && body.contains(&f.title)) |
There was a problem hiding this comment.
💬 Suggestion: Thread-to-finding match is a substring test on the first line (hardening)
.find(|f| !f.title.is_empty() && body.contains(&f.title)) matches a finding when its title words appear anywhere in the thread's first line. A short title such as "bug" would match unrelated threads on the same path. Two titles where one contains the other ("missing index" and "missing index on orders") could attach a verdict to the wrong finding. values_mut() returns the first by key order. The funnel's "verified" and "dismissed" counts depend on this match. Matching on word boundaries, or preferring the longest matching title, would avoid it. The reviewer's comment format could carry a stable id instead, if it has one.
This blocks: Substring title match can attach verdicts to the wrong finding, corrupting the verified/dismissed funnel counts on the change's main path
| f.verified_at = at; | ||
| changed = true; | ||
| } | ||
| if status == "answered" && f.verified_at == 0 && f.dismissed_at == 0 { |
There was a problem hiding this comment.
💬 Suggestion: A finding can end up both dismissed and verified (hardening)
The answered branch sets dismissed_at only when verified_at == 0 && dismissed_at == 0. A later fixed verdict sets verified_at without clearing dismissed_at. funnel then counts the same finding as both verified and dismissed, although the description says findings end verified "or else dismissed". Clearing dismissed_at and dismissed_why when a finding is verified keeps the two counts disjoint.
This blocks: A finding counted as both verified and dismissed contradicts the stated goal and double-counts in the funnel, a shown correctness defect
| }; | ||
| let settings = crate::pr_settings::load(t.dynamo, t.settings, team_id) | ||
| .await | ||
| .unwrap_or_default(); |
There was a problem hiding this comment.
💬 Nit: Settings read failure silently falls back to defaults (convention, not verified)
crate::pr_settings::load(...).await.unwrap_or_default() logs nothing and adds no entry to sources. If the read fails, the overview is computed with the default sensitive paths and SLA days. The page then shows a team's customised numbers as though they were the defaults. The other reads in this function log a warning and some also add a failed entry to sources. Doing the same here would make the fallback visible.
This blocks: Settings read failure falls back to defaults, showing customised numbers as defaults—stale/wrong data on the overview, contradicting the goal
| let claim = format!( | ||
| "PRNUDGE_SENT#{}#{}#{stage}#{since}#{n}", | ||
| row.repo, row.number | ||
| ); | ||
| if !super::review_pr::claim_once_ttl(state, team, &claim, pr_notify::NUDGE_KEEP_SECS as u64) | ||
| .await | ||
| { | ||
| continue; | ||
| } |
There was a problem hiding this comment.
💬 Suggestion: Once-only claim is taken before the send, so a failed send is never retried (hardening)
The nudge takes PRNUDGE_SENT#repo#number#stage#since#n with claim_once_ttl and then calls send_email. When the email fails, the code does continue, the NudgeState is not advanced, and the claim stays for NUDGE_KEEP_SECS. Each later tick finds nudge_due still returns n, loses the claim, and skips, so that step's nudge is silently dropped. The digest does the same at lines 140-143: it claims PRDIGEST#<week> with a 14-day TTL before reading the overview or sending. A failed overview read (continue after the warn) or a failed channel or email send means no digest that week, with no retry. A transient SES or Slack failure is enough to lose a notification. Releasing the claim on failure would fix both, for example with a common::claim release helper if one exists. Alternatively, claim only after a successful send and rely on the state write for dedup. A shorter TTL on the claim until the send succeeds would also work.
This blocks: Claim taken before send means a transient failure permanently drops the digest/nudge, a data-loss defect shown on the notification path
| /// The conflict round: the base branch merged into the pull request's | ||
| /// branch, the conflicting files resolved, one commit. A conflict that | ||
| /// can't be resolved that way is handed to a person with one comment. | ||
| /// branch, the conflicting files resolved, one commit. A merge that fails |
There was a problem hiding this comment.
💬 FYI: Conflict-round retry and ask rework is unrelated to the overview signals (scope, not verified)
The diff rewrites run_conflict_round in resume.rs, adding after_refused, contested_question and CONFLICT_RETRY_SECS. The commit list also carries Retry a refused merge and ask a person only the contested hunk (#989). The PR title and description cover overview records, the digest and nudges, and nothing about how merge conflicts are handled. The same change reaches services/worker/src/passes/merge3.rs, pr.rs and the xy incident case. It changes when a person is asked about a conflict and how the round parks and resumes, which a reviewer of the overview work would not expect to find. It looks like #989 came in through the merge of the base branch, or #989 is not in the base this PR targets. Keep these changes out of this PR: retarget it onto a base that already has #989, or drop the commit from this PR and land it separately.
FYI, not a block: on the whole picture this is not a named correctness, security or data-loss problem to hold the merge on.
| /// branch, the conflicting files resolved, one commit. A merge that fails |
| /// Nudges per stage: at p85, two working days later, four working days later. | ||
| pub const NUDGES_PER_STAGE: u8 = 3; | ||
|
|
||
| pub fn nudge_sk(repo: &str, number: u64) -> String { |
There was a problem hiding this comment.
💬 FYI: Near-identical helpers added together (scope, not verified)
services/common/src/pr_notify.rs adds nudge_sk next to findings_sk (in services/common/src/pr_findings.rs), added in the same change. Keep one helper with the shared logic (a parameter for what differs) and call it from both places. If the ticket truly needs it, say why on a line Wider than the ticket: services/common/src/pr_notify.rs: <why>.
FYI, not a block: on the whole picture this is not a named correctness, security or data-loss problem to hold the merge on.
| } | ||
|
|
||
| #[test] | ||
| fn a_signal_without_its_permission_says_which() { |
There was a problem hiding this comment.
💬 FYI: Near-identical helpers added together (scope, not verified)
services/worker/src/passes/incidents/ya_overview_signals_recorded.rs adds a_signal_without_its_permission_says_which next to every_review_records_its_findings_and_moves_the_earlier_ones_on, added in the same change. Keep one helper with the shared logic (a parameter for what differs) and call it from both places. If the ticket truly needs it, say why on a line Wider than the ticket: services/worker/src/passes/incidents/ya_overview_signals_recorded.rs: <why>.
FYI, not a block: on the whole picture this is not a named correctness, security or data-loss problem to hold the merge on.
Summary
Follow-up to #988, based on
pull-requests-view(#985 is still open). The org overview no longer says "not recorded yet". Each signal is now recorded where it happens, for every pull request and repository, whoever wrote it. The weekly digest and per-pull-request nudges exist too, and both are off until a team turns them on.Changes
common::pr_ci): everycheck_run,statusandworkflow_jobwebhook on the default branch updates one record per repository. The record holds the head's checks and the red episodes, each with its start, its end and the commit that fixed it. A pull request is blocked by main when a check failing on it is failing on main now.started_atminuscreated_at, fromworkflow_job(newly routed to the overview) and from check runs.common::pr_findings): the reviewer writes it each time it stores a review. Findings go raised, then acknowledged, then changed, then verified, or else dismissed. A finding counts as verified only when the reviewer finds it gone at a later head; resolving the thread isn't enough.common::pr_runs): each run maps to one offirst_try,after_fixes,rerun_only,gave_up,blockedorstopped, using the ending the run's end gate recorded. The state goes on History asrun_outcome, withstop_reason, when the pull request closes. A nightly reconcile covers runs that end after the pull request closed. A test walks every run status and every ending kind and reason, and checks each maps to exactly one state.cost_usd, summed onto History ascost_micro_usd.common::pr_settings,GET/PUT /api/prs/settings; changing them needs agent settings): the defaults are**/auth/**,**/payments/**,**/secrets/**,**/infra/**and**/migrations/**. For example,acme/checkoutcan listcart/rounding/**and*.peminstead. The SLA days are saved here as well.common::pr_overview_read, so the page and the digest read it the same way.worker::passes::pr_notify, run on the 20-minute tick):ya_overview_signals_recorded: pins the recording points, the six end states, the permission wording and the opt-in defaults.xzfollows the reader to common.docs/pull-requests/api_contract.mdcovers the new records.Verification
cargo fmt --all --check,rustfmt --checkon the incidents, andcargo clippy -p common -p worker -p gateway --all-targets -D warningsare clean.cargo test -p common -p worker -p gatewaypasses.text_guard.py,domain_examples.pyandbrand_spelling.pypass.The dashboard side is the linked dashboard PR.