kettle-dev 3.1.30 → 3.1.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 62eace57495f2a0d160543da47ecf374a614cf628d103af9130229ab6b4ed017
4
- data.tar.gz: ddc207d797d064743fdf5c450d704dd344a7ab2f5b11bdc7bc97c08b8c388fd0
3
+ metadata.gz: 303fb467106510d7b721c570c3e37269a81ddd18c70d5208857f5e0b6dcb9e8d
4
+ data.tar.gz: 2e7f824acb72e33999dcb9a417b046d40231103f6bc0ff81a60a26b29a1a5bb6
5
5
  SHA512:
6
- metadata.gz: 2b250c0d33c91d78d78512497ef1270b8f80d45a2cc8d229f41a33d7cb452e663a3d12b34280f41e5543d8c08df10fd5fa310ceea5879b96f8d58b46e5b78d08
7
- data.tar.gz: 0e74a3a7ecfa10e808826b46ae67d37a4288ff151b6af314ca74085471634ec88fb2007e0566a852011cca628e807a0adb7c5f01b5562a4296274a9aa691a54b
6
+ metadata.gz: 862bf474d7cbabae096a053da2fd561a3b5bbca3457774cede01855c07a4fcc6f7248dbe2de1dfa8b37cb534eee9058d9b1c84e71ee86244e057d8ac7cc64baf
7
+ data.tar.gz: 66ce63717d0cc434a95ce16bf547033cef186d66570344115e49ed2f0163a7edfd2f1d87a09c3717cab118e00317613c31c06f6418fc0eca3eeef1735443ba83
checksums.yaml.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -30,6 +30,35 @@ Please file a bug if you notice a violation of semantic versioning.
30
30
 
31
31
  ### Security
32
32
 
33
+ ## [3.1.32] - 2026-11-26
34
+
35
+ - TAG: [v3.1.32][3.1.32t]
36
+ - COVERAGE: 92.07% -- 6013/6531 lines in 50 files
37
+ - BRANCH COVERAGE: 76.16% -- 2300/3020 branches in 50 files
38
+ - 55.92% documented
39
+
40
+ ### Fixed
41
+
42
+ - release: a plain `gem push` that RubyGems rejects for an invalid OTP is retried up to three times, each time asking the secrets provider (and so the user) for a fresh code, instead of aborting after RubyGems' own single re-prompt; only the `bundle exec rake release` path had a kettle-level retry before
43
+
44
+ ## [3.1.31] - 2026-11-20
45
+
46
+ - TAG: [v3.1.31][3.1.31t]
47
+ - COVERAGE: 91.93% -- 5994/6520 lines in 50 files
48
+ - BRANCH COVERAGE: 76.01% -- 2294/3018 branches in 50 files
49
+ - 55.84% documented
50
+
51
+ ### Added
52
+
53
+ - BundlerPinning RubyGems pair lookups: installed_rubygems (gem -v) and published_stable_rubygems (latest stable rubygems-update the registry serves, prereleases rejected, fail-open on outage), with a RUBYGEMS_HELD_VERSIONS registry mirroring HELD_VERSIONS — the RubyGems half of the matched Bundler/RubyGems pair
54
+
55
+ ### Fixed
56
+
57
+ - Stop requiring Bundler at load time in BundlerPinning (require it at the point of use): loading Bundler activates the default Bundler, whose vendored uri clashes with RubyGems' own vendored copy and floods stderr with Gem::URI double-initialization warnings on every CLI invocation once Bundler 4.x is the machine default
58
+ - GitHub CI monitoring events now report a consistent `completed` count (passed + failed) within a run, including the failure event itself.
59
+
60
+ - Release is now cold-start safe for borrowed bundles: the changelog step's tool bundle (kettle-changelog's release gemfile) and the member coverage bundle are installed via bundle install before the changelog exec, each against a disposable lockfile under tmp/kettle-release/lockfiles so canonical lockfiles never change. Previously a fresh gem home (e.g. after a Ruby upgrade) died mid-publish with Bundler::GemNotFound for gems those borrowed bundles pin. Fixes #67
61
+
33
62
  ## [3.1.30] - 2026-11-19
34
63
 
35
64
  - TAG: [v3.1.30][3.1.30t]
@@ -4368,7 +4397,11 @@ Please file a bug if you notice a violation of semantic versioning.
4368
4397
  - Selecting will run the selected workflow via `act`
4369
4398
  - This may move to its own gem in the future.
4370
4399
 
4371
- [Unreleased]: https://github.com/kettle-dev/kettle-dev/compare/v3.1.30...HEAD
4400
+ [Unreleased]: https://github.com/kettle-dev/kettle-dev/compare/v3.1.32...HEAD
4401
+ [3.1.32]: https://github.com/kettle-dev/kettle-dev/compare/v3.1.31...v3.1.32
4402
+ [3.1.32t]: https://github.com/kettle-dev/kettle-dev/releases/tag/v3.1.32
4403
+ [3.1.31]: https://github.com/kettle-dev/kettle-dev/compare/v3.1.30...v3.1.31
4404
+ [3.1.31t]: https://github.com/kettle-dev/kettle-dev/releases/tag/v3.1.31
4372
4405
  [3.1.30]: https://github.com/kettle-dev/kettle-dev/compare/v3.1.29...v3.1.30
4373
4406
  [3.1.30t]: https://github.com/kettle-dev/kettle-dev/releases/tag/v3.1.30
4374
4407
  [3.1.29]: https://github.com/kettle-dev/kettle-dev/compare/v3.1.28...v3.1.29
data/README.md CHANGED
@@ -1034,7 +1034,7 @@ Thanks for RTFM. ☺️
1034
1034
  [📌gitmoji]: https://gitmoji.dev
1035
1035
  [📌gitmoji-img]: https://img.shields.io/badge/gitmoji_commits-%20%F0%9F%98%9C%20%F0%9F%98%8D-34495e.svg?style=flat-square
1036
1036
  [🧮kloc]: https://www.youtube.com/watch?v=dQw4w9WgXcQ
1037
- [🧮kloc-img]: https://img.shields.io/badge/KLOC-6.489-FFDD67.svg?style=for-the-badge&logo=YouTube&logoColor=blue
1037
+ [🧮kloc-img]: https://img.shields.io/badge/KLOC-6.531-FFDD67.svg?style=for-the-badge&logo=YouTube&logoColor=blue
1038
1038
  [🔐security]: https://github.com/kettle-dev/kettle-dev/blob/main/SECURITY.md
1039
1039
  [🔐security-img]: https://img.shields.io/badge/security-policy-259D6C.svg?style=flat
1040
1040
  [📄copyright-notice-explainer]: https://opensource.stackexchange.com/questions/5778/why-do-licenses-such-as-the-mit-license-specify-a-single-year
@@ -1,6 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "bundler"
3
+ # NOTE: `bundler` is deliberately NOT required at load time. This file is on
4
+ # the kettle CLI load path (kettle-family requires it eagerly), and loading
5
+ # Bundler activates the DEFAULT Bundler — whose vendored `uri` clashes with
6
+ # RubyGems' own vendored copy (the Gem::URI double-initialization warning
7
+ # wall on stderr) whenever the default Bundler is 4.x. Methods require it at
8
+ # the point of use instead, so plain CLI invocations never load Bundler.
4
9
  require "fileutils"
5
10
  require "rubygems/dependency_installer"
6
11
 
@@ -18,6 +23,11 @@ module Kettle
18
23
  module BundlerPinning
19
24
  RUBYGEMS_SOURCE = "https://rubygems.org"
20
25
 
26
+ # The gem whose versions track RubyGems itself. Bundler and RubyGems
27
+ # release as a matched pair (same version, same day), so this is the
28
+ # other half of every Bundler version question.
29
+ RUBYGEMS_UPDATE_GEM = "rubygems-update"
30
+
21
31
  # Known-bad STABLE Bundler versions the toolchain must never select, as
22
32
  # version String => reason. Prereleases need no entries — every lookup
23
33
  # already rejects them (the 4.1.0.betaN infection vector). Add an entry
@@ -26,6 +36,10 @@ module Kettle
26
36
  # same idea for dependency floors.
27
37
  HELD_VERSIONS = {}.freeze
28
38
 
39
+ # Known-bad STABLE RubyGems versions, same shape and policy as
40
+ # HELD_VERSIONS.
41
+ RUBYGEMS_HELD_VERSIONS = {}.freeze
42
+
29
43
  module_function
30
44
 
31
45
  # True when the version (String or Gem::Version) is a registered
@@ -131,7 +145,9 @@ module Kettle
131
145
  # newest stable, installing it first when the executing Bundler lags.
132
146
  # A registry outage fails open to the executing Bundler rather than
133
147
  # blocking the release.
134
- def ensure_latest_stable(executing: Bundler::VERSION)
148
+ def ensure_latest_stable(executing: nil)
149
+ require "bundler"
150
+ executing ||= Bundler::VERSION
135
151
  current = Gem::Version.new(executing)
136
152
  latest = published_stable
137
153
  return current.to_s if latest.nil? || latest <= current
@@ -154,6 +170,36 @@ module Kettle
154
170
  rescue ArgumentError
155
171
  nil
156
172
  end
173
+
174
+ # True when the RubyGems version (String or Gem::Version) is a
175
+ # registered known-bad stable hold.
176
+ def rubygems_held?(version)
177
+ RUBYGEMS_HELD_VERSIONS.key?(version.to_s)
178
+ end
179
+
180
+ # The registered reason a RubyGems version is held; nil when it is not.
181
+ def rubygems_held_reason(version)
182
+ RUBYGEMS_HELD_VERSIONS[version.to_s]
183
+ end
184
+
185
+ # The RubyGems running this process (`gem -v`). RubyGems is not a gem in
186
+ # the gem home — it IS the runtime's package manager — so there is no
187
+ # spec-index fallback to make; this is the only installed version that
188
+ # matters.
189
+ def installed_rubygems
190
+ Gem.rubygems_version
191
+ end
192
+
193
+ # Newest stable RubyGems the registry serves (tracked via the
194
+ # rubygems-update gem); nil when the registry cannot be consulted, so
195
+ # callers fail open. Held versions (RUBYGEMS_HELD_VERSIONS) are
196
+ # excluded, exactly like the Bundler lookup.
197
+ def published_stable_rubygems
198
+ numbers = Kettle::Dev::RubyGemsVersions.published_version_numbers(RUBYGEMS_UPDATE_GEM)
199
+ return nil unless numbers
200
+
201
+ numbers.filter_map { |number| published_candidate(number) }.reject { |candidate| rubygems_held?(candidate) }.max
202
+ end
157
203
  end
158
204
  end
159
205
  end
@@ -389,7 +389,7 @@ module Kettle
389
389
  url: run["html_url"],
390
390
  run_status: run["status"],
391
391
  conclusion: run["conclusion"],
392
- completed: passed.size,
392
+ completed: passed.size + failed.size,
393
393
  total: total
394
394
  )
395
395
  end
@@ -400,7 +400,7 @@ module Kettle
400
400
  action: "github_started",
401
401
  status: "ok",
402
402
  provider: "github",
403
- completed: passed.size,
403
+ completed: passed.size + failed.size,
404
404
  total: total,
405
405
  started: started.size
406
406
  )
@@ -431,7 +431,7 @@ module Kettle
431
431
  url: run["html_url"],
432
432
  run_status: run["status"],
433
433
  conclusion: run["conclusion"],
434
- completed: passed.size,
434
+ completed: passed.size + failed.size,
435
435
  total: total
436
436
  )
437
437
  end
@@ -463,7 +463,9 @@ module Kettle
463
463
  run_status: run["status"],
464
464
  conclusion: run["conclusion"],
465
465
  failed_job: failed_job && failed_job["name"],
466
- completed: passed.size,
466
+ # Count this failure as completed so the progress count never
467
+ # moves backwards relative to the following tick/complete events.
468
+ completed: passed.size + failed.size + 1,
467
469
  total: total,
468
470
  reason: "Workflow failed#{failed_job_note}"
469
471
  )
@@ -503,7 +505,7 @@ module Kettle
503
505
  missing: workflows - started.keys,
504
506
  head_sha: head_sha,
505
507
  total: total,
506
- completed: passed.size,
508
+ completed: passed.size + failed.size,
507
509
  reason: "Timed out waiting for workflows to start"
508
510
  )
509
511
  abort("Timed out after #{start_timeout}s waiting for GitHub Actions workflows to start for HEAD #{head_sha[0, 12]}: #{missing}. Confirm GitHub Actions started, then restart this tool from CI validation with: #{restart_hint}")
@@ -30,6 +30,9 @@ module Kettle
30
30
  class ReleaseCLI
31
31
  RUBYGEMS_INVALID_OTP = /Your OTP code is incorrect\. Please check it and retry\./.freeze
32
32
  OTP_RETRY_DELAY_SECONDS = 2
33
+ # Fresh-OTP retries for a plain `gem push` that RubyGems rejects (a mistyped code, a code
34
+ # from the wrong window). Each retry asks the secrets provider again, which re-prompts.
35
+ GEM_PUSH_OTP_RETRIES = 3
33
36
  GITHUB_RELEASE_ASSET_UPLOAD_ATTEMPTS = 3
34
37
  GITHUB_RELEASE_ASSET_UPLOAD_RETRY_DELAY_SECONDS = 1
35
38
  QUIET_ENV = {
@@ -787,6 +790,7 @@ module Kettle
787
790
  if skip_changelog?
788
791
  puts "Skipping kettle-changelog because --skip-changelog was provided."
789
792
  else
793
+ materialize_borrowed_changelog_bundles!
790
794
  run_changelog!
791
795
  end
792
796
  end
@@ -1135,6 +1139,44 @@ module Kettle
1135
1139
  @changelog_generated_coverage = true
1136
1140
  end
1137
1141
 
1142
+ # The changelog step borrows bundles the release does not otherwise
1143
+ # install: the tool bundle kettle-changelog runs from
1144
+ # (release_changelog_gemfile) and the coverage bundle its coverage step
1145
+ # execs against (changelog_coverage_gemfile). `bundle exec` never
1146
+ # auto-installs, so a cold gem home (e.g. right after a Ruby upgrade
1147
+ # emptied it) dies mid-publish with Bundler::GemNotFound. Install both
1148
+ # before the exec; `bundle install` is a fast no-op on a warm machine.
1149
+ def materialize_borrowed_changelog_bundles!
1150
+ borrowed_changelog_gemfiles.each do |gemfile|
1151
+ environment = {"BUNDLE_GEMFILE" => gemfile}
1152
+ if (lockfile = release_borrowed_bundle_lockfile(gemfile))
1153
+ environment["BUNDLE_LOCKFILE"] = lockfile
1154
+ end
1155
+ puts "Installing changelog bundle for #{gemfile}..."
1156
+ run_cmd!(release_child_command("bundle install", environment: environment))
1157
+ end
1158
+ end
1159
+
1160
+ def borrowed_changelog_gemfiles
1161
+ [release_changelog_gemfile, changelog_coverage_gemfile].compact.uniq.select { |gemfile| File.file?(gemfile) }
1162
+ end
1163
+
1164
+ # A disposable BUNDLE_LOCKFILE for a borrowed-bundle install: the
1165
+ # existing release-task copy of the bundle's canonical lockfile when one
1166
+ # exists, otherwise a fresh tmp path so `bundle install` resolves there
1167
+ # and never writes a new lockfile into the repo. Registered for cleanup
1168
+ # with the other release task lockfiles.
1169
+ def release_borrowed_bundle_lockfile(gemfile)
1170
+ task_lockfile = release_task_lockfile_path(gemfile: gemfile)
1171
+ return task_lockfile if task_lockfile
1172
+
1173
+ directory = File.join(@root, "tmp", "kettle-release", "lockfiles")
1174
+ FileUtils.mkdir_p(directory)
1175
+ path = File.join(directory, "#{File.basename(gemfile)}-#{$$}.lock")
1176
+ @release_task_lockfile_paths[gemfile] = path
1177
+ path
1178
+ end
1179
+
1138
1180
  # The changelog executable is owned by kettle-changelog, not kettle-dev.
1139
1181
  # During the bootstrap release of kettle-dev it is therefore intentionally
1140
1182
  # absent from kettle-dev's bundle. When a local kettle-dev workspace is
@@ -1753,19 +1795,35 @@ module Kettle
1753
1795
  return self.class.run_cmd!(cmd) unless release_secret_command?(cmd) && release_secrets_configured?
1754
1796
 
1755
1797
  keep_release_secrets_alive!("prompt-bearing command")
1756
- puts "$ #{cmd}"
1757
- stdout_str, stderr_str, status = Kettle::Dev::InteractiveReleaseCommand.new(
1758
- secrets_provider: @secrets_provider,
1759
- secret_event_handler: ->(payload) { emit_secret_event(payload) }
1760
- ).call(
1761
- self.class.send(:command_env_for, cmd),
1762
- cmd
1763
- )
1764
- return if status.success?
1798
+ otp_retries = 0
1799
+ stdout_str = stderr_str = status = nil
1800
+ loop do
1801
+ puts "$ #{cmd}"
1802
+ stdout_str, stderr_str, status = Kettle::Dev::InteractiveReleaseCommand.new(
1803
+ secrets_provider: @secrets_provider,
1804
+ secret_event_handler: ->(payload) { emit_secret_event(payload) }
1805
+ ).call(
1806
+ self.class.send(:command_env_for, cmd),
1807
+ cmd
1808
+ )
1809
+ return if status.success?
1765
1810
 
1766
- if gem_release_command?(cmd) && rubygems_invalid_otp?(stdout_str, stderr_str)
1767
- retry_gem_push_after_invalid_otp!
1768
- return
1811
+ if gem_release_command?(cmd) && rubygems_invalid_otp?(stdout_str, stderr_str)
1812
+ retry_gem_push_after_invalid_otp!
1813
+ return
1814
+ end
1815
+ break unless gem_push_command?(cmd) && rubygems_invalid_otp?(stdout_str, stderr_str) &&
1816
+ otp_retries < GEM_PUSH_OTP_RETRIES
1817
+
1818
+ otp_retries += 1
1819
+ puts "RubyGems rejected the OTP; asking for a fresh one (attempt #{otp_retries}/#{GEM_PUSH_OTP_RETRIES})..."
1820
+ emit_secret_event(
1821
+ source: release_secrets_provider_label,
1822
+ action: "otp_retry",
1823
+ status: "started",
1824
+ reason: "RubyGems rejected the OTP for gem push (retry #{otp_retries}/#{GEM_PUSH_OTP_RETRIES})"
1825
+ )
1826
+ sleep(OTP_RETRY_DELAY_SECONDS)
1769
1827
  end
1770
1828
 
1771
1829
  exit_code = status.respond_to?(:exitstatus) ? status.exitstatus : 1
@@ -1787,6 +1845,10 @@ module Kettle
1787
1845
  effective_command_words(cmd).first(4) == ["bundle", "exec", "rake", "release"]
1788
1846
  end
1789
1847
 
1848
+ def gem_push_command?(cmd)
1849
+ effective_command_words(cmd).first(2) == ["gem", "push"]
1850
+ end
1851
+
1790
1852
  def rubygems_invalid_otp?(*output)
1791
1853
  output.any? { |chunk| chunk.to_s.match?(RUBYGEMS_INVALID_OTP) }
1792
1854
  end
@@ -5,7 +5,7 @@ module Kettle
5
5
  # Version namespace for this gem.
6
6
  module Version
7
7
  # Current gem version.
8
- VERSION = "3.1.30"
8
+ VERSION = "3.1.32"
9
9
  end
10
10
  # Current gem version exposed at the traditional constant location.
11
11
  VERSION = Version::VERSION # Traditional Constant Location
data.tar.gz.sig CHANGED
Binary file