Skip to content

ci(garnet): Shadow-mirror upstream dependency PRs - #105

Merged
jadoonf merged 3 commits into
developfrom
devin/1795812170-sentry-shadow-mirror
Nov 27, 2026
Merged

jadoonf merged 3 commits into
developfrom
devin/1795812170-sentry-shadow-mirror

Conversation

@jadoonf

@jadoonf jadoonf commented Nov 27, 2026 •

Copy link
Copy Markdown

Adds a replay-only shadow mirror so upstream getsentry/sentry-javascript dependency PRs run through the stock Garnet path here: the garnet-record.yml recorder, the Garnet App's Runtime Review comment, and the gate's own pr_review comment. Nothing else is custom.

  • .github/scripts/shadow_mirror/mirror.py: replays Dependabot/Renovate PRs (author id checked, head repo must be upstream) that touch the installed pnpm workspace (package.json, pnpm-lock.yaml, pnpm-workspace.yaml, packages/*/package.json, dev-packages/*/package.json). E2E test-app and Actions-only bumps are skipped. Upstream merges bot PRs within about an hour, so discovery covers open PRs plus ones merged in the last 10 days.
  • Replay: upstream merge base → shadow/base/<n>, upstream head → shadow/pr/<n>, opened as a normal PR. Only garnet-record.yml is kept under .github/workflows, with shadow/base/** push and workflow_dispatch added so the baseline records. Nothing is written upstream.
  • .github/workflows/garnet-shadow-mirror.yml: runs every 30 min plus workflow_dispatch, using the SHADOW_MIRROR_TOKEN secret (Contents, Pull requests, Actions, Workflows write). Unit tests run on PRs.
  • Retires the custom .github/workflows/merge-gate.yml and .github/merge-gate/gate.py, which aren't part of the standard user path; gate verdicts come from pr_review as the gate's own comment. If merge-gate is a required status check in branch protection, remove it there too.

Tests: python3 -m unittest discover -s .github/scripts/shadow_mirror (16 pass) and actionlint. Live runs on upstream getsentry#26684 → #103 and getsentry#26672 → #104.


Garnet Merge Gate opened this PR for Fkj
Implemented in session Shadow mirror sentry-javascript dependency PRs
Review with Devin · Open in Devin Desktop


@devin-ai-integration

Copy link
Copy Markdown

I'll fix CI failures and address comments from users with write access that start with 'Devin'.

  • Disable automatic comment, CI, and merge conflict monitoring

@jadoonf
jadoonf marked this pull request as ready for review November 27, 2026 21:05
@jadoonf
jadoonf merged commit 738f32f into develop Nov 27, 2026
66 of 79 checks passed
@github-actions

Copy link
Copy Markdown

size-limit report 📦

Compared: 7d7b901 (PR test merge using develop at f85a782)

Against: f85a782 (develop) · base run #213

✅ Baseline matches: this diff contains only this PR's changes.

Path Size % Change Change
@sentry/browser 29.98 kB - -
@sentry/browser - with treeshaking flags 28.13 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 28.03 kB - -
@sentry/browser (incl. Tracing) 52.17 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 52.18 kB - -
@sentry/browser (incl. Tracing, Profiling) 55.12 kB - -
@sentry/browser (incl. Tracing, Replay) 91.97 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 80.86 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 96.7 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 109.64 kB - -
@sentry/browser (incl. Feedback) 47.51 kB - -
@sentry/browser (incl. sendFeedback) 35.05 kB - -
@sentry/browser (incl. FeedbackAsync) 40.15 kB - -
@sentry/browser (incl. Metrics) 31.01 kB - -
@sentry/browser (incl. Logs) 31.28 kB - -
@sentry/browser (incl. Metrics & Logs) 31.94 kB - -
@sentry/react 31.81 kB - -
@sentry/react (incl. Tracing) 54.5 kB - -
@sentry/vue 38.14 kB - -
@sentry/vue (incl. Tracing) 55.11 kB - -
@sentry/svelte 30.01 kB - -
@sentry/remix (Remix 3 client bundle) 57.19 kB - -
CDN Bundle 31.76 kB - -
CDN Bundle (incl. Tracing) 52.71 kB - -
CDN Bundle (incl. Logs, Metrics) 33.95 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 54.66 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 74.93 kB - -
CDN Bundle (incl. Tracing, Replay) 90.41 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 92.33 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 96.55 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 98.5 kB - -
CDN Bundle - uncompressed 93.51 kB - -
CDN Bundle (incl. Tracing) - uncompressed 156.36 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 100.06 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 162.33 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 230.28 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 276.71 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 282.66 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 290.41 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 296.35 kB - -
@sentry/nextjs (client) 57.38 kB - -
@sentry/sveltekit (client) 52.55 kB - -
@sentry/core/server 43.62 kB - -
@sentry/core/browser 13.81 kB - -
@sentry/node 153.78 kB -0.01% -1 B 🔽
@sentry/node/import (ESM hook with diagnostics-channel injection) 81.58 kB - -
@sentry/node - without tracing 95.32 kB - -
@sentry/node - without channel injection 134.43 kB -0.01% -3 B 🔽
@sentry/aws-serverless 103.48 kB -0.01% -1 B 🔽
@sentry/cloudflare (withSentry) - minified 195.52 kB - -
@sentry/cloudflare (withSentry) 486.37 kB - -
@sentry/nextjs/cloudflare (withSentry) - minified 216.19 kB - -

View base workflow run

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Devin Review found 5 findings. All 5 findings are left for you to triage below.

View findings in Devin Review

Devin Review

Comment on lines +265 to +270
if (existing and (existing["state"] != "open" or not baseline)) or (
baseline
and api.call(FORK, f"git/commits/{baseline}")["message"]
!= baseline_message
):
revision += 1

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Closed mirrors return as duplicate PRs

When a maintainer closes a mirror for a still-eligible update, replay skips the unchanged check for that revision. The next sync opens a duplicate PR and records the same dependency update again.

Learn more

The scheduled workflow invokes main without a PR list, so discovery keeps returning open and recently merged upstream PRs even after someone closes their local mirrors. Mirror loads closed mirrors as history, but replay advances past them before comparing their source marker and baseline fingerprint. This makes an unchanged, dismissed mirror look like a revision that has never been recorded.

Example: A maintainer reviews and closes a shadow PR for a dependency update merged yesterday. The next scheduled sync opens a replacement on the -r2 branches with the same upstream head, merge base, and recorder.

Recommended fix: Check whether the latest recorded revision still matches the upstream head, merge base, and recorder fingerprint before treating a closed mirror as grounds for a replacement. Add a test for closing an unchanged mirror and another for replaying a genuinely changed source revision after closure.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

Comment on lines +370 to +382
workflows = api.write(
"git/trees",
{
"tree": [
{
"path": WORKFLOW,
"mode": "100644",
"type": "blob",
"content": self.workflow,
}
]
},
)["sha"]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔍 Unrelated CI runs on shadow PRs

The live replay of getsentry#26684 ran Validate PR and failed that check. Replacing the workflow tree does not suppress this pull_request_target run.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

Comment on lines +344 to +351
def baseline_started(self, branch, sha):
query = urllib.parse.urlencode({"branch": branch, "head_sha": sha})
path = f"actions/workflows/{WORKFLOW}/runs?{query}"
for attempt in range(12):
if attempt:
time.sleep(5)
if self.api.call(FORK, path)["workflow_runs"]:
return True

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔍 Baseline capture is not verified

baseline_started accepts queued and cancelled runs before they produce evidence. The head can finish first, so the comparison depends on whether Garnet revisits it after the baseline arrives.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

Comment on lines +218 to +219
if pr["state"] != "open" and not recently_merged(pr):
return self.close(history, "source closed")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔍 Discovery cutoff closes existing mirrors

Once an upstream merge passes ten days, sync closes its open mirror. The scheduled pass includes existing open mirrors, so the cutoff affects retention as well as discovery.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

Comment on lines +175 to +176
raise ValueError("Unexpected Garnet recording checkout configuration")
return content

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟨 Dependency scripts share the recorder’s privileges

When a mirrored update installs a package with a lifecycle script, recording_workflow runs it directly on the recorder’s host. The package publisher’s code shares the job’s OIDC access and can interfere with runtime capture.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

@devin-ai-integration

Copy link
Copy Markdown

Devin Review

👀 5 findings for you to triage

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant