Loading
Batch MR title, tracking table and plain-language failure reasons
Stack
Merge from the bottom up. Each MR targets the one below it.
- !266781 (merged) (top) <- you're here
- !266763 (merged) (bottom)
Why
The gap
- A batch merge request covers one lockfile, but today's title and description describe one dependency.
- Product asked that failures appear in plain language and never as the updater's raw error (Q5 on Allow users to batch dependency updates (gitlab-org#24196) • Philip Cunningham, Albina Yusupova • 19.7).
- The batch flow in Batched updates: admission-first scheduler, bat... (#635920) • Philip Cunningham • 19.7 needs a title, a tracking table and a reason for each failed row before it can open a batch merge request.
Why this approach
- Everything renders from plain structs, so the batch merge request service can fill them from the parsed output, and the specs need no database.
- The structs and
FailureReasondecide, and the helpers format, so the template only lays out the table. So the rules have unit specs, and the escaping lives in one layer. - Reasons map by the updater's error class, with a generic sentence for any class the map does not know, so a new error never leaks its raw text.
- A row the updater dropped after a resolver conflict, at
file_update, names the updated dependencies its reason mentions, matched without case, as the conflict spike recommended. The resolver's class,Dependabot::DependencyFileNotResolvable, takes that path. So doesDependabot::SharedHelpers::HelperSubprocessFailedwithfailed to select a versionin its message, which is how Cargo reports a conflict that names the dependency being updated. Any other reason atfile_updatekeeps its own sentence or the generic one. - Every package, version and file name renders through the existing
code_span, and a table cell escapes|, so updater text cannot break the table or run Markdown.
What
MergeRequestTitle.build_batch(lockfile_path, style: nil),Security: Update dependencies in <lockfile path>, which the single-dependency title parser does not match. A path too long for the 255-character title limit keeps its end, after an ellipsis. With a Conventional Commits style it readschore(deps): [security] update dependencies in <lockfile path>and keeps within 72 characters, like the single-dependency title.FailureReason, which returns plain data:text_for(reason)for the two Dependabot classes, the stale advisory, the four advisory outcomes and a generic text, andconflict?(reason, stage:)andconflicting_names(reason, updated_names)for a conflict.BatchDescription.render(lockfile_path:, rows:, updated_files:), with:Row,VulnerabilityandClosedEarlierstructs.Row#updated?is the one rule for an updated row,Row#reproposal?picks the rows that get the closed-earlier sentence, andRow#update_typegivesmajor,minor,patch, or nothing when a version is not dotted numbers.- The template
merge_request_batch_description.md.erb: a tracking table with Package, From, To, Type, Vulns and Status, the closed-earlier sentence for a re-proposal, and the changed files.
- Helpers beside
table_cell:failure_text, which formats a row's reason with each conflicting name in its table cell, andvulnerability_links, which links each vulnerability by its severity. MergeRequestTitle.build_batchis inscripts/lint/keela_excluded.ymluntil its first caller lands.- Nothing calls this code until Batched updates: admission-first scheduler, bat... (#635920) • Philip Cunningham • 19.7, and it sits behind the flag from the MR below. No changelog entry.
- The reason texts and the title are drafts. They need product's review of the wording before merge (Q5).
References
- Closes #635919 (closed)
- Epic: Allow users to batch dependency updates (gitlab-org#24196) • Philip Cunningham, Albina Yusupova • 19.7
- Plan: the implementation plan in the issue description
Manual QA
In a GDK Rails console:
su = DependencyManagement::SecurityUpdate
bd = su::BatchDescription
su::MergeRequestTitle.build_batch('api/Gemfile.lock') # => "Security: Update dependencies in api/Gemfile.lock"
su::MergeRequestTitle.parse_single_dependency(su::MergeRequestTitle.build_batch('Cargo.lock')) # => nil
su::MergeRequestTitle.build_batch("#{'a' * 1011}/Gemfile.lock").length # => 255
su::FailureReason.text_for('RuntimeError: Dependency not vulnerable!')
# => "The installed version is no longer affected by the advisory."
su::FailureReason.text_for('Dependabot::SomethingNew: details')
# => "The update could not be completed. The workload job log has the details."
helpers = ApplicationController.helpers
helpers.failure_text('Dependabot::DependencyFileNotResolvable: rack >= 3 is incompatible with Puma.',
stage: 'file_update', updated_names: %w[puma])
# => "Could not be updated together with `puma`."
helpers.failure_text('Dependabot::PrivateSourceTimedOut: registry.example.com', stage: 'file_update',
updated_names: %w[puma])
# => "A private package registry did not respond in time."
vulnerability = bd::Vulnerability.new(severity: 'critical', url: '/-/security/vulnerabilities/1563')
rows = [
bd::Row.new(package: 'nokogiri', from: '1.13.0', to: '1.19.4', vulnerabilities: [vulnerability]),
bd::Row.new(package: 'puma', from: '5.6.0', to: '6.0.0', vulnerabilities: [vulnerability],
closed_earlier: bd::ClosedEarlier.new(version: '5.6.9', merge_request_reference: '!8', closed_at: Time.utc(2026, 10, 20))),
bd::Row.new(package: 'rack', from: '2.2.3', to: nil, vulnerabilities: [vulnerability],
failure_reason: 'Dependabot::DependencyFileNotResolvable: rack >= 3 is incompatible with puma', failure_stage: 'file_update'),
bd::Row.new(package: 'evil|`name`', from: 'a1b2c3d', to: 'e4f5a6b', vulnerabilities: [vulnerability])
]
markdown = bd.render(lockfile_path: 'Gemfile.lock', rows: rows,
updated_files: [su::OutputParser::UpdatedFile.new(path: 'Gemfile.lock')])
puts markdown
# Every table row keeps its six cells once GitLab renders it:
Nokogiri::HTML.fragment(Banzai.render(markdown, project: Project.first)).css('table tr').map { |tr| tr.css('th, td').size }
# => [6, 6, 6, 6, 6]GDK result on cb754f8a:
| Check | Result |
|---|---|
| Batch title | Security: Update dependencies in api/Gemfile.lock, not parsed as a single-dependency title |
| Title for a 1,024-character path | 255 characters, ending in a/Gemfile.lock |
| Known, stale advisory and unknown reasons | The mapped text, the stale advisory text and the generic text, never the raw reason |
Conflict row at file_update, reason spelling Puma. |
"Could not be updated together with puma." |
Registry timeout at file_update |
Its own sentence, not the conflict text |
| Types | minor for 1.13.0 to 1.19.4, major for 5.6.0 to 6.0.0, none for a Git SHA |
Name holding | and backticks |
Renders as code, and every row keeps six cells in GitLab's Markdown |
| Re-proposal | The closed-earlier sentence under the table, naming 5.6.9, 2026-10-20 and !8 |
The description it renders, as Markdown source
## Security Dependency Updates
This merge request was automatically generated by **GitLab Dependency Management**
to remediate known security vulnerabilities in `Gemfile.lock`, in one commit.
| Package | From | To | Type | Vulns | Status |
|---------|------|----|------|-------|--------|
| `nokogiri` | `1.13.0` | `1.19.4` | minor | [critical](/-/security/vulnerabilities/1563) | Updated |
| `puma` | `5.6.0` | `6.0.0` | major | [critical](/-/security/vulnerabilities/1563) | Updated |
| `rack` | `2.2.3` | — | — | [critical](/-/security/vulnerabilities/1563) | Failed: Could not be updated together with `puma`. |
| `` evil\|`name` `` | `a1b2c3d` | `e4f5a6b` | — | [critical](/-/security/vulnerabilities/1563) | Updated |
`puma`: An earlier proposal at `5.6.9` was closed on 2026-10-20 in !8.
---
## Files Changed
- `Gemfile.lock`
> This MR was created by the GitLab Dependency Management service account.Edited by Albina Yusupova