豆豆友情提示:这是一个非官方 GitHub 代理镜像,主要用于网络测试或访问加速。请勿在此进行登录、注册或处理任何敏感信息。进行这些操作请务必访问官方网站 github.com。 Raw 内容也通过此代理提供。
Skip to content

Commit 6a9e3d1

Browse files
committed
Match release stability for dated Rust toolchain releases
1 parent b300d4d commit 6a9e3d1

File tree

2 files changed

+59
-0
lines changed

2 files changed

+59
-0
lines changed

rust_toolchain/lib/dependabot/rust_toolchain/update_checker/latest_version_finder.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,13 @@ def filter_by_version_type(releases)
7575
# Check that the release version is in the same channel type
7676
next unless release_channel.channel_type == current_type
7777

78+
# For DatedStability channels, also check that the stability levels match
79+
# e.g., "nightly-2025-08-19" should only match other "nightly-*" releases,
80+
# not "stable-*" or "beta-*" releases
81+
if current_type == ChannelType::DatedStability && release_channel.stability != current_channel.stability
82+
next
83+
end
84+
7885
next release unless release_channel.channel_type == ChannelType::Version
7986

8087
# For version channels, we need to ensure that the version format matches

rust_toolchain/spec/dependabot/rust_toolchain/update_checker/latest_version_finder_spec.rb

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,58 @@
179179
.to match_array(%w(nightly-2023-12-25))
180180
end
181181
end
182+
183+
context "when dependency requirement is a nightly dated channel with mixed stability releases" do
184+
let(:dependency_requirement) { "nightly-2025-08-19" }
185+
let(:dependency_version) { "nightly-2025-08-19" }
186+
let(:mock_versions) do
187+
[
188+
Dependabot::RustToolchain::Version.new("nightly-2025-08-01"),
189+
Dependabot::RustToolchain::Version.new("nightly-2025-08-19"),
190+
Dependabot::RustToolchain::Version.new("nightly-2025-08-20"),
191+
Dependabot::RustToolchain::Version.new("stable-2025-08-07"),
192+
Dependabot::RustToolchain::Version.new("stable-2025-08-14"),
193+
Dependabot::RustToolchain::Version.new("beta-2025-08-10"),
194+
Dependabot::RustToolchain::Version.new("1.72.0")
195+
]
196+
end
197+
198+
it "only includes nightly releases, not stable or beta releases" do
199+
package_details = version_finder.package_details
200+
filtered_releases = version_finder.send(:apply_post_fetch_latest_versions_filter, package_details.releases)
201+
202+
expect(filtered_releases.map { |x| x.version.to_s })
203+
.to match_array(%w(nightly-2025-08-01 nightly-2025-08-19 nightly-2025-08-20))
204+
expect(filtered_releases.map { |x| x.version.to_s })
205+
.not_to include("stable-2025-08-07", "stable-2025-08-14", "beta-2025-08-10", "1.72.0")
206+
end
207+
end
208+
209+
context "when dependency requirement is a stable dated channel with mixed stability releases" do
210+
let(:dependency_requirement) { "stable-2025-08-07" }
211+
let(:dependency_version) { "stable-2025-08-07" }
212+
let(:mock_versions) do
213+
[
214+
Dependabot::RustToolchain::Version.new("nightly-2025-08-01"),
215+
Dependabot::RustToolchain::Version.new("nightly-2025-08-19"),
216+
Dependabot::RustToolchain::Version.new("stable-2025-08-07"),
217+
Dependabot::RustToolchain::Version.new("stable-2025-08-14"),
218+
Dependabot::RustToolchain::Version.new("stable-2025-08-21"),
219+
Dependabot::RustToolchain::Version.new("beta-2025-08-10"),
220+
Dependabot::RustToolchain::Version.new("1.72.0")
221+
]
222+
end
223+
224+
it "only includes stable releases, not nightly or beta releases" do
225+
package_details = version_finder.package_details
226+
filtered_releases = version_finder.send(:apply_post_fetch_latest_versions_filter, package_details.releases)
227+
228+
expect(filtered_releases.map { |x| x.version.to_s })
229+
.to match_array(%w(stable-2025-08-07 stable-2025-08-14 stable-2025-08-21))
230+
expect(filtered_releases.map { |x| x.version.to_s })
231+
.not_to include("nightly-2025-08-01", "nightly-2025-08-19", "beta-2025-08-10", "1.72.0")
232+
end
233+
end
182234
end
183235

184236
describe "#apply_post_fetch_lowest_security_fix_versions_filter" do

0 commit comments

Comments
 (0)