Skip to content

Risk bars: never drawn from a judgment for another commit - #3955

Draft
backnotprop wants to merge 1 commit into
mainfrom
fix/risk-bars-followups
Draft

backnotprop wants to merge 1 commit into
mainfrom
fix/risk-bars-followups

Conversation

@backnotprop

Copy link
Copy Markdown
Owner

Follow-ups from the independent review of #3886 (risk bars and the risk reason card in the Inbox's code review).

1. Old bars on new code. After a push, a failed risk read left the window holding the earlier head's judgment, and its bars were drawn on the new head's diff (the page only compared the diff's head with the list's).

  • GET /api/inbox/pulls/risk: each judgment now carries head, the commit it was made at. The server stamps it from what it already keeps (pull-risk.json has always stored head). The agent sends nothing, and no words agents read change.
  • The PR page draws a judgment's places (diff marks, tree marks, the header's "N places") only on a diff at that head (riskJudgedAt in pulls/riskBars.ts). Otherwise it draws nothing and shows no new words.
  • A judgment with no head comes from a server from before this change. Nothing on it says which head it was made for, so it is drawn as before (on a diff at the head the list shows).
  • Inbox route only (Bun). The Pi server has no risk route.
  • Mobile contract: no change. The door lists GET pulls/risk with an untyped JSON answer. bun scripts/mobile/check.ts and bun scripts/mobile/all.ts --check are both up to date.

2. One bar per row. The unified view draws an unchanged line as one row under both of its numbers. If one place named it by its new number and another by its old number, they made two marks. Only one could be drawn, so the other place's reason was missing from the card and its step opened nothing. They now share one mark (on the new side), and its card lists both reasons. A place that names an unchanged line only by its old number stays where it was.

3. Escape. While a menu is open (a role="menu" popup, or ui's anchored menus with data-pn-dismissable-popover), the card no longer takes Escape. The menu closes first, and the next Escape closes the card.

4. Nits. The guide's store line (line 233 at the reviewed head) is already right on main. Comments that said only High names places now say Medium does too (inbox-pull-risk.ts header, contextNotes/model.ts). The guide names the diff mark's builder by its full path, packages/inbox/pulls/riskBarsMarks.ts. The guide and the Server API table now document head.

Tests (each fails without its fix)

  • DOM packages/inbox/pulls/riskBarsHead.test.tsx (new): a push followed by a failed risk read draws no diff marks, tree marks or "N places". A judgment for another head draws nothing. One with no head draws as before.
  • packages/inbox/pulls/riskBars.test.ts: an unchanged line named by both of its numbers is one mark with both reasons, and the stepper finds it either way.
  • DOM packages/inbox/pulls/riskBarsCard.test.tsx: with a menu open, Escape closes the menu first, then the card.
  • packages/server/inbox-pull-risk.test.ts and inbox-pulls.test.ts: the answer's judgments carry their head.

- The risk answer gives each judgment the head it was made at (the server
  stamps it from what it kept; the agent sends nothing). The PR page draws
  a judgment's places (diff marks, tree marks, "N places") only on a diff
  at that head, so an answer held after a failed risk read is never drawn
  on a newer push. A judgment with no head (an older server) is drawn as
  before.
- An unchanged line named by its old and its new number is one mark whose
  card says both: the unified view draws that line as one row.
- With a menu open, Escape closes the menu first and the next one the card.
- Docs: the risk sections and the API table say the head; the comments
  that said only High names places now say Medium does too; the diff
  mark's builder is named by its path.
@backnotprop backnotprop added the ci:e2e Run the full browser suite (Inbox window e2e) on this PR label Nov 23, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:e2e Run the full browser suite (Inbox window e2e) on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant