Repository navigation
Conversation
… gates and the new pull requests view A durable record per open pull request in the team's connected repositories, written from the webhooks already received for every author and kept honest by a bounded GraphQL sync under the shared GitHub budget (sweep:dashboard_prs). One function (pr_needs::decide) decides each pull request's state, its turn and what it needs next from whom; the run's watch stores its standing and the reviewer's auto-merge gate merges only what it calls ready. GET /api/prs and GET /api/prs/detail serve the dashboard's pull requests page under the "view" capability. Incident case xw holds it.
…for the org overview Every duration starts at ready for review, and human review leaves out the author and every bot. Records keep their state and turn change log, people's reviews and review requests, and check transitions. A merged or closed pull request leaves a history row kept 400 days with its run and session links and revert and follow-up links. A nightly job writes each org's and repository's snapshot and percentiles, team-scoped and bounded.
…nals A resumable 14-month backfill reads each organization's closed and merged pull requests into history under the shared budget, pausing on a held budget or rate limit and showing its progress per repository. Records keep separate author, reviewer and bot clocks, drift against the base, every check attempt (flaky reads as flaky), category and severity; history adds review coverage, bypass merges, suspect follow-ups with their reason, and CoderHelm's last run outcome and stop reason.
* The org's pull requests in one answer: GET /api/prs/overview Every pull request in the team's repositories counts, people's, CoderHelm's and other bots'; CoderHelm's are one slice. Computed facts only, with thresholds from the scope's own percentiles, no rate on fewer than 10 events, and what isn't stored yet named in `missing`. No per-person ranking, count or duration; a login appears only as one item's owner. The summary's numbers are all facts. GET /api/prs takes the overview's drill-down (stage, past p85/p95). Incident case xz pins it. * Overview: clippy's shapes, and words without hand-off phrases or loose numbers The stability line says "over the last month" so every number in the summary is a fact; the incident case reads the route's source without whitespace, so formatting can't hide a read. * A reopened change and a later alert recovery reach their waiting runs at once (#986) A run stopped because the change it built on closed now goes back to waiting as soon as GitHub reports the change reopened, not at the 15-minute sweep. The pull request handler sends the team's change check for a close or a reopen before any return a reopen reaches, naming the change, and the worker reads the runs that change's close stopped (the sweep stays the backstop for every team). A recovery posted after an alert route's quiet window now closes the run waiting on a person for that alert, through the same path a recovery posted at once uses (common::run_wake::alert_cleared, which the gateway's alert_delivery now calls too). Incident case xx_waits_never_outlive_their_event.
…re, the sync never undoes events, history is never thinned The repository's approval rule is GitHub's own review decision and the team's rule is a person's approval; a review no rule requires is named, never a hold. The sync never reopens a closed record, yields to events newer than its read, replaces the reviews and requests it lists, and marks lists cut by their page size. History rows merge by source, so the backfill never thins a row written from events. The review decision is worked out at review events and used for bypass only when fresh. Stacks join within one repository, and the detail decides with the list's own linked records.
GET /api/foryou joins the pull request records, chat_work_needs::gather and the person's open sprint from the Jira app for the session's user only: needs you now grouped by whose turn it is, the sprint with a fit band per ticket, CoderHelm's work for them, their pull requests waiting on others, Later, three private numbers and suggestions with their lifecycle. People link their Jira account from the Jira app's new "Link my CoderHelm account" action with a one-time code made on the dashboard. Give to CoderHelm adds the team's trigger label through the Jira app, so the run starts on the label path with the person as owner; "Draft a plan first" stops the run after its plan until the person approves it.
…-page # Conflicts: # services/common/src/pr_history.rs # services/gateway/src/main.rs # services/gateway/src/permissions.rs # services/worker/src/passes/incidents/bm_teams_never_cross.rs
…give The features table names the first released version with each: a site still on major 6 is told it lacks them.
…; the fit reason and version test follow 7.1.0
…fixed 1.42.3 or newer Clears the linkify-it and prosemirror-view advisories. Atlassian's editor packages pin prosemirror-view below the fix in every release, so an override lifts it.
The answer run takes up the planning run's plan (resume_from) instead of planning again with the answer in the plan's key.
# Conflicts: # docs/pull-requests.md # docs/pull-requests/api_contract.md # services/common/src/pr_history.rs # services/common/src/pr_record.rs # services/gateway/src/main.rs # services/gateway/src/permissions.rs # services/worker/src/passes/incidents/bm_teams_never_cross.rs
The link webhook reads its body into a typed struct (deny_unknown_fields, plain bounded strings, 2 KiB at most) instead of a JSON value, checks the code's signature before any read, and uses the code up only while it is unexpired, in the same conditional delete.
|
Auto-merge · blocked
|
| if body.is_empty() || body.len() > MAX_LINK_BODY { | ||
| return Err(StatusCode::PAYLOAD_TOO_LARGE); | ||
| } | ||
| let req: LinkRequest = serde_json::from_slice(body).map_err(|_| StatusCode::BAD_REQUEST)?; |
The link route takes Json<LinkRequest> (deny_unknown_fields, plain strings) behind a 2 KiB body limit, so no request body is deserialized by hand.
Superseded by CoderHelm's latest review
…ds as its handler
There was a problem hiding this comment.
❌ Changes requested: 2 earlier requested changes still open.
Holding the merge:
- 🔴 Blocking (correctness): Retry after a settings conflict drops the Pull requests source entry (bug) (
services/gateway/src/routes/foryou.rs:1196) - 🔴 Blocking (correctness): A give that Jira refuses leaves its record armed for 15 minutes (correctness) (
services/gateway/src/routes/foryou_give.rs:201)
Why changes requested: 🔴 Blocking (correctness): Retry after a settings conflict drops the Pull requests source entry (bug) (services/gateway/src/routes/foryou.rs:1196); 🔴 Blocking (correctness): A give that Jira refuses leaves its record armed for 15 minutes (correctness) (services/gateway/src/routes/foryou_give.rs:201).
Details: PR Overview · 🎯 Risk · Also worth a look · Earlier comments
PR Overview
Adds the For you page's backend (GET /api/foryou and its link, give and prefs routes), the supporting pure logic, a worker stop for plan approval, and Jira app 7.1.0 additions (sprint read, give, a link action).
Changes
- Jira app: new jira:issueAction 'Link my CoderHelm account' with a UI Kit screen and a Forge resolver
- Jira app: get-issues gains a person's open-sprint read and a 'give' label action, with input validation
- Jira app dependencies: @forge/react 12, forge/bridge 7, React 18, prosemirror-view override
- Gateway and common: /api/foryou routes, signed one-time link codes, fit bands, suggestions lifecycle, give record
- Worker: 'Draft a plan first' stops the run for the person's approval, settled by rule in the stop judge
- common::foryou: signed one-time link codes, fit bands, grouping by turn, settings, suggestion lifecycle, and the give and plan-approval records
- Gateway: GET /api/foryou, prefs, items, suggestions, link and give routes, plus POST /webhooks/jira-link; heavy reads cached 30 s per installation, team and user
- Jira app: get-issues gains
sprintandgive, and a new 'Link my CoderHelm account' issue action sends the code with Forge's own account id
Reviewed Changes
37 changed files.
Show a summary per file
| File | Description |
|---|---|
.github/scripts/test_forge_release.py |
Expects the three 7.1.0 features to be missing on major 6 and nothing missing on major 7. |
coderhelm-jira/manifest.yml |
Registers the issueAction module, the link resource and the linkResolver function |
coderhelm-jira/package-lock.json |
Lockfile for the Forge bridge 7, UI Kit 12 and React 18 dependencies. |
coderhelm-jira/package.json |
Adds Forge bridge/react, React 18 and a prosemirror-view override |
coderhelm-jira/src/frontend/link.jsx |
UI Kit screen: a code field and a Link button that calls the resolver |
coderhelm-jira/src/issues.js |
Sprint JQL, field discovery, sprint issue shape, give request validation and label steps |
coderhelm-jira/src/link-resolver.js |
Wires linkAccount to a Forge resolver, using context.accountId |
coderhelm-jira/src/link.js |
Link resolver logic: cleans the code, takes the account id from Forge's context, and posts both to /webhooks/jira-link with the site's… |
coderhelm-jira/src/release.js |
get-issues handles sprint (the person's open-sprint search, with site field ids cached for a day) and give (checks the assignee, then… |
coderhelm-jira/test/issues.test.js |
Tests the sprint JQL, field detection by type, the sprint issue shape, the give request check and label re-add steps. |
coderhelm-jira/test/link.test.js |
Tests that the link action sends the Forge account id, the code and the site proof only, and that each response is worded. |
coderhelm-jira/test/manifest.test.js |
Asserts the new issue action adds no web trigger or scope. |
docs/for-you.md |
Describes the For you page, linking, fit bands, give flow, suggestions and the response shape. |
docs/incidents/ya_for_you_is_only_yours.md |
Incident write-up: a person sees only their own For you data, and email never links an identity. |
services/Cargo.lock |
Adds subtle to the common crate's dependencies. |
services/common/Cargo.toml |
Adds subtle for the constant-time comparison of link-code signatures in foryou.rs |
services/common/src/foryou.rs |
New pure module for identity, fit, grouping, stats, prefs, suggestions and plan approval, with unit tests. |
services/common/src/handback.rs |
Maps PersonOnly::PlanApproval to HumanOnly::Approval. |
services/common/src/jira_app_features.json |
Lists the three features that arrive with Jira app 7.1.0. |
services/common/src/jira_app_version.rs |
Version tests now follow the 7.1.0 feature list. |
services/common/src/lib.rs |
Registers the foryou module. |
services/common/src/pr_history.rs |
History keeps the changed file paths. |
services/common/src/stop_judge.rs |
Adds the PlanApproval variant, the plan_first_for field and the rule that settles the ask with no default or deadline, plus a test. |
services/gateway/src/main.rs |
Routes for For you and the /webhooks/jira-link route with a named body limit. |
services/gateway/src/permissions.rs |
Capability entries for the new handlers. |
services/gateway/src/routes/chat_work.rs |
Passes the session user's id into needs::Me. |
services/gateway/src/routes/chat_work_needs.rs |
Me gains user. The Store trait's jira_accounts becomes jira_link (the linked account only). jira_ids_from_runs and the email-based… |
services/gateway/src/routes/foryou.rs |
New route module: cached reads, the pure page builder, settings persistence and the For you handlers |
services/gateway/src/routes/foryou/tests.rs |
Adds unit tests for the page builder using invented data: grouping by turn, snooze and done, asks from gather, fit bands and suggestions… |
services/gateway/src/routes/foryou_give.rs |
New: give preview and give routes, the Jira app 'give' call, and owner_for_event, which credits the giver once. |
services/gateway/src/routes/foryou_link.rs |
Link code creation, the Jira link webhook (secret check, signature check, one-time use-up), unlink, not-me, and the seen-Jira-users read. |
services/gateway/src/routes/jira_webhook.rs |
Adds trigger_label_of, takes the give owner as requester, and changes remember_jira_users to an update so a link is never erased |
services/gateway/src/routes/mod.rs |
Registers the foryou, foryou_give and foryou_link modules |
services/gateway/src/routes/run_answer.rs |
An approved plan answer resumes the new run from the answered run's plan |
services/worker/src/passes/incidents/bm_teams_never_cross.rs |
Lists the Jira link inbound route and the For you read cache in the cross-team case |
services/worker/src/passes/incidents/ya_for_you_is_only_yours.rs |
Incident case: no For you route takes a person, stats are computed only for the session's login, email alone never links an identity, and… |
services/worker/src/passes/mod.rs |
Plan-first gate in run_passes: after the plan passes, it reads the give record. With no approval it asks via the stop judge and marks… |
I reviewed the Jira app files in this part and read link.js, which this part doesn't list, because the resolver calls it. The account id comes from Forge's context, not the payload, and the JQL id and the give inputs are validated against a strict allow-list before they are used. The manifest, resolver and resource wiring are consistent, and sprintJql has tests including an injection attempt. I found no defects in this part.
🎯 Risk: HIGH (75/100)
██████████blast radius 100 — ~258 dependent refs; hottest: manifest.yml (~25), package-lock.json (~25), package.json (~25) · cross-repo consumers: manifest.yml to 1 repo(s), package-lock.json to 1 repo(s), package.json to 1 repo(s)██████░░░░sensitive area 60 — infra/ci, sensitive-adjacent additions████░░░░░░test coverage 40 — 31 source / 5 test file(s) changed█████████░size/spread 86 — 11579 lines across 37 file(s), spread 53%
Also worth a look
Advice from the smallest-change checks after the first review. They are notes, not part of the verdict:
coderhelm-jira/src/issues.js:161A parallel structure next to an existing oneservices/gateway/src/routes/jira_webhook.rs:369A parallel structure next to an existing one
Earlier comments
3 settled and resolved · 5 still open
Was this review right? Rate it 👍 / 👎 so the reviewer learns · reply @coderhelm re-review or @coderhelm <question>
| let after = hay[at + needle.len()..].chars().next(); | ||
| let edge = |c: Option<char>| c.is_none_or(|c| !c.is_ascii_alphanumeric()); | ||
| // A stem ("vulnerab", "encrypt") may run on into its word. | ||
| let stem = needle.ends_with("ab") || needle == "encrypt" || needle.ends_with('-'); |
There was a problem hiding this comment.
🔴 Blocking (correctness): Exclude list misses authentication, authorization and redaction tickets (correctness)
has_word only lets a stem run on into a longer word when the needle ends with ab, equals encrypt, or ends with -: let stem = needle.ends_with("ab") || needle == "encrypt" || needle.ends_with('-');. Every other needle must be followed by a non-alphanumeric character or a plural s. The auth entry in the auth list therefore does not match authentication, authorization, authenticate or authorized, and nothing else in the list covers them. redact does not match redaction or redacted either. excluded reads only the title, type, labels and components, so a ticket titled "Add authentication to the export endpoint" with acceptance criteria, one repo and a small estimate gets Band::Good and is suggested. The module doc says auth, security and personal-data work is never suggested. The author test shows the intent was whole words, but it does not cover these common forms.
| .find(|r| r.human) | ||
| .map(|r| r.who.clone()) | ||
| }); | ||
| gone.insert( |
There was a problem hiding this comment.
🔴 Blocking (correctness): Retry after a settings conflict drops the Pull requests source entry (bug)
In get_for_you, sources is built once before for _ in 0..3. Inside the loop, list.append(&mut sources) moves its contents into the page. If write_prefs returns Ok(false) (a concurrent write), the loop runs again with sources already empty. The page that finally returns then has no 'Pull requests' source entry, including no failed or off state. The page uses these entries to say what could not be read, so a failed or off read looks like it never happened.
| approved_at: 0, | ||
| started_at: 0, | ||
| }; | ||
| foryou::put_given( |
There was a problem hiding this comment.
🔴 Blocking (correctness): A give that Jira refuses leaves its record armed for 15 minutes (correctness)
foryou::put_given writes the give row (given_at = now, started_at = 0) before ask_give runs. When Jira answers Refused (for example the app couldn't be reached, or the assignee check failed), give returns a 409 and leaves the row in place. awaits_event stays true for GIVE_WINDOW_SECS (15 minutes), and owner_for_event takes any event that reaches line 717 of jira_webhook.rs while it is true. That includes another person adding the trigger label by hand, or a label or assignee event on a ticket that already carries it. That event is credited to the giver as requester, and the row's plan_first still applies. The person was told nothing started. Separately, owner_for_event marks the row started even if the trigger gate later blocks the run, so no run starts and the give is used up. The Old answer is different: its message tells the person to add the label by hand, so keeping the row is intended there.
| pub fn jira_link_sk(user: &str) -> String { | ||
| format!("{JIRA_LINK_PREFIX}{user}") | ||
| } | ||
| pub fn give_sk(ticket: &str) -> String { |
There was a problem hiding this comment.
🛑 Blocking (correctness): Near-identical helpers added together (scope)
services/common/src/foryou.rs adds give_sk next to user_sk, 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/foryou.rs: <why>.
| } | ||
| } | ||
|
|
||
| fn merged_by(login: &str, n: u64, files: &[&str]) -> History { |
There was a problem hiding this comment.
🛑 Blocking (correctness): Near-identical helpers added together (scope)
services/gateway/src/routes/foryou/tests.rs adds merged_by next to rec, 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/gateway/src/routes/foryou/tests.rs: <why>.
| match link(&state, &team, &user, &account).await { | ||
| Ok(()) => { | ||
| info!(team_id = %team, "For you: a person linked their Jira account"); | ||
| let name = user_name(&state, &team, &user).await; |
There was a problem hiding this comment.
🛑 Blocking (correctness): Near-identical helpers added together (scope)
services/gateway/src/routes/foryou_link.rs adds user_name next to linked_jira, 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/gateway/src/routes/foryou_link.rs: <why>.
Superseded by CoderHelm's latest review
Summary
The For you page's backend: one person's own page, read for the session's user only.
GET /api/foryoujoins what CoderHelm already reads (the pull request records behind/api/prs,chat_work_needs::gatherfor runs, held calls and Jira) with the person's open sprint from the Jira app, a fit band per sprint ticket, three private numbers and suggestions. People link their Jira account themselves from a new "Link my CoderHelm account" action in the Jira app, never by email. "Give to CoderHelm" starts a run through the existing label path with the person as owner and CoderHelm as delegate, and "Draft a plan first" makes the run wait for their OK before any code.Built on #985 (the pull requests view), which is still open: it reuses
prs::read_all,pr_view::rows,pr_needsandpr_historyrather than forking them. The branch contains #985's commits so CI runs againstmain; once #985 merges, this diff is only For you.Changes
common::foryou(pure, tested): signed one-time link codes; the "Is this you?" suggestion (email is only ever a suggestion); fit bands from a checklist (acceptance criteria, files or area named, size, one repository known, tests, and an exclude list: security, auth, personal data, incidents, production-critical, three or more repositories), with reasons and what is missing, no percentages; grouping pull requests by whose turn it is; the median review turnaround for one login; the person's settings (layout, landing page, snooze, done, undo, muted kinds); the suggestions' lifecycle (only on new or changed items, withdrawn with a reason when the basis changes, one-click dismiss with reasons that each make one fixed change, snooze, undo); the give record and the plan approval.GET /api/foryou("view"): needs you now grouped by turn (reviews asked of you, your PRs returned to you, CoderHelm asks you), your sprint, CoderHelm working for you, waiting on others, Later, the private stats (waiting on you, your PRs waiting on others, your median review turnaround), suggestions withreason,evidence,effect,effort,deadline,as_of,dismiss_reasons, andwithdrawnwithwithdrawn_reason. Heavy reads cached 30 s per installation, team and user (foryou::READS, listed inbm_teams_never_cross).PUT /api/foryou/prefs,POST /api/foryou/items,POST /api/foryou/suggestions(accepting a review suggestion asks GitHub to add the person as a reviewer),POST|DELETE /api/foryou/link/jira,POST /api/foryou/link/jira/not-me(the person's own).GET /api/foryou/give(preview; the planner has no dry-run mode, so it shows what is known and that the plan comes first) andPOST /api/foryou/give("runs"): records the owner, asks the Jira app to add the team's trigger label; the label event starts the run on the existing path (ticket_triggers) and credits the giver as requester once.POST /webhooks/jira-link: the Jira app's link action, proven by the site's Forge secret; the code is checked by signature, then used up in the read. Listed inbm_teams_never_cross::INBOUND.chat_work_needs::gatherreads only the linked Jira account (no more email match);remember_jira_usersupdates instead of replacing, so a Jira event never erases a link.PersonOnly::PlanApproval: no model call, no default, no deadline). Approving on the run page starts the run that codes.get-issuesgainssprint(the person's open sprint:assignee = "<accountId>" AND sprint in openSprints(), the id written in since the app runs as itself; story points and sprint fields found by type) andgive(checks the assignee, then adds the label). A newjira:issueAction"Link my CoderHelm account" (UI Kit) sends the code and Forge's account id. No new scope, egress or web trigger, so it is a minor version Forge rolls out by itself;jira_app_features.jsonlists both features from 7.1.0. Released byjira-app-release.ymlon merge as usual.ya_for_you_is_only_yours: a person only ever sees their own For you data, stats are never computed for another person, and email alone never links an identity.pr_history::Historykeeps the changed files (for review suggestions). Docs:docs/for-you.md.Verification
cargo fmt --all --check,rustfmt --check --edition 2021on the incident cases: cleancargo clippy -p common -p worker -p gateway --all-targets -- -D warnings: cleancargo test -p common -p worker -p gateway(full,--no-fail-fast): every suite passes; the worker's incident cases were run again after the last change (all pass)coderhelm-jira:npm test(62 pass); release script tests (python3 -m unittest discover -s .github/scripts);forge_release.py diffagainst main:needs_admin=false.forge lintneeds a Forge login and runs in the release workflow.brand_spelling.py,domain_examples.py,text_guard.py --texton this description and the new docs: clean