dependabot / dependabot/dependabot-core

Swift: cooldown bypass due to non-semver tags aborting checks of semver tags

Open
#14,895 1 comment 1 reaction 0 assignees View on GitHub
cooldown L: javascript L: swift T: bug 🐞
Dominant language
Ruby
Stars
5.8k
Forks
1.5k
Avg merge
2d 18h
Merged PRs (30d)
149

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Package ecosystem

Swift

### Package manager version

_No response_

### Language version

_No response_

### Manifest location and content before the Dependabot update

_No response_

### dependabot.yml content

```
version: 2
updates:
- package-ecosystem: 'swift'
directories:
- '/' # Xcode project
- '/ProductCore' # Package.swift-based SPM module
schedule:
interval: 'daily'
cooldown:
default-days: 15
semver-major-days: 15
semver-minor-days: 15
semver-patch-days: 15
include:
- '*'
```

### Updated dependency

https://github.com/apple/swift-protobuf

### What you expected to see, versus what you actually saw

Log excerpt when trying to check `https://github.com/apple/swift-protobuf`:

```
2026-05-01T12:18:13.1800839Z updater | 2026/05/01 12:18:13 INFO Extracted release details: [#, #, #, #, …]
2026-05-01T12:18:13.1822217Z updater | 2026/05/01 12:18:13 ERROR Error checking if version is in cooldown: Malformed version number string protoc-artifactbundle-32.1
2026-05-01T12:18:13.1824055Z updater | 2026/05/01 12:18:13 INFO Latest version is 1.37.0
```

Similarly for `https://github.com/firebase/leveldb`:

```
2026-05-01T12:18:23.8226037Z updater | 2026/05/01 12:18:23 INFO Extracted release details: [#, #, #, #]
2026-05-01T12:18:23.8229996Z updater | 2026/05/01 12:18:23 ERROR Error checking if version is in cooldown: Malformed version number string CocoaPods-1.22.6
```

The cooldown is then bypassed and latest version is used.

Cause:

https://github.com/dependabot/dependabot-core/blob/a0a2daa5c1b9c8cf7f9c82bf3d84830f93aa44be/swift/lib/dependabot/swift/update_checker/latest_version_resolver.rb#L88-L98

`version_class.new(tag_with_detail.tag.delete("v"))` raises `Dependabot::Version::Malformed version number string protoc-artifactbundle-32.1` for non-semver tags. The exception propagates to the rescue at https://github.com/dependabot/dependabot-core/blob/a0a2daa5c1b9c8cf7f9c82bf3d84830f93aa44be/swift/lib/dependabot/swift/update_checker/latest_version_resolver.rb#L82-L85 in the outer loop.

Because https://github.com/dependabot/dependabot-core/blob/a0a2daa5c1b9c8cf7f9c82bf3d84830f93aa44be/swift/lib/dependabot/swift/package/package_details_fetcher.rb#L61 sorts tags lexically descending (`result_lines.sort_by(&:tag).reverse`), `protoc-artifactbundle-v32.1` sorts ahead of `1.37.0` and is hit first. The rescue returns the
partially-accumulated array (empty), so even valid semver tags that are in cooldown (`1.37.0`) never get flagged. Then the outer `latest_version_tag` https://github.com/dependabot/dependabot-core/blob/a0a2daa5c1b9c8cf7f9c82bf3d84830f93aa44be/swift/lib/dependabot/swift/update_checker/latest_version_resolver.rb#L66 calls `max_local_tag` on the unfiltered allowed-tags list and returns `1.37.0`.

(Disclosure: This cause analysis was LLM assisted.)

### Native package manager behavior

_No response_

### Images of the diff or a link to the PR, issue, or logs

_No response_

### Smallest manifest that reproduces the issue

_No response_

Contributor guide

Open the contributing guide

Research direction

Start in swift/lib/dependabot/swift/update_checker/latest_version_resolver.rb, especially latest_version_tag and the cooldown tag-processing loop, then inspect swift/lib/dependabot/swift/package/package_details_fetcher.rb for the tag ordering described. Verify that malformed non-semver tags no longer stop evaluation of later semver tags and that a cooled-down valid version is excluded from the selected update.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby, swift
Domain
devtools, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.