Skip to content

feat: add draft Segment schema PR workflow - #37219

Merged
NicolasMassart merged 21 commits into
mainfrom
feat/mcwp-575-draft-segment-schema-pr
Oct 23, 2026
Merged

NicolasMassart merged 21 commits into
mainfrom
feat/mcwp-575-draft-segment-schema-pr

Conversation

@NicolasMassart

@NicolasMassart NicolasMassart commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Description

Adds a helper workflow that reads analytics TypeScript changes on a pull request and can open one draft pull request on Consensys/segment-schema after the author agrees. It is not a merge gate.

The action is pinned to github-tools v1.21.0 (5d993ac935eff3f248d2213bb2d6922ce9cb3510). propose and close run only when app/**/*.ts or app/**/*.tsx changes, excluding tests and snapshots. create runs only after this file is on the default branch.

Changelog

CHANGELOG entry: null

Related issues

fixes MCWP-910
related to MCWP-575
Shipped in github-tools v1.21.0.

Manual testing steps

This pull request only adds a workflow file, so propose does not run here.

After merge:

  1. Open a ready, same-repo pull request that changes a non-test file under app/ and includes an analytics event change.
  2. Confirm the propose job posts one sticky comment and does not open a schema pull request yet.
  3. As the pull request author, comment with the first line I agree to open a draft Segment schema PR.
  4. Confirm did-user-agree-to-create-pr, then is-cross-repo-pr, then create open one draft on Consensys/segment-schema.
  5. Close the client pull request without merging and confirm the schema draft is closed. Reopen that schema pull request manually if the branch should be kept.

Screenshots/Recordings

N/A

Before

N/A

After

N/A

Pre-merge author checklist

Performance checks (if applicable)

  • I've tested on Android
    • Ideally on a mid-range device; emulator is acceptable
  • I've tested with a power user scenario
    • Use these power-user SRPs to import wallets with many accounts and tokens
  • I've instrumented key operations with Sentry traces for production performance metrics

For performance guidelines and tooling, see the Performance Guide.

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Made with Cursor


Note

Medium Risk
Introduces cross-repo GitHub App writes to Consensys/segment-schema and comment-triggered automation; misconfiguration or race conditions could create or close the wrong draft PRs, but it is opt-in and not a merge gate.

Reviewed by Cursor Bugbot for commit 8974db0. Bugbot is set up for automated code reviews on this repo. Configure here.

Propose, create, and close a Consensys/segment-schema draft from analytics TypeScript changes after the author agrees.

Co-authored-by: Cursor <cursoragent@cursor.com>
@NicolasMassart NicolasMassart self-assigned this Oct 6, 2026
@github-actions github-actions Bot added the pr-not-ready-for-e2e Skip E2E and block merging. Remove this label once the PR is ready to run the E2E tests. label Oct 6, 2026
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

Remove DRAFT_SCHEMA_PR_WORKFLOW_TEST before merging this pull request.

Co-authored-by: Cursor <cursoragent@cursor.com>
@NicolasMassart NicolasMassart added the DO-NOT-MERGE Pull requests that should not be merged label Oct 6, 2026
@NicolasMassart
NicolasMassart marked this pull request as ready for review October 6, 2026 14:49
@NicolasMassart
NicolasMassart requested a review from a team as a code owner October 6, 2026 14:49

@cursor cursor Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

Comment thread .github/workflows/draft-segment-schema-pr.yml
Comment thread app/core/Analytics/MetaMetrics.events.ts Outdated
Comment thread .github/workflows/draft-segment-schema-pr.yml Outdated
@codecov-commenter

codecov-commenter commented Oct 6, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.80%. Comparing base (288b50b) to head (21a7903).
⚠️ Report is 24 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #37219      +/-   ##
==========================================
+ Coverage   86.77%   86.80%   +0.02%     
==========================================
  Files        7634     7646      +12     
  Lines      216833   217247     +414     
  Branches    54183    54328     +145     
==========================================
+ Hits       188165   188571     +406     
+ Misses      16870    16862       -8     
- Partials    11798    11814      +16     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

GitHub rejects paths and paths-ignore on the same pull_request event, so the workflow never queued.

Co-authored-by: Cursor <cursoragent@cursor.com>
@metamask-ci

metamask-ci Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

PR template — items to address before "Ready for review"

Warnings — informational, address before merging:

  • Related issues section is empty. Add Fixes: #123 / Closes: <URL> / Refs: <Jira key>, or write a short rationale after the colon.

See docs/readme/ready-for-review.md for the full Definition of Ready for Review.

Schema reads and writes use this token, so it must be that installation.

Co-authored-by: Cursor <cursoragent@cursor.com>

@cursor cursor Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

Comment thread .github/workflows/draft-segment-schema-pr.yml
The gate lists schema pull requests with the Consensys app token.

Co-authored-by: Cursor <cursoragent@cursor.com>
github-script already injects getOctokit, so the previous pin failed to start.

Co-authored-by: Cursor <cursoragent@cursor.com>
A merge emits closed as well. This job closes the schema draft only for an unmerged close.

Co-authored-by: Cursor <cursoragent@cursor.com>
The Consensys app token requests contents, pull requests, and issues write. The agreement jobs set an explicit GITHUB_TOKEN scope.

Co-authored-by: Cursor <cursoragent@cursor.com>
Comment thread .github/workflows/draft-segment-schema-pr.yml
jvbriones
jvbriones previously approved these changes Oct 22, 2026
joaoloureirop
joaoloureirop previously approved these changes Oct 23, 2026

@joaoloureirop joaoloureirop left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

suggestion (non-blocking): path filter skips JavaScript analytics call sites

This only starts propose and close for app/**/*.ts and app/**/*.tsx. A PR that only edits a .js call site never gets a proposal. analytics.trackEvent is still in JS, for example app/actions/settings/index.js, app/components/UI/AccountOverview/index.js, and app/core/RPCMethods/wallet_addEthereumChain.js.

create does not use this filter, so the agreement comment can still open a schema draft, and closing the client PR unmerged will leave it open.

Could we add app/**/*.js? !**/*.test.* already skips *.test.js. If the pinned action cannot parse JS, a note in the comment above is enough.

      - 'app/**/*.ts'
      - 'app/**/*.tsx'
      - 'app/**/*.js'
      - '!**/*.test.*'
      - '!**/*.spec.*'
      - '!**/__snapshots__/**'

@github-project-automation github-project-automation Bot moved this from Needs dev review to Review finalised - Ready to be merged in PR review queue Oct 23, 2026
@NicolasMassart
NicolasMassart added this pull request to the merge queue Oct 23, 2026
@NicolasMassart NicolasMassart removed the DO-NOT-MERGE Pull requests that should not be merged label Oct 23, 2026
@NicolasMassart

Copy link
Copy Markdown
Contributor Author

@joaoloureirop followup PR on #38133

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 23, 2026
@NicolasMassart
NicolasMassart added this pull request to the merge queue Oct 23, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 23, 2026
<!--
Please submit this PR as a draft initially.

Do not mark it as "Ready for review" until this PR meets the canonical
Definition of Ready For Review in `docs/readme/ready-for-review.md`.

In short: the template must be materially complete (not just section
titles
present), all status checks must be currently passing, and the only
expected
follow-up commits must be reviewer-driven.
-->
<!--
mms-check directive vocabulary — read by
.github/scripts/shared/pr-template-checks.ts
at module load to build the validation plan. Directives are invisible in
rendered
markdown and must NOT be removed or edited without updating the
validator registry.

  type=text           Section must contain non-placeholder prose.
  type=changelog      Section must have a valid CHANGELOG entry: line.
type=issue-link Section must have a Fixes:/Closes:/Refs: line with a
value.
type=manual-testing Section must have real testing steps or an explicit
N/A.
type=screenshot Section must have evidence (image/URL) or an explicit
N/A.
type=checklist Section must have all checkboxes consciously checked.
required=true|false Whether a missing/invalid section runs the validator
at all.
blocking=true|false Whether a failure of this check fails the CI
workflow.
Default: false — failures are shown as warnings in the sticky
                      comment but do not block the PR.

Sections without a directive are checked for structural presence only.
-->

## **Description**

<!-- mms-check: type=text required=true -->

<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->

`propose` and `close` now start for product `app/**/*.js` as well as
`.ts` and `.tsx`. `!**/*.test.*` already skips `*.test.js`. This covers
JavaScript `analytics.trackEvent` call sites such as
`app/actions/settings/index.js`,
`app/components/UI/AccountOverview/index.js`, and
`app/core/RPCMethods/wallet_addEthereumChain.js`.

This responds to the path-filter review on
#37219 (review).
This branch starts at the head of that pull request and leaves its
branch unchanged.

## **Changelog**

<!-- mms-check: type=changelog required=true blocking=true -->

<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`

If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`

(This helps the Release Engineer do their job more quickly and
accurately)
-->

CHANGELOG entry: null

## **Related issues**

<!-- mms-check: type=issue-link required=true -->

Fixes: followup of
#37219

## **Manual testing steps**

<!-- mms-check: type=manual-testing required=true -->

N/A — workflow path comment only.

## **Screenshots/Recordings**

<!-- mms-check: type=screenshot required=true -->

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

N/A

### **After**

N/A

## **Pre-merge author checklist**

<!-- mms-check: type=checklist required=true -->

<!--
Every checklist item must be consciously assessed before marking this PR
as
"Ready for review". A checked box means you deliberately considered that
responsibility, not that you literally performed every action listed.

Unchecked boxes are ambiguous: they are not an implicit "N/A" and they
are not
a silent "skip". See `docs/readme/ready-for-review.md` for the full
checklist
semantics.
-->

- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I've included tests if applicable
- [x] I've documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I've applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

#### Performance checks (if applicable)

- [x] I've tested on Android
  - Ideally on a mid-range device; emulator is acceptable
- [x] I've tested with a power user scenario
- Use these [power-user
SRPs](https://consensyssoftware.atlassian.net/wiki/spaces/TL1/pages/edit-v2/401401446401?draftShareId=9d77e1e1-4bdc-4be1-9ebb-ccd916988d93)
to import wallets with many accounts and tokens
- [x] I've instrumented key operations with Sentry traces for production
performance metrics
- See [`trace()`](/app/util/trace.ts) for usage and
[`addToken`](/app/components/Views/AddAsset/components/AddCustomToken/AddCustomToken.tsx#L274)
for an example

For performance guidelines and tooling, see the [Performance
Guide](https://consensyssoftware.atlassian.net/wiki/spaces/TL1/pages/400085549067/Performance+Guide+for+Engineers).

## **Pre-merge reviewer checklist**

<!--
Reviewer checklist items follow the same semantics as the author
checklist: an
unchecked box is ambiguous, a checked box means the reviewer consciously
assessed that responsibility. See `docs/readme/ready-for-review.md`.
-->

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> CI path-filter change only; no runtime or security-sensitive code is
modified.
> 
> **Overview**
> Extends the **draft Segment schema PR** workflow so it runs on product
JavaScript under `app/`, not only `.ts` and `.tsx`.
> 
> Adds `app/**/*.js` to the `pull_request` `paths` filter in
`draft-segment-schema-pr.yml` and updates the inline comment
accordingly. Existing negated globs (`!**/*.test.*`, etc.) still apply,
so test JS is not included. **`propose`** and **`close`** jobs can now
start when analytics-related JS files change (e.g. legacy
`analytics.trackEvent` call sites).
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
88d4352. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
@sonarqubecloud

Copy link
Copy Markdown

@NicolasMassart
NicolasMassart added this pull request to the merge queue Oct 23, 2026
Merged via the queue into main with commit 3742a4a Oct 23, 2026
97 of 98 checks passed
@NicolasMassart
NicolasMassart deleted the feat/mcwp-575-draft-segment-schema-pr branch October 23, 2026 15:57
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 23, 2026
@metamask-ci metamask-ci Bot added the release-8.19.0 Issue or pull request that will be included in release 8.19.0 label Oct 23, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-8.19.0 Issue or pull request that will be included in release 8.19.0 size-M

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

5 participants