Skip to content

feat(extension): inject Mergify row into every merge box variant#494

Merged
mergify[bot] merged 1 commit into
mainfrom
devs/sileht/merge-sidebar-mergify-button/support-github-s-merge-status-sidebar--5fbcee25
May 29, 2026
Merged

feat(extension): inject Mergify row into every merge box variant#494
mergify[bot] merged 1 commit into
mainfrom
devs/sileht/merge-sidebar-mergify-button/support-github-s-merge-status-sidebar--5fbcee25

Conversation

@sileht
Copy link
Copy Markdown
Member

@sileht sileht commented May 27, 2026

GitHub serves PR pages with up to three different merge-box layouts
right now:

  1. The new merge-status sidebar (a Primer dialog at the document
    root, anchored on [data-testid="mergebox-border-container"]),
    being rolled out.
  2. The current bottom merge box ([data-testid="mergebox-partial"]
    with .border.rounded-2, optionally wrapped by
    .discussion-timeline-actions .merge-pr).
  3. The classic .mergeability-details merge box.

Some users only see one variant; others — depending on the rollout —
see the new sidebar alongside the bottom merge box on the same page.
The extension needs to render the Mergify row on every variant so the
queue/refresh affordance is visible wherever GitHub shows merge
controls.

Refactor injectRowIntoMergeBox around a MERGE_BOX_ANCHORS table that
walks every variant and attaches a row to every container that does
not already contain one. The single-row id is replaced by a
data-mergify-merge-box-row attribute since multiple instances must
coexist; updateMergifyRow callers route through a new
updateAllMergifyRows helper so post-command refreshes and the
queue-state poll cover every instance.

While there, fix a latent collision: GitHub's new sidebar renders a
native <section id="mergify"> for the Mergify GitHub App check,
which made the previous document.querySelector("#mergify") gate
short-circuit our injection logic to update that native section
instead of our row. The attribute-based marker sidesteps that, and
the per-container guard inside injectRowIntoMergeBox keeps the
function idempotent on repeated MutationObserver ticks.

Tests cover the new sidebar anchor, coexistence with the native
<section id="mergify">, the legacy mergebox-partial fallback, the
no-merge-box case, multi-anchor coexistence (all three injected at
once), and per-anchor idempotency on repeated calls.

Fixes MRGFY-7396

Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com

Copilot AI review requested due to automatic review settings May 27, 2026 13:08
@mergify mergify Bot had a problem deploying to Mergify Merge Protections May 27, 2026 13:08 Failure
@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented May 27, 2026

Merge Protections

Your pull request matches the following merge protections and will not be merged until they are valid.

🟢 Required Reviews

Wonderful, this rule succeeded.
  • any of:
    • #approved-reviews-by >= 2
    • author = dependabot[bot]

🟢 Enforce conventional commit

Wonderful, this rule succeeded.

Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/

  • title ~= ^(fix|feat|docs|style|refactor|perf|test|build|ci|chore|revert|ui)(?:\(.+\))?:

🟢 🔎 Reviews

Wonderful, this rule succeeded.
  • #changes-requested-reviews-by = 0
  • #review-requested = 0
  • #review-threads-unresolved = 0

🟢 📕 PR description

Wonderful, this rule succeeded.
  • body ~= (?ms:.{48,})

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds support for GitHub’s updated PR merge-status sidebar so the Mergify merge-box row is injected into the new stable container and no longer collides with GitHub’s native section#mergify.

Changes:

  • Updates merge-box row ID references to mergify-merge-box-row.
  • Adds the new data-testid="mergebox-border-container" injection anchor with legacy fallback.
  • Adds unit coverage for new sidebar injection, native #mergify coexistence, fallback behavior, and missing merge-box handling.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/queue.js Renames the injected row ID and updates queue row refresh lookups.
src/mergify.js Exports and updates merge-box injection to use the new GitHub sidebar anchor.
src/__tests__/mergify.test.js Adds direct tests for merge-box row injection behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@sileht sileht changed the title feat(extension): support GitHub's new merge-status sidebar feat(extension): inject Mergify row into every merge box variant May 27, 2026
@sileht sileht force-pushed the devs/sileht/merge-sidebar-mergify-button/support-github-s-merge-status-sidebar--5fbcee25 branch from 67ea233 to c5c090a Compare May 27, 2026 13:35
@sileht
Copy link
Copy Markdown
Member Author

sileht commented May 27, 2026

Revision history

# Type Changes Reason Date
1 initial 67ea233 2026-05-27 13:35 UTC
2 content 67ea233 → c5c090a (raw) 2026-05-27 13:35 UTC
3 content c5c090a → 2222c31 (raw) 2026-05-27 13:47 UTC
4 content 2222c31 → cd78694 (raw) 2026-05-27 13:59 UTC
5 content cd78694 → a306b76 (raw) 2026-05-27 14:08 UTC
6 content a306b76 → cecbe26 (raw) 2026-05-27 14:14 UTC
7 content cecbe26 → ad598c6 (raw) 2026-05-27 14:16 UTC
8 content ad598c6 → 21257fd (raw) 2026-05-27 14:19 UTC
9 content 21257fd → 1eb5a3f (raw) 2026-05-27 14:22 UTC
10 content 1eb5a3f → 24aca7a (raw) 2026-05-27 17:50 UTC

@mergify mergify Bot had a problem deploying to Mergify Merge Protections May 27, 2026 13:35 Failure
@sileht sileht force-pushed the devs/sileht/merge-sidebar-mergify-button/support-github-s-merge-status-sidebar--5fbcee25 branch from c5c090a to 2222c31 Compare May 27, 2026 13:47
@mergify mergify Bot had a problem deploying to Mergify Merge Protections May 27, 2026 13:47 Failure
@sileht sileht force-pushed the devs/sileht/merge-sidebar-mergify-button/support-github-s-merge-status-sidebar--5fbcee25 branch from 2222c31 to cd78694 Compare May 27, 2026 13:59
@mergify mergify Bot had a problem deploying to Mergify Merge Protections May 27, 2026 14:00 Failure
@sileht sileht force-pushed the devs/sileht/merge-sidebar-mergify-button/support-github-s-merge-status-sidebar--5fbcee25 branch from cd78694 to a306b76 Compare May 27, 2026 14:08
@mergify mergify Bot had a problem deploying to Mergify Merge Protections May 27, 2026 14:08 Failure
@sileht sileht force-pushed the devs/sileht/merge-sidebar-mergify-button/support-github-s-merge-status-sidebar--5fbcee25 branch from a306b76 to cecbe26 Compare May 27, 2026 14:14
@mergify mergify Bot had a problem deploying to Mergify Merge Protections May 27, 2026 14:15 Failure
@sileht sileht force-pushed the devs/sileht/merge-sidebar-mergify-button/support-github-s-merge-status-sidebar--5fbcee25 branch from cecbe26 to ad598c6 Compare May 27, 2026 14:16
@mergify mergify Bot had a problem deploying to Mergify Merge Protections May 27, 2026 14:16 Failure
@sileht sileht force-pushed the devs/sileht/merge-sidebar-mergify-button/support-github-s-merge-status-sidebar--5fbcee25 branch from ad598c6 to 21257fd Compare May 27, 2026 14:19
@mergify mergify Bot had a problem deploying to Mergify Merge Protections May 27, 2026 14:19 Failure
@sileht sileht force-pushed the devs/sileht/merge-sidebar-mergify-button/support-github-s-merge-status-sidebar--5fbcee25 branch from 21257fd to 1eb5a3f Compare May 27, 2026 14:22
@sileht
Copy link
Copy Markdown
Member Author

sileht commented May 27, 2026

CleanShot 2026-05-27 at 16 23 10@2x

@sileht sileht marked this pull request as ready for review May 27, 2026 14:23
@mergify mergify Bot had a problem deploying to Mergify Merge Protections May 27, 2026 14:23 Failure
@mergify mergify Bot requested a review from a team May 27, 2026 14:24
GitHub serves PR pages with up to three different merge-box layouts
right now:

  1. The new merge-status sidebar (a Primer dialog at the document
     root, anchored on `[data-testid="mergebox-border-container"]`),
     being rolled out.
  2. The current bottom merge box (`[data-testid="mergebox-partial"]`
     with `.border.rounded-2`, optionally wrapped by
     `.discussion-timeline-actions .merge-pr`).
  3. The classic `.mergeability-details` merge box.

Some users only see one variant; others — depending on the rollout —
see the new sidebar alongside the bottom merge box on the same page.
The extension needs to render the Mergify row on every variant so the
queue/refresh affordance is visible wherever GitHub shows merge
controls.

Refactor injectRowIntoMergeBox around a MERGE_BOX_ANCHORS table that
walks every variant and attaches a row to every container that does
not already contain one. The single-row id is replaced by a
`data-mergify-merge-box-row` attribute since multiple instances must
coexist; updateMergifyRow callers route through a new
updateAllMergifyRows helper so post-command refreshes and the
queue-state poll cover every instance.

While there, fix a latent collision: GitHub's new sidebar renders a
native `<section id="mergify">` for the Mergify GitHub App check,
which made the previous `document.querySelector("#mergify")` gate
short-circuit our injection logic to update that native section
instead of our row. The attribute-based marker sidesteps that, and
the per-container guard inside injectRowIntoMergeBox keeps the
function idempotent on repeated MutationObserver ticks.

Tests cover the new sidebar anchor, coexistence with the native
`<section id="mergify">`, the legacy mergebox-partial fallback, the
no-merge-box case, multi-anchor coexistence (all three injected at
once), and per-anchor idempotency on repeated calls.

Fixes MRGFY-7396

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Change-Id: I5fbcee2590a13a5e0da0c7e5ffc05f0cf2432b02
@sileht sileht force-pushed the devs/sileht/merge-sidebar-mergify-button/support-github-s-merge-status-sidebar--5fbcee25 branch from 1eb5a3f to 24aca7a Compare May 27, 2026 17:50
@mergify mergify Bot deployed to Mergify Merge Protections May 27, 2026 17:51 Active
@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented May 29, 2026

Merge Queue Status

This pull request spent 2 minutes 23 seconds in the queue, including 1 minute 38 seconds running CI.

Required conditions to merge

mergify Bot added a commit that referenced this pull request May 29, 2026
@mergify mergify Bot added the queued label May 29, 2026
@mergify mergify Bot merged commit 6859a56 into main May 29, 2026
4 checks passed
@mergify mergify Bot deleted the devs/sileht/merge-sidebar-mergify-button/support-github-s-merge-status-sidebar--5fbcee25 branch May 29, 2026 08:58
@mergify mergify Bot removed the queued label May 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants