Skip to content

Expose the regressor model through the http service API - #7517

Merged
marco-c merged 2 commits into
mozilla:masterfrom
marco-c:regressor-http-api
Nov 16, 2026
Merged

marco-c merged 2 commits into
mozilla:masterfrom
marco-c:regressor-http-api

Conversation

@marco-c

@marco-c marco-c commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

Adds two endpoints to classify commits with the regressor model:

  • GET /regressor/predict/commit/<branch>/<rev>: a single commit
  • POST /regressor/predict/commits/<branch> with {"commits": ["8ba995b74e18334ab3707f27e9eb8f4e37ba3d29", ...]}: up to 100 commits

Commits are identified by their full (40 characters) hg hash.

Like the push/bug endpoints, they answer 202 ({"ready": false}) until the results are available, then 200. autoland is accepted as a shorthand for integration/autoland. Results are cached per (model, branch, rev), and only the commits without a result are queued, in jobs of 25.

Each commit's result has node, bug_id, prob, index, class, risk_band, ignored_reason and extra_data:

  • unknown revisions and merges are {"available": false};
  • backouts and commits ignored by the model have ignored_reason ("backout" / "ignored") and are not scored.

Like test selection, the worker job pulls each commit into its autoland clone and mines them with repository.download_commits(save=False), reusing the commits DB and commit experiences the worker already loads for test selection, so features match training.

Known limitations:

  • Experience features of commits already in the experiences DB are computed as if they were new (they slightly overcount, as they include the commit itself and later ones). New commits (e.g. try pushes) are not affected.
  • risk_band is null when the REGRESSOR_RISK_BANDS secret is not set for the service.
  • No feature importance (it would need the training X/y datasets on the worker).

Unrelated: /swagger is already broken on master, see #7516.

The job pulls the given commits (by full hash) from a hg.mozilla.org
branch, mines them like the commits DB without storing them, and stores
the result of each commit. Backouts and commits ignored by the model are
listed with their ignored_reason but not scored, unknown revisions and
merges are marked as not available.
GET /<model>/predict/commit/<branch>/<rev> classifies a single commit, and
POST /<model>/predict/commits/<branch> with {"commits": [...]} classifies
up to 100 commits at once. Like the other endpoints, they answer 202 until
the results are available, and only the commits without a result are
queued.
@marco-c
marco-c marked this pull request as ready for review November 16, 2026 21:26
@marco-c
marco-c requested a review from a team as a code owner November 16, 2026 21:26
@marco-c
marco-c merged commit ae736e6 into mozilla:master Nov 16, 2026
13 checks passed
@marco-c
marco-c deleted the regressor-http-api branch November 16, 2026 21:29
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