Rate the monorepo's dependency bumps on what upstream ships

What does this MR do and why?

The MR Risk Labeler rates none of the dependency bot's merge requests today, and for a dependency change it rates the version number alone. This MR makes it rate gitlab-org/gitlab's dependency bumps by what they install. The production model, claude_sonnet_5_5_vertex, still decides every tier from the project's rubric: the flow adds no rule of its own, and decide_labels is main's, unchanged.

  1. The bot's merge requests are rated. The bot opens every bump from its fork, gitlab-renovate-forks/gitlab, and the gate refuses every fork. It now lets that one through when the bot is the author and the MR carries automation:bot-authored and maintenance::dependency. Only a project member can add those labels, the control the older flow's deps category relies on. Every other check still applies.

  2. instructions/278964/deps.md rates what a bump installs, not its version number. It rates the diff of the two published versions that the upstream block shows. There are no patch, minor, major or below-1.0.0 rules, and no named list of sensitive gems. It keeps what no version number decides: a hash mismatch, install-time code, code that fetches or runs code or reads secrets, a change to authentication, encryption, serialisation or request parsing, a replaced source, a checksum that moves under the same version, and at least medium for what no check reads (Go modules, Pipfiles, the *_VERSION files, and the language, runtime and tool pins).

  3. For a gem or npm bump, a step shows the rater what the two versions publish. For each package the lockfiles move, the check:

    • downloads both versions from rubygems.org or registry.npmjs.org;
    • says which hashes each version matches and does not match: the registry's, and each lockfile's;
    • unpacks a gem with RubyGems' own Gem::Package, and an npm tarball through RubyGems' tar reader, as npm unpacks it;
    • prints the new version's root and its whole gemspec or package.json, then git diff of the two versions.

    The rater reads that beside the MR's diff, and the rubric tells it what RubyGems and npm run at install. The check's code is read from the catalogue at HEAD, as the rules are, so the flow gains three steps and one input, and is still 40,887 of 40,960 bytes.

What the check does not decide

Nothing. It rates nothing, holds no list of risky packages, files or words, and does not work out what runs at install: the model does, from the metadata and the diff. Its logic is limited to:

  • reading lockfile lines, to know what to download;
  • downloading and comparing hashes;
  • unpacking with the installers' own code;
  • running git.

What it does not read, it names:

  • not read for a package added or in several versions, a gem from a path or a git remote, a git source whose revision moves, a yarn entry resolved elsewhere, or more than five packages;
  • not downloaded or not unpacked, with the reason;
  • cut, with the bytes not shown, for a block past 48 KiB, which still shows everything up to the cap;
  • not read first after the header, where a lockfile's path or the block holds text Duo's filters cut from the rater's input, or a tag that closes its frame. The header names such a lockfile by its file alone, so the filters cannot cut the header or the line under it.

The rubric rates each of those at least medium. docs/specs/mr-risk.md lists what the check does not cover.

Evidence it works

In the production sandbox. Every one of 45 real bot MRs was run through flows/mr-risk.yml's exact fetch_upstream command:

  • the sandbox was @anthropic-ai/sandbox-runtime@0.0.77, as gitlab-org/gitlab's .gitlab/duo/agent-config.yml installs it;
  • the network policy was that config's three domains;
  • Ruby 3.4, with no locale set;
  • the MRs were the 30 from the eval suite plus 15 opened between 10-28 and 11-05.

All 45 exited 0 with nothing on stderr, each in under 4 s:

Block MRs
whole, every version matching its hashes 18
cut at 48 KiB, every version matching its hashes 7
no registry package moves 2
not read: more than 5 packages 2
no gem or npm lockfile, so nothing printed 16

Inside that sandbox, a direct connection fails and the proxy refuses a request without credentials. The check therefore reads the proxy, and its credentials, from HTTPS_PROXY; Net::HTTP reads only http_proxy by itself. A host off the allowlist is refused. These runs were on macOS. The runner uses the same runtime on Linux, under bubblewrap, which only the first bump after the merge will exercise. The per-MR table is in the comment for bd89b62d.

Rated by the production model. bin/eval on claude_sonnet_5_5_vertex, on 36fd147e:

  • The 30 saved bot bumps against main, 3 passes each:

    • main approves 7 bumps the rubric sends to a person, and this MR rates all 7 medium or high in every pass, oj's changed extension high.
    • Two bumps approve:
      • simplecov's requirement line, with no package moving;
      • gitlab-orbit-proto 0.137.0 to 0.137.1, whose diff changes only its version strings and gemspec date. The version rules rated it medium for being below 1.0.0.
    • The two GITLAB_SHELL_VERSION bumps are medium, where main rates them high. No check reads a *_VERSION file, so with no diff to rate, a person reads them at medium.
    • The suite still labels its six bumps below 1.0.0 medium or high, from the rule this MR removes. So it counts orbit-proto's three low passes as wrong. The other five are medium or high in every pass.
  • 6 planted blocks, 3 passes each, all 18 as expected:

    • high in every pass:
      • an install script added;
      • an unchanged postinstall whose file now writes ~/.npmrc;
      • a checksum mismatch;
      • an extension's C source changed;
      • a RubyGems plugin added;
    • the clean control is low in every pass.
  • 3 crafted pin bumps, from !118 (merged), 3 passes each:

    Case main before !118 (merged) now
    .ruby-version 3.3.9 to 3.4.7 H3 H3 M3
    .nvmrc 22 to 24 H3 H3 M3
    .tool-versions: markdownlint-cli2 0.18.1 to 0.19.0 L3, approved M3 M3

    The *_VERSION and Go bumps, and the two controls, rate the same before and after it.

The per-MR sandbox table is in the comment for bd89b62d; 36fd147e, d6e7ad2f and 277726b3 print the same 45 blocks.

Size

+1,483 / −48 in 21 files, against +6,197 in 83 before:

  • upstream.rb is 442 lines, from 1,101;
  • its spec is 437, from 2,250 in three files.

The eval harness changes are out: they are !111 (closed)'s.

How to review

Eleven commits, in order, and the merge of !118 (merged) between the last two:

  1. Rate the dependency bot's merge requests from its fork.
  2. Take a merge request's labels with grep, which rubocop's Ruby 2.7 lint asks for: !106 (closed)'s one-line fix, so make check passes.
  3. Rate gitlab-org/gitlab's dependency changes by what installs: the rubric.
  4. Show the rater what a gem or npm bump installs: the check, its specs, the flow steps and the docs.
  5. Leave what installs to the rater, read from the metadata. The check stops naming hooks, summing the packages up in one status and looking up the area, and the rubric says what each installer runs.
  6. Say when Duo's filters would cut the block, and close the review's findings: the gem_lines hunk-header bug, the rules README's sentence, and three long comments.
  7. Rate a dependency bump by what its diff does, not its version number: Karan's review.
  8. Keep the upstream check whole through Duo's filters. 6's pattern held a comment opener, which the filters on the catalogue read would have cut the check at; a spec now holds the file to them.
  9. Scan the whole block for what Duo's filters cut, and name a git revision: Duo's second review. The scan missed the not read notes, and a GIT source whose revision moves read as no registry package moving.
  10. Rate a pinned runtime like any file no check reads: !118 (merged), merged here. It removes the runtime-pin rule, so a change to any pin file, runtime or tool, rates medium as unread.
  11. Name a lockfile by its file where its folder holds what Duo's filters cut: Duo's review of that merge. 9's scan still skipped the header, so a lockfile path holding a comment opener left the rater a header cut short and nothing under it.

make check passes.

Still open

  • Rollout. gitlab-org/gitlab's consumer is pinned to 1.3.0, so the pin has to move after this merges and is tagged.
  • decide_labels keeps an area's last answer line, so a later low can stand over an earlier high. That is main's code, and this MR does not touch it.
  • The 48 KiB cap. Seven of the 29 sandbox bumps with a gem or npm lockfile passed it, two by under 6 KB, and a cut block rates at least medium. The whole metadata takes 8 to 19 KB of it.
  • What no check reads rates medium, not high: gitlab-shell and KAS in the *_VERSION files, Go modules, Pipfiles, and the language, runtime and tool pins. With no diff to rate, a person reads them. main rates a runtime pin high.
  • Medium means a person here, because anything above low is manual-approve. If the bot ever approves medium, the rubric's "at least medium" lines have to say high.
  • For AppSec: gitlab-org/gitlab's agent config runs bundle install in its setup script, outside the sandbox.
  • CODEOWNERS. upstream.rb needs the same protection as instructions/, and this repository has none yet.

🤖 Generated with Claude Code

Edited by Connor Sanders

Merge request reports

Loading
Loading