Skip to content

ci: review-signal does not add needs:design-review back at a head an owner cleared it on - #11856

Draft
cixzhang wants to merge 3 commits into
mainfrom
ci/design-label-same-head-removal
Draft

cixzhang wants to merge 3 commits into
mainfrom
ci/design-label-same-head-removal

Conversation

@cixzhang

@cixzhang cixzhang commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Who this helps

Design owners and authors waiting on a pull request. needs:design-review is advisory: it routes a design-affecting change to design owners and never blocks a merge. When a design owner (or an engineering owner) removes it because they have seen the change, the next pull-request event at the same head puts it straight back, because the label is recomputed from the diff on every event. #11539 shows it: the label was removed at head 9b4100d at 21:59Z on 11/14, and marking the pull request ready for review at 02:16Z on 11/15 added it again on that same head. The next commit came at 02:44Z. Someone then removes it again by hand.

What changes

  • .github/workflows/review-signal.yml, the "Detect signals and route" step: before adding needs:design-review, it reads the pull request's timeline and the current head's commit statuses (inert API data; no pull-request code runs). When an engineering or design owner removed the label after the current head reached the pull request, it does not add it back, and it writes the reason in the job log and the job summary: "#N: needs:design-review not added back: @owner removed it at this head (sha)."
  • When the head arrived: a pushed commit appears in the timeline at its committer date, not its push time, so a commit made before a removal and pushed after it would sort before the removal. The head's arrival is therefore read from the earliest review-required status on it, which review-signal itself writes for every new head (trusted creator only).
  • It adds the label as before when:
    • the head arrived after the removal;
    • someone who is not an owner removed it;
    • the head has no trusted review-required status yet (its arrival is unknown);
    • the timeline or the statuses cannot be read (with a warning).
  • .github/scripts/review-signal-decision.cjs: the decision is a pure function, ownerRemovedLabelAtHead({events, headStatuses, label, owners}), loaded from the trusted workflow commit like the rest of the helper. A removal counts only if it came after the head's first review-required status, so it never carries to another commit.
  • Unchanged: which changes are design-affecting, the design-owner review that clears the label, the code-review gate and review-required, and the owner lists (vars.ENGOWNERS, vars.DESIGNOWNERS).

Evidence

  • review-signal-decision.test.mjs, ownerRemovedLabelAtHead:
    • an owner removal after the head arrived, by a design or an engineering owner, with any letter case, counts;
    • a removal before the head arrived does not, whatever the commit date: as on fix(Lightbox): a caption ending in a wide image no longer grows when the window widens #11740's timeline, a commit dated 17:05, pushed at 17:19, after a removal at 17:14. This case fails on an earlier version of this change that ordered by the timeline;
    • a non-owner's removal does not;
    • another label's removal does not; with no trusted review-required status the removal does not count; a status another account wrote does not date the head; the earliest gate status dates the head.
  • review-signal-workflow.test.mjs, the real step against stub GitHub APIs on a theme-token change:
    • the label is added as before;
    • it is not added back after a design owner's removal at this head, and the step says so;
    • it is added again on a head that arrived after the removal (the commit dated before it);
    • it is added after a non-owner's removal;
    • it is added, with a warning, when the timeline read fails.
  • 118 tests pass across review-signal-decision, review-signal-workflow and ci-tooling-routing. With main's workflow and decision script, the 6 new behavior cases fail.
  • actionlint and prettier pass on the workflow.

CI impact: two extra GitHub API reads (the timeline and the head's statuses, paged) in the existing review-signal job, only for a design-affecting pull request that does not already carry the label. No job, runner or required check changes. Time to green: unchanged.

Specs

No current record decides when this advisory label is added back: architecture:knowledge-contracts governs engineering and design reviews (they count only at the current head) and the review gate, not this label. This change stays within the exact-head rule: a removal counts only at the head it was made on. A record for this, and for carrying a removal to later heads that change nothing visual, is proposed separately.

Overlap check

Searched open pull requests for review-signal.yml, review-signal-decision.cjs and their tests: #11757 (a community security pull request, conflicting with main) rewrites the workflow's header and trigger sections. This change edits only the label step around line 669, which #11757 does not touch.

Overlap checked: #11757 (a different part of review-signal.yml: its header, triggers and the first job; this change is one block in the label step)

Owning session: noopbot (a61f66c2), under CI & Release (ca77f950). Land path: the shipper, through merge-guard.

…owner cleared it on

When an engineering or design owner removed the advisory label after the push that made the current head, a later event at that head (ready for review, a reopen) leaves it off and says so in the job summary. A push after the removal, a non-owner's removal, or an unreadable timeline adds it as before.
@vercel

vercel Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Nov 19, 2026 4:46pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 15, 2026
@astracat-bot

astracat-bot Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
❓ Needs maintainer input (for maintainers only) Nov 19, 2026, 4:52 PM UTC

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

Current run: The current CI run concluded skipped. Current analysis is unavailable.


Generated by PR Enrichment workflow | View current CI run

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pull request is not ready for approval: it needs an owner decision on behaviour no spec records, and it has an ordering defect to fix.

No current spec decides whether an engineering or design owner's manual removal of needs:design-review keeps review-signal from adding it back on later events at the same head, so approval needs an engineering owner to provide or identify the governing spec for that behaviour. An engineering owner records the decision by commenting /approve-spec <full head SHA> on the pull request, and the author may do so as an engineering owner.

Blocking findings:

  • ownerRemovedLabelAtHead treats a regular push of a commit dated before an owner's removal as the head that owner cleared, because GitHub lists pushed commits in the timeline by committer date rather than push time, so the label stays off a head no owner has seen (.github/scripts/review-signal-decision.cjs:145-160, reproduced on #11740's timeline).
  • The description's "a push after the removal adds it as before" and "a removal never carries to another commit" are proven only for push-ordered timelines, so fix the ordering so they hold or narrow the wording.

Comparing the removal's time with the head's push time, for example the head's earliest review-required status, and adding a test whose head commit is listed before an earlier removal would close the defect.

Claims and files checked

Review mode: full; reason: no-earlier-review

  • Claim: an owner's removal at the current head keeps the label off at later events on that head — verified by the new decision and workflow tests and a replay of #11539's timeline.
  • Claim: a push or force push after the removal adds the label again — false for a regular push of a commit dated before the removal (replay of #11740's ordering); true for a force push.
  • Claim: a removal by someone who is not an owner does not count — verified by tests.
  • Claim: an unreadable timeline adds the label with a warning — verified by test and review-signal.yml:688-690.
  • Claim: the reason is written to the job log and the job summary — verified at review-signal.yml:692-695; the summary write is not exercised by tests.
  • Claim: the helper loads from the trusted workflow commit — verified at review-signal.yml:305-319.
  • Claim: design-affecting detection, the design-owner review, the code gate, review-required and the owner lists are unchanged — verified from the diff.
  • Claim: on #11539 a ready-for-review event re-added the label an owner had removed at the same head — verified from its timeline.
  • Claim: 118 tests pass and the 6 new behaviour cases fail without this change — verified.
  • Claim: actionlint and prettier pass — prettier verified; actionlint not run in this review.
  • Claim: one extra paged API read, only for a design-affecting pull request without the label, and no job or required-check change — verified from the diff.
  • Claim: no current spec decides when the label is added back — verified.
  • Claim: the open security pull request does not touch the label step — verified from its patch.
  • File .github/scripts/review-signal-decision.cjs — first blocking finding.
  • File .github/workflows/review-signal.yml — clear apart from the helper's effect.
  • File .github/scripts/review-signal-decision.test.mjs — second blocking finding (push-ordered timelines only).
  • File .github/scripts/review-signal-workflow.test.mjs — second blocking finding (push-ordered timelines only).

Automated review (maintainer link)

…ne's commit order

A pushed commit appears in the timeline at its committer date, so a commit made before an owner's removal and pushed after it sorted before the removal. The head's arrival is now the earliest trusted review-required status on it; with none, the removal does not count.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pull request is not ready for approval yet: it needs an owner decision on behaviour no spec records, and two findings to fix.

No current spec decides whether an engineering or design owner's manual removal of needs:design-review keeps review-signal from adding it back on later events at the same head, so approval needs an engineering owner to provide or identify the governing spec for that behaviour. An engineering owner records the decision by commenting /approve-spec <full head SHA> on this pull request, and the author may do so as an engineering owner.

Blocking findings:

  • A head that returns to an earlier commit (A, then B, then a force push back to A) is dated from that commit's first review-required status, so an owner's removal made while B was the head keeps the label off A and the job summary says it was removed "at this head", contrary to the description's "never carries to another commit" (.github/scripts/review-signal-decision.cjs:143-160); date the head from the later of that status and the newest head_ref_force_pushed event for it, with an A → B → A test, or narrow the wording.
  • The description's Evidence section says #11740 had a removal at 17:14, but that event is the workflow adding needs:spec-owner-review, so reword it as a case modelled on #11740's ordering.

The commit-date ordering defect from the previous review is fixed: a commit made before a removal and pushed after it now gets the label again.

Claims and files checked

Review mode: incremental; reason: none

  • Claim: an owner's removal after the current head arrived keeps the label off at later events on that head, with the reason in the job log and summary — verified by the new decision and workflow tests, review-signal.yml:695-702, and a replay of the motivating pull request's timeline.
  • Claim: the head's arrival is its earliest trusted review-required status, which review-signal writes for every new head — verified at review-signal-decision.cjs:143-147; draft heads are gated when pushed.
  • Claim: the label is added when the head arrived after the removal, a non-owner removed it, the head has no trusted status yet, or a read fails (with a warning) — verified by tests and review-signal.yml:692-694.
  • Claim: a removal never carries to another commit — false for a head that returns to an earlier commit (first finding).
  • Claim: the decision is a pure helper loaded from the trusted workflow commit — verified at review-signal.yml:305-319.
  • Claim: design-affecting detection, the design-owner review, the code gate, review-required and the owner lists are unchanged — verified from the diff.
  • Claim: on the motivating pull request a ready-for-review event re-added a label an owner had removed at the same head — verified from its timeline.
  • Claim: the commit-date case matches another pull request's timeline with a removal at 17:14 — partly false (second finding); the ordering itself is real.
  • Claim: the commit-date case fails on the earlier version of this change — verified by reading that version.
  • Claim: 118 tests pass and the 6 new behaviour cases fail with main's workflow and helper — verified.
  • Claim: actionlint and prettier pass — prettier verified; actionlint not run in this review.
  • Claim: two extra paged API reads, only for a design-affecting pull request without the label, and no job or required-check change — verified at review-signal.yml:669-684.
  • Claim: no current spec decides when the label is added back — verified.
  • Claim: the open security pull request does not touch the label step — verified from its patch.
  • File .github/scripts/review-signal-decision.cjs — first finding.
  • File .github/workflows/review-signal.yml — clear apart from the helper's effect; its comment at lines 670-673 shares the first finding's wording.
  • File .github/scripts/review-signal-decision.test.mjs — clear; its comment at lines 511-512 shares the second finding's wording.
  • File .github/scripts/review-signal-workflow.test.mjs — clear.

Automated review (maintainer link)

.map(status => Date.parse(status.created_at ?? ''))
.filter(Number.isFinite);
if (arrivals.length === 0) return {removedAtHead: false, by: null};
const arrived = Math.min(...arrivals);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Statuses belong to the commit, not to its latest arrival. If the head goes A, then B, then a force push back to A, this takes A's first review-required status, so an owner's removal made while B was the head counts for A and the label stays off a commit no owner cleared then (the job summary also says "removed it at this head"). The previous version handled this because the force push sorted after the removal. Consider dating the head as the later of this value and the newest head_ref_force_pushed timeline event whose commit_id is the head (it carries created_at), with an A → B → A test.

# Conflicts:
#	.github/scripts/review-signal-workflow.test.mjs

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pull request is not ready for approval yet: it needs an owner decision on behaviour no spec records, and two findings to fix.

No current spec decides whether an engineering or design owner's manual removal of needs:design-review keeps review-signal from adding it back on later events at the same head, so approval needs an engineering owner to provide or identify the governing spec for that behaviour. An engineering owner records the decision by commenting /approve-spec <full head SHA> on this pull request, and the author may do so as an engineering owner.

Blocking findings:

  • A head that returns to an earlier commit (A, then B, then a force push back to A) is dated from that commit's first review-required status, so an owner's removal made while B was the head keeps the label off A and the job summary says it was removed "at this head", contrary to the description's "never carries to another commit" (.github/scripts/review-signal-decision.cjs:143-147); date the head from the later of that status and the newest head_ref_force_pushed event for it, with an A → B → A test, or narrow the wording.
  • The description's Evidence section and the test comment at .github/scripts/review-signal-decision.test.mjs:511-512 say #11740 had an owner's removal at 17:14, but that event is the workflow adding needs:spec-owner-review, so reword both as a case modelled on #11740's commit ordering.

Also worth a look, not blocking: an owner who adds the label back is not honoured, because only removals are read (.github/scripts/review-signal-decision.cjs:150-159).

Claims and files checked

Review mode: full; reason: merge-touches-pr-files

  • Claim: on the motivating pull request, marking it ready re-added a label an owner had removed at the same head — verified from its timeline.
  • Claim: before adding the label, the step reads the timeline and the head's statuses as inert data, with no pull-request code run — verified at review-signal.yml:735-742.
  • Claim: after an owner's removal at the current head the label is not added back, and the job log and summary say why — verified at review-signal.yml:753-760 and by the workflow test.
  • Claim: the head's arrival is its earliest trusted review-required status, which review-signal writes for every new head — verified at review-signal-decision.cjs:143-147 and review-signal.yml:867.
  • Claim: the label is still added after a newer head, a non-owner's removal, with no trusted status, or when a read fails (with a warning) — verified by tests and review-signal.yml:750-752.
  • Claim: the decision is a pure helper loaded from the trusted workflow commit — verified at review-signal-decision.cjs:142 and review-signal.yml:306-320.
  • Claim: a removal never carries to another commit — false for a head that returns to an earlier commit (first finding).
  • Claim: design detection, the design-owner review, the code gate, review-required and the owner lists are unchanged — verified from the diff.
  • Claim: the commit-date test case matches another pull request's timeline with a removal at 17:14 — false (second finding).
  • Claim: the commit-date case fails on an earlier version of this change that ordered by the timeline — verified from that version's helper.
  • Claim: the new behaviour cases fail with the base's workflow and helper and all tests pass — verified: 6 fail on the base, 122 pass at the head (the count grew with tests merged from the base branch).
  • Claim: prettier passes on the workflow — verified; actionlint was not run.
  • Claim: CI cost is two paged reads only for a design-affecting pull request without the label, with no job, runner or required-check change — verified at review-signal.yml:727.
  • Claim: no current spec decides when this label is added back — verified.
  • Claim: the overlapping open pull request does not touch the label step — verified against that pull request's base.
  • File .github/workflows/review-signal.yml: clear, apart from the summary wording in the first finding.
  • File .github/scripts/review-signal-decision.cjs: first finding; non-blocking note on re-adds.
  • File .github/scripts/review-signal-decision.test.mjs: second finding (test comment).
  • File .github/scripts/review-signal-workflow.test.mjs: clear.

Automated review (maintainer link)

Comment on lines +511 to +512
// As on a real timeline: a commit dated 17:05, pushed at 17:19, after an
// owner removed the label at 17:14 on the head before it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#11740's 17:14:19Z event is the workflow adding needs:spec-owner-review; that timeline has no needs:design-review removal. Describe this as a case modelled on #11740's commit ordering, here and in the description's Evidence section.

Comment on lines +150 to +159
for (const event of events) {
if (event.event !== 'unlabeled' || event.label?.name !== label) continue;
const login = event.actor?.login?.toLowerCase();
const at = Date.parse(event.created_at ?? '');
if (!login || !owners.includes(login) || !Number.isFinite(at)) continue;
if (at > removedAt) {
removedAt = at;
by = login;
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking: only unlabeled events are read, so if an engineering owner removes the label, a design owner adds it back and the author then removes it, the next same-head event still sees the first removal and leaves the label off. Counting a removal only when no later owner labeled event for the label follows it would keep the owner's latest choice.

This branch was successfully deployed

1 active deployment
Preview — 91049032 Deployed Nov 19, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant