Public: anyone can read this; the crew can change it.

A pull reading says approval moved in one string: approvedAt reads "head against base" beside the object it carries now #16761

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

GET a pull now returns approvedAgainst next to approvedAt: a string " against ", or null when nothing is approved. approvedAt is unchanged, so existing readers don't break. Old approvals: an approval from before bases were recorded gives just the head, " ".

Notes

opened this

GET a pull now returns approvedAgainst next to approvedAt: a string "<head7> against <base7>", or null when nothing is approved. approvedAt is unchanged, so existing readers don't break.

  • Old approvals: an approval from before bases were recorded gives just the head, "<head7>".
  • Reuse: the string comes from a new helper, approvedAgainst() in src/core/approval_at.ts, built on the existing approval object. I didn't run scripts/similar.ts.
  • OpenAPI: the route description and its reply fields in getApiV1ReposOwnerNamePullsNumber.ts name the new field.
  • Test: test/approval-moved-inbox.test.ts approves a pull, reads it over the API, then moves the base. The string stays what the approval was given against, and approvedAt.current goes from true to false. The inbox row still says "moved since approval" at that point.
  • Checks: that test file passes (6 tests), tsc is clean, and the gate reports 32 rules satisfied. I did not run the rest of the suite or scripts/design-lint.ts (no src/web/ change).

I did not add a separate movedSinceApproval flag to the pull reading. approvedAt.current already says it, and the issue's "flag" is the existing movedSinceApproval() rule that drives the inbox. I also left the web page and terminal alone: the commit says "No door", since this is a read-only field and both draw the approval from approvedAt already.

To try it: GET /api/v1/repos/OWNER/NAME/pulls/N on an approved pull and read approvedAgainst.

Closes #12553

commented

GET a pull now returns approvedAgainst next to approvedAt: a string "<head7> against <base7>", or null when nothing is approved. approvedAt is unchanged, so existing readers don't break.

  • Old approvals: an approval from before bases were recorded gives just the head, "<head7>".
  • Reuse: the string comes from a new helper, approvedAgainst() in src/core/approval_at.ts, built on the existing approval object. I didn't run scripts/similar.ts.
  • OpenAPI: the route description and its reply fields in getApiV1ReposOwnerNamePullsNumber.ts name the new field.
  • Test: test/approval-moved-inbox.test.ts approves a pull, reads it over the API, then moves the base. The string stays what the approval was given against, and approvedAt.current goes from true to false. The inbox row still says "moved since approval" at that point.
  • Checks: that test file passes (6 tests), tsc is clean, and the gate reports 32 rules satisfied. I did not run the rest of the suite or scripts/design-lint.ts (no src/web/ change).

I did not add a separate movedSinceApproval flag to the pull reading. approvedAt.current already says it, and the issue's "flag" is the existing movedSinceApproval() rule that drives the inbox. I also left the web page and terminal alone: the commit says "No door", since this is a read-only field and both draw the approval from approvedAt already.

To try it: GET /api/v1/repos/OWNER/NAME/pulls/N on an approved pull and read approvedAgainst.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs