Skip to content

Harry/mmqa ff drift and create pr#230

Closed
LeVinhGithub wants to merge 4 commits into
MetaMask:mainfrom
LeVinhGithub:harry/MMQA-ff-drift-and-create-pr
Closed

Harry/mmqa ff drift and create pr#230
LeVinhGithub wants to merge 4 commits into
MetaMask:mainfrom
LeVinhGithub:harry/MMQA-ff-drift-and-create-pr

Conversation

@LeVinhGithub
Copy link
Copy Markdown
Contributor

@LeVinhGithub LeVinhGithub commented Mar 18, 2026


Note

Medium Risk
Adds new GitHub Actions automation that force-pushes a branch and opens PRs using a write-scoped token; misconfiguration could create noisy PRs or unintended repo writes.

Overview
Introduces automation to detect and respond to feature-flag registry drift between E2E and production.

Adds a reusable workflow (check-feature-flag-registry-drift.yml) that downloads drift artifacts, builds a PR description from report.json, commits the updated registry file to a dedicated qa/sync-ff-registry-* branch, and creates/labels a PR (or reuses an existing one).

Adds a composite action (feature-flag-drift-report) that formats and sends a Slack notification linking to the workflow run and, when available, the created sync PR.

Written by Cursor Bugbot for commit f785c08. This will update automatically on new commits. Configure here.

- Add feature-flag-drift-report action (Slack notification with optional pr-url)
- Add check-feature-flag-registry-drift reusable workflow (creates PR, outputs pr-url)
- Use download-artifact@v7 with explicit path for artifacts
- Use github.run_id and repository in branch name to avoid collisions
- Add registry file validation before cp
- Include repository in PR title

Made-with: Cursor
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

echo "has_changes=false" >> "$GITHUB_OUTPUT"
else
git commit -m "chore: sync feature flag registry from E2E"
git push --force-with-lease origin "$BRANCH"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Force-with-lease fails when remote branch already exists

Medium Severity

git push --force-with-lease will fail on subsequent workflow runs when the remote branch already exists. Since actions/checkout@v6 only fetches the default branch, there is no local remote-tracking ref for the drift branch. Without a tracking ref, --force-with-lease treats the expected remote value as null and rejects the push if the branch exists remotely. The existing-PR handling at the "Create Pull Request" step is never reached because the workflow fails at the push step first.

Additional Locations (1)
Fix in Cursor Fix in Web

else
MSG="${BASE}<${WORKFLOW_URL}|View workflow run>"
fi
PAYLOAD=$(jq -n --arg m "$MSG" '{text: $m, blocks: [{type: "section", text: {type: "mrkdwn", text: $m}}]}')
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Slack message shows literal \n instead of newlines

Low Severity

The \n sequences in the BASE and MSG bash variables are literal two-character strings (backslash + n), not actual newlines. When passed to jq --arg, each backslash is JSON-escaped to \\, producing \\n in the JSON output. After Slack's JSON parser decodes this, the text contains literal \n characters. Slack's mrkdwn format does not interpret these as line breaks, so the entire message renders as a single unformatted block.

Fix in Cursor Fix in Web

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant