Backport checker: skip irrelevant paths, resolve bot-authored PR attribution - #211
Open
claude[bot] wants to merge 2 commits into
Open
Backport checker: skip irrelevant paths, resolve bot-authored PR attribution#211claude[bot] wants to merge 2 commits into
claude[bot] wants to merge 2 commits into
Conversation
…R attribution Two improvements to the frontend backport checker requested by Christian: - Skip PRs whose changed files are ALL under an editable ignore list (apps/website, .github/**, CI/lint tooling config) — a PR touching anything else is still flagged as before. - When a PR is authored by a bot (claude[bot], comfy-pr-bot, cloud-code-bot[bot], ...), resolve the real human to tag: first via a Co-authored-by commit trailer, falling back to this workspace's "_Requested by **Name**_" PR-description attribution convention, matched against the Notion People database by name. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V2TbWrYdYkEfK5qx8m5MXx
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…SLACK_BOT_TOKEN bun test runs all spec files in one shared process, so the fake SLACK_BOT_TOKEN set at module scope in lib/notion/people.spec.ts was leaking into every spec file that ran afterward. That made lib/slack/daily.spec.ts's "do we have a real Slack token" check pass, triggering its real Slack API integration tests, which failed with invalid_auth against the fake token (4 failing tests, breaking the run_comfy_pr CI check on this PR). Save and restore NOTION_TOKEN, GH_TOKEN_COMFY_PR_BOT, and SLACK_BOT_TOKEN in an afterAll hook so this spec file's env stubbing stays scoped to itself. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V2TbWrYdYkEfK5qx8m5MXx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested via Slack thread
What changed
Two improvements to
app/tasks/gh-frontend-backport-checker/index.ts, per Christian's Slack request:1. Skip PRs that only touch irrelevant paths
A bugfix PR is now skipped (not flagged as "might need backport") when every one of its changed files matches an ignore-path glob. If it touches anything else too, it's still flagged as before — this only suppresses PRs that are 100% out of scope.
The ignore list is an exported, easily-editable array (
IGNORED_BACKPORT_PATH_GLOBS) near the top of the file:I inspected the
ComfyUI_frontendrepo layout to build this list —apps/website(Astro marketing site) andapps/desktop-ui(a real product, kept in scope) are the twoapps/*packages;.github/workflows/holds ~30 CI/CD pipelines. Changed files are fetched viapulls.listFiles(paginated with the existingghPageFlowhelper).Flag for Christian: I deliberately did not add
apps/desktop-ui— it's a real shipped app, not "irrelevant" — but wanted to call that out explicitly in case you meant to include it too. Also open to trimming/expanding the tooling-config file list; it's just an array, easy to adjust.2. Resolve bot-authored PR attribution
When a PR's author is a bot/automation account (
claude[bot],comfy-pr-bot,cloud-code-bot[bot],dependabot[bot], ... — detected viaisBotLogin(), reusing the existing bot-comment-filter regex), the checker now tries to resolve the real human to tag:Co-authored-by:trailer on the PR's commits (pulls.listCommits) — if the trailer's email is a GitHub noreply address (123+login@users.noreply.github.com), the embedded login is used directly; otherwise the trailer's name is matched against the Notion People database._Requested by **Name**_near the top of the PR body (added by whatever opens these PRs on someone's behalf), matched by name against the Notion People database.resolveSlackTagForAuthorpipeline already can't map to a Slack user, so it already falls through to tagging the release sheriff (unchanged).What justified this, from inspecting the two example PRs:
claude[bot], single commit authored byClaude <noreply@anthropic.com>with noCo-authored-by:trailer. Body starts with_Requested by **nav** · [Slack thread](...)_. So resolution here comes entirely from the body-attribution fallback, matching"nav"→ Notion People row withUniqueIDtitle"Nav"→ GitHub usernamenav-tej→ SlackU0AMJURRLKV.claude[bot]-authored, single commit, no co-author trailer, body starts with_Requested by **Christian Byrne** · [Slack thread](...)_→ matches Notion rowchristian-byrne→ SlackU087MJCDHHC.Neither example actually has a
Co-authored-by:trailer, so the co-author path is implemented per the request ("try to find co-author... fall back to attribution") but untested against a real example — I added unit test coverage for its parsing logic (noreply-email login extraction, trailer regex) using synthetic fixtures instead.To make the name → GitHub-username matching possible, I extended
lib/notion/people.ts:PersonMappinggained anamefield sourced from the row'sUniqueID(title) column — needed because thenav-tejrow has no linked NotionPerson(that field was empty), so the title column is the only place "Nav" appears.findGithubUsernameByPersonName(name)matches case-insensitively on full name or first-name-only (e.g. "Christian" → "Christian Byrne"), skipping inactive rows — mirrors the existingfindSlackIdByGithubUsernameconventions.Flag for Christian: the fallback order (co-author trailer, then body attribution, then existing bot-login-falls-through-to-sheriff behavior) matches your message, but worth double-checking that's the priority you want — and whether
comfy-pr-bot/cloud-code-bot[bot]should even be treated as "bot" for this purpose (their PRs are automated release/CI bumps with no human requester, so the fallback will just find nothing and fall through harmlessly, but flagging in case you'd rather scope this toclaude[bot]only).Testing
bun run typecheck(tsgo) — cleanbun run lint(oxlint) — 0 warnings/errors on changed files (pre-existing warnings elsewhere in the repo are unrelated)bun run fmt(oxfmt) — cleanbun test app/tasks/gh-frontend-backport-checker/ lib/notion/— 107 pass, 0 failindex.spec.ts, including fixtures built from the real bodies of PR #14206 and #15342.lib/notion/people.spec.ts(new — no prior test file existed) coveringfindGithubUsernameByPersonName, mocking the Notion client per the pattern already used inapp/tasks/gh-priority-sync/index.spec.ts.No live Slack/Notion/GitHub calls were made by this change; nothing was posted to Slack or Notion as part of this work.
Generated by Claude Code