Skip to content

Restrict more patches to the platforms they can affect in build_platforms - #7758

Merged
marco-c merged 8 commits into
mozilla:masterfrom
marco-c:build-platforms-android-files
Dec 2, 2026
Merged

marco-c merged 8 commits into
mozilla:masterfrom
marco-c:build-platforms-android-files

Conversation

@marco-c

@marco-c marco-c commented Dec 1, 2026 •

Copy link
Copy Markdown
Collaborator

build_platforms gives the configuration selection the OS families a patch can break (configs of other families aren't candidates). Files no Searchfox build lists were considered built on every platform, so many Android-only and desktop-only patches weren't restricted. This adds rules for them, one per commit (after a first commit making the module's requests go through utils.get_session). The rules only apply to files no build lists, as the builds' lists are accurate.

Restricted pushes, of the 23,986 pushes of the group history (last 3,500 in parentheses):

Commit Rule Restricted pushes
base 3,933 (528)
1 Kotlin, Java and Gradle files (and gradle/) are only built on Android, except the HTML parser's Java code (translated to C++) +1,848 (+256)
2 browser/ files are only built on desktop, mobile/ ones only on Android, whatever their type (no Android build lists a browser/ file, no desktop build a mobile/ one), except YAML files +1,544 (+187)
3 Files the Android Gradle builds use out of mobile/ are also used on Android, although the Android build's index doesn't list them (e.g. Android Components packages browser/extensions/webcompat). They're the paths the Gradle files refer to from the source directory, found in the repository at boot and on refresh, and stored with the built files −31 (−1)
4 Only the YAML files of Glean's gecko_* lists are shared between the products (the other ones, e.g. desktop metrics, Fenix's Nimbus manifests, are only used by their product). They're fetched from mozilla-central's Glean index with the built files +658 (+86)
5 Browser-chrome tests (browser_* files of test directories), their manifests (browser*.toml) and the harness files only they use (browser-test.js, browser-harness.xhtml) only run on desktop, except in the web-platform tests. Their support files and helpers (e.g. head.js, BrowserTestUtils) can be used by other suites, so they aren't restricted +237 (+31)
6 Files which don't affect the tests' results (docs, linters and their type stubs, agent skills, Fluent migrations) don't count when a patch also modifies other files +208 (+40)
7 Build files (moz.build, jar manifests) get the platforms of their directory, like files of types the builds list (e.g. widget/gtk/moz.build → Linux). Test manifests don't, as their tests can run on platforms which don't build their directory's files +50 (+3)

In total, 35.2% of the pushes of the group history are restricted to some platforms (5,348 desktop-only, 2,474 Android-only), against 16.4%.

Failures fall back to the previous, more conservative behavior, and are reported (logged as warnings or errors, so sent to Sentry):

  • If the Glean index or the Gradle files can't be read, or yield nothing (e.g. if their format changes), the previous shared files and Gradle paths are kept. If they were never retrieved, every YAML file is considered shared, and the browser/ rule doesn't apply (7,404 restricted pushes instead of 8,447).
  • Paths the Gradle files don't refer to anymore are reported, e.g. if one is referred to in a way that isn't recognized.
  • Any other failure when finding a patch's platforms still makes its groups run on all configurations.

The benefit is mostly cost: offline evaluations showed no measurable catch gain from build_platforms, and desktop failures after Android-only pushes are almost always misattributed. The rules encode build facts (which builds include which files, where suites run), so they're hard rules rather than model features.

Not covered:

  • Test manifests by directory: e.g. dom/base/test/mochitest.toml would be desktop-only (its directory's built files are), although its tests also run on Android.
  • Desktop features in toolkit/ (e.g. ipprotection, ml, formautofill): the Android build packages them, so they can't be restricted from the build lists.
  • OS conditions in expectation files (web-platform test metadata, manifest annotations): they'd restrict ~0.6% of pushes (at most ~2%), and need the patch's diff.

@marco-c
marco-c force-pushed the build-platforms-android-files branch 4 times, most recently from 9b82eab to c0cdccd Compare December 2, 2026 09:24
As for bugbug's other requests, so that they're retried on transient errors (429 and 5xx responses).
…uild_platforms

No Searchfox build lists them, so they were considered built on every platform. They are only used by
the Android apps and libraries (Fenix, Focus, android-components, GeckoView), except the HTML
parser's Java code, which is translated to the C++ code built on every platform.

Of the last 3,500 pushes of the group history, 276 are now considered Android-only, against 21.
…s only on Android

No Android build lists a file of browser/, and no desktop build a file of mobile/, but their files of
types no build lists (e.g. .jsx, .ftl, test manifests) were considered built on every platform. YAML
files are still considered shared, as some are code generation inputs used by every product (e.g.
browser/base/content/metrics.yaml is in Glean's gecko_metrics). As the other rules, it only applies to
the files no build lists, as the builds' lists are accurate.

Of the last 3,500 pushes of the group history, 971 are now restricted to some platforms, against
784.
The Android Gradle builds also use files out of mobile/, which the Android build's index doesn't list:
e.g. Android Components packages the webcompat extension of browser/, which the previous commit
considered desktop-only. The paths they refer to from the source directory are found in the
repository when retrieving the built files, and stored with them.

If they can't be found, the previous ones are kept, and if they were never found, the browser/ files
keep their platforms (as some might be used on Android). Paths the Gradle builds don't refer to anymore
are reported (e.g. if a Gradle file refers to one in a way that isn't recognized anymore).
…the products

The other YAML files of browser/ and mobile/ (e.g. the desktop Glean metrics, Fenix's Nimbus feature
manifests, the vendoring manifests) are only used by their product. The shared ones are taken from
mozilla-central's Glean index when retrieving the built files, and stored with them. If they can't be
retrieved (or none are found, e.g. if the index can't be parsed anymore), the previous ones are kept,
and if they were never retrieved, every YAML file is still considered shared.

Of the last 3,500 pushes of the group history, 87 more are now restricted to some platforms.
Wherever they are, the browser-chrome tests (browser_* files of test directories), their manifests
(browser*.toml) and the harness files only they use (browser-test.js, browser-harness.xhtml) only run on
desktop, except in the web-platform tests. Their support files (e.g. head.js) and the helpers they import
(e.g. BrowserTestUtils, also used by chrome mochitests) can be used by other suites, so they're not
restricted.
… patch's platforms

Developer tools (agent skills, linters and the type stubs they use, Fluent migrations) and docs don't
affect the tests' results on any platform, so they don't count when a patch also modifies other files.
A patch only modifying them keeps their platforms.

Of the last 3,500 pushes of the group history, 30 more are now restricted to some platforms.
…ng the directory

A directory's moz.build and jar manifests are only read by the builds building the directory (e.g.
widget/gtk/moz.build on Linux), so they get the platforms of the files of their directory, as files of
types the builds list. Test manifests don't, as their tests can run on platforms which don't build the
files of their directory.

Of the 23,986 pushes of the group history, 51 more are now restricted to some platforms.
@marco-c
marco-c force-pushed the build-platforms-android-files branch from c0cdccd to fec2705 Compare December 2, 2026 09:33
@marco-c
marco-c marked this pull request as ready for review December 2, 2026 09:43
@marco-c
marco-c requested a review from a team as a code owner December 2, 2026 09:43
@marco-c
marco-c merged commit 55e63ac into mozilla:master Dec 2, 2026
12 of 13 checks passed
@marco-c
marco-c deleted the build-platforms-android-files branch December 2, 2026 09:43
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