Repository navigation
ci(garnet): Shadow-mirror upstream dependency PRs - #105
Conversation
|
I'll fix CI failures and address comments from users with write access that start with 'Devin'.
|
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.
|
| if (existing and (existing["state"] != "open" or not baseline)) or ( | ||
| baseline | ||
| and api.call(FORK, f"git/commits/{baseline}")["message"] | ||
| != baseline_message | ||
| ): | ||
| revision += 1 |
There was a problem hiding this comment.
🟡 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.
Was this helpful? React with 👍 or 👎 to provide feedback.
| workflows = api.write( | ||
| "git/trees", | ||
| { | ||
| "tree": [ | ||
| { | ||
| "path": WORKFLOW, | ||
| "mode": "100644", | ||
| "type": "blob", | ||
| "content": self.workflow, | ||
| } | ||
| ] | ||
| }, | ||
| )["sha"] |
There was a problem hiding this comment.
🔍 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.
Was this helpful? React with 👍 or 👎 to provide feedback.
| 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 |
There was a problem hiding this comment.
| if pr["state"] != "open" and not recently_merged(pr): | ||
| return self.close(history, "source closed") |
There was a problem hiding this comment.
🔍 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.
Was this helpful? React with 👍 or 👎 to provide feedback.
| raise ValueError("Unexpected Garnet recording checkout configuration") | ||
| return content |
There was a problem hiding this comment.
🟨 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.
Was this helpful? React with 👍 or 👎 to provide feedback.
Devin Review👀 5 findings for you to triage |
Adds a replay-only shadow mirror so upstream
getsentry/sentry-javascriptdependency PRs run through the stock Garnet path here: thegarnet-record.ymlrecorder, the Garnet App's Runtime Review comment, and the gate's ownpr_reviewcomment. 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.shadow/base/<n>, upstream head →shadow/pr/<n>, opened as a normal PR. Onlygarnet-record.ymlis kept under.github/workflows, withshadow/base/**push andworkflow_dispatchadded so the baseline records. Nothing is written upstream..github/workflows/garnet-shadow-mirror.yml: runs every 30 min plusworkflow_dispatch, using theSHADOW_MIRROR_TOKENsecret (Contents, Pull requests, Actions, Workflows write). Unit tests run on PRs..github/workflows/merge-gate.ymland.github/merge-gate/gate.py, which aren't part of the standard user path; gate verdicts come frompr_reviewas the gate's own comment. Ifmerge-gateis a required status check in branch protection, remove it there too.Tests:
python3 -m unittest discover -s .github/scripts/shadow_mirror(16 pass) andactionlint. Live runs on upstream getsentry#26684 → #103 and getsentry#26672 → #104.Implemented in session Shadow mirror sentry-javascript dependency PRs
Review with Devin · Open in Devin Desktop