kettle-family 1.3.39 → 1.3.40

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: 00ada16f8c2669a9c44af0c59020f24d1cc75c001b21071928d000ee1153db24
4
- data.tar.gz: 6ede956bf32b54f38edf97e761a9042770e754c56c5b35a60f3bb5f7dc63433a
3
+ metadata.gz: c098ede3aba44cf7502174188e54bdef47ca178395c21ae55255c34f7a5d06f2
4
+ data.tar.gz: 9c8e473a1f5dd87b428d3be04402d930d20977ed4bf18fadbb81a39d65024b0d
5
5
  SHA512:
6
- metadata.gz: d393bbecccec9c2accaf8c96f2069824a6dcb225d32d288b32d02d3f2eda94a3a240d6b6e7b68bedf985c0bea7c573083e3ddddf19e0b3936b9cdbd91d486292
7
- data.tar.gz: fcd14569fdded3e35eca87b737e1c3acc9e8c8678915d532f639339a56a425f44c8516382d5aea04700d8b8d80a77bdae3661f791c356e9e11a6e17bf3d18a47
6
+ metadata.gz: abed8faf333eed49004c382fa053a08d9c1acc2a24249427aa829f8a67f1adcc7d7e3c18cc10cac4f88f4fb049a4969439724e8cbc83b1fe2a39ba7c5df6b3c5
7
+ data.tar.gz: 2afa7e58df348b02a5c5386d7ce43a550891483ed1b1c654b465ae968d840bbfa0b4c14b66e4d114025c7a5575b0c481f768e74ba5f8d6920b2c1f9e5d496f40
checksums.yaml.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -30,6 +30,21 @@ Please file a bug if you notice a violation of semantic versioning.
30
30
 
31
31
  ### Security
32
32
 
33
+ ## [1.3.40] - 2026-11-09
34
+
35
+ - TAG: [v1.3.40][1.3.40t]
36
+ - COVERAGE: 93.22% -- 7802/8369 lines in 45 files
37
+ - BRANCH COVERAGE: 77.61% -- 3148/4056 branches in 45 files
38
+ - 39.49% documented
39
+
40
+ ### Added
41
+
42
+ - Family bump lock: bump --execute holds an flock on <family-root>/tmp/kettle-family/bump.lock for the whole write-and-commit section; a concurrent bump fails closed naming the holder. flock releases on process death, so no stale lockfile cleanup is needed. (#28)
43
+
44
+ ### Fixed
45
+
46
+ - bump --execute now refuses to bump a mid-prep member whose version already leads its latest release (double-bump guard; latest release from release state, falling back to the member changelog's latest released section when the explicit --only path carries no state). Pass --force to bump a mid-prep member deliberately. Shared-changelog cohorts are unchanged. (#28)
47
+
33
48
  ## [1.3.39] - 2026-11-08
34
49
 
35
50
  - TAG: [v1.3.39][1.3.39t]
@@ -3383,7 +3398,9 @@ Please file a bug if you notice a violation of semantic versioning.
3383
3398
  - Fixed CI load failures on engines without compatible `pty` support by falling back to Open3 for interactive release commands.
3384
3399
  - Fixed Ruby 3.2 version-bump support by loading Prism lazily and wiring the Prism gem only for MRI versions that need it.
3385
3400
 
3386
- [Unreleased]: https://github.com/kettle-dev/kettle-family/compare/v1.3.39...HEAD
3401
+ [Unreleased]: https://github.com/kettle-dev/kettle-family/compare/v1.3.40...HEAD
3402
+ [1.3.40]: https://github.com/kettle-dev/kettle-family/compare/v1.3.39...v1.3.40
3403
+ [1.3.40t]: https://github.com/kettle-dev/kettle-family/releases/tag/v1.3.40
3387
3404
  [1.3.39]: https://github.com/kettle-dev/kettle-family/compare/v1.3.38...v1.3.39
3388
3405
  [1.3.39t]: https://github.com/kettle-dev/kettle-family/releases/tag/v1.3.39
3389
3406
  [1.3.38]: https://github.com/kettle-dev/kettle-family/compare/v1.3.37...v1.3.38
data/README.md CHANGED
@@ -1091,7 +1091,7 @@ If none of the available licenses suit your use case, please [contact us](mailto
1091
1091
  [📌gitmoji]: https://gitmoji.dev
1092
1092
  [📌gitmoji-img]: https://img.shields.io/badge/gitmoji_commits-%20%F0%9F%98%9C%20%F0%9F%98%8D-34495e.svg?style=flat-square
1093
1093
  [🧮kloc]: https://www.youtube.com/watch?v=dQw4w9WgXcQ
1094
- [🧮kloc-img]: https://img.shields.io/badge/KLOC-8.320-FFDD67.svg?style=for-the-badge&logo=YouTube&logoColor=blue
1094
+ [🧮kloc-img]: https://img.shields.io/badge/KLOC-8.369-FFDD67.svg?style=for-the-badge&logo=YouTube&logoColor=blue
1095
1095
  [🔐security]: https://github.com/kettle-dev/kettle-family/blob/main/SECURITY.md
1096
1096
  [🔐security-img]: https://img.shields.io/badge/security-policy-259D6C.svg?style=flat
1097
1097
  [📄copyright-notice-explainer]: https://opensource.stackexchange.com/questions/5778/why-do-licenses-such-as-the-mit-license-specify-a-single-year
@@ -627,11 +627,12 @@ module Kettle
627
627
 
628
628
  option :check, desc: "Check whether version bumps would need edits"
629
629
  option :from, value: {type: String, usage: "VERSION"}, desc: "Require selected members to currently match VERSION"
630
+ option :force, desc: "Allow bumping a mid-prep member whose version already leads its latest release"
630
631
 
631
632
  def run(target_version = nil)
632
633
  raise Error, "#{workflow_command_name} requires VERSION, major, minor, patch, or pre" unless target_version
633
634
 
634
- run_family(workflow_command_name, target_version: target_version, from_version: options[:from])
635
+ run_family(workflow_command_name, target_version: target_version, from_version: options[:from], force: options[:force])
635
636
  end
636
637
 
637
638
  private
@@ -1439,6 +1440,45 @@ module Kettle
1439
1440
  require_relative "version_bump"
1440
1441
  require_relative "release_waves"
1441
1442
 
1443
+ guard_results = mid_prep_bump_guard_results(
1444
+ config: config,
1445
+ members: members,
1446
+ options: options,
1447
+ phase: phase,
1448
+ release_state_results: release_state_results
1449
+ )
1450
+ return guard_results unless guard_results.empty?
1451
+
1452
+ run = -> { bump_version_write_results(config: config, members: members, options: options, phase: phase, release_state_results: release_state_results) }
1453
+ return run.call unless options[:execute]
1454
+
1455
+ with_bump_lock(config: config, &run)
1456
+ end
1457
+
1458
+ # Serialize concurrent family bumps with an flock held for the whole
1459
+ # write-and-commit section. The kernel releases an flock on process
1460
+ # death, so there is no stale lockfile to clear by hand; the file's
1461
+ # contents name the holder for the fail-closed message. Scope is the
1462
+ # family root, not the member: lockstep cohort bumps span members, and
1463
+ # multi-lock acquisition invites deadlock.
1464
+ def with_bump_lock(config:)
1465
+ lock_path = File.join(config.root, "tmp", "kettle-family", "bump.lock")
1466
+ FileUtils.mkdir_p(File.dirname(lock_path))
1467
+ File.open(lock_path, File::RDWR | File::CREAT, 0o644) do |lock_file|
1468
+ unless lock_file.flock(File::LOCK_EX | File::LOCK_NB)
1469
+ holder = File.read(lock_path).strip
1470
+ detail = holder.empty? ? "holder unknown" : "held by #{holder}"
1471
+ raise Error, "bump refused: another family bump is in progress (#{detail}; lock #{lock_path})"
1472
+ end
1473
+ lock_file.rewind
1474
+ lock_file.write("pid #{Process.pid}, started #{Time.now.utc.strftime("%Y-%m-%dT%H:%M:%SZ")}")
1475
+ lock_file.flush
1476
+ lock_file.truncate(lock_file.tell)
1477
+ yield
1478
+ end
1479
+ end
1480
+
1481
+ def bump_version_write_results(config:, members:, options:, phase:, release_state_results: nil)
1442
1482
  results = []
1443
1483
  completed_target_versions = {}
1444
1484
  shared_member_names = shared_bump_member_names(config: config, members: members)
@@ -1483,6 +1523,73 @@ module Kettle
1483
1523
  end
1484
1524
  end
1485
1525
 
1526
+ # Fail closed on a double bump: a member whose checkout version already
1527
+ # sits ahead of its latest released version is mid-prep, and bumping it
1528
+ # again steals a version number from the in-flight release. The explicit
1529
+ # "--only <member> patch" path carries no release-state results
1530
+ # (release_state_results_for_selection skips the check without a status
1531
+ # token), so fall back to the member changelog's latest released section
1532
+ # — a purely local read that covers exactly that path. Shared-changelog
1533
+ # families are exempt: shared_bump_target_version already aligns mid-prep
1534
+ # cohort laggards without incrementing.
1535
+ def mid_prep_bump_guard_results(config:, members:, options:, phase:, release_state_results:)
1536
+ return [] unless options[:execute]
1537
+ return [] if options[:force]
1538
+ return [] if config.shared_changelog?
1539
+
1540
+ states_by_name = Array(release_state_results).each_with_object({}) do |result, memo|
1541
+ memo[result.member_name] = result.state
1542
+ end
1543
+ members.filter_map do |member|
1544
+ latest = mid_prep_latest_released(member: member, state: states_by_name[member.name])
1545
+ next if latest.nil?
1546
+
1547
+ current = Gem::Version.new(member.version.to_s)
1548
+ next unless current > latest
1549
+
1550
+ CommandResult.new(
1551
+ member_name: member.name,
1552
+ phase: phase,
1553
+ command: ["internal", phase, "mid-prep-guard"],
1554
+ workdir: member.root,
1555
+ status: 1,
1556
+ success: false,
1557
+ stdout: "",
1558
+ stderr: "bump refused: #{member.name} is #{current}, already ahead of latest released #{latest}; release it first, or pass --force to bump a mid-prep member",
1559
+ elapsed_seconds: 0.0,
1560
+ skipped: false,
1561
+ reason: "mid-prep double-bump guard"
1562
+ )
1563
+ end
1564
+ end
1565
+
1566
+ def mid_prep_latest_released(member:, state:)
1567
+ if state.respond_to?(:[])
1568
+ latest = state["latest_released"].to_s
1569
+ unless latest.empty?
1570
+ parsed = mid_prep_guard_version(latest)
1571
+ return parsed if parsed
1572
+ end
1573
+ end
1574
+ changelog = File.join(member.root, "CHANGELOG.md")
1575
+ return nil unless File.file?(changelog)
1576
+
1577
+ File.foreach(changelog) do |line|
1578
+ match = line.match(/\A## \[([^\]]+)\]/)
1579
+ next unless match
1580
+ next if match[1] == "Unreleased"
1581
+
1582
+ return mid_prep_guard_version(match[1])
1583
+ end
1584
+ nil
1585
+ end
1586
+
1587
+ def mid_prep_guard_version(value)
1588
+ Gem::Version.new(value.to_s)
1589
+ rescue ArgumentError
1590
+ nil
1591
+ end
1592
+
1486
1593
  def shared_bump_member_names(config:, members:)
1487
1594
  return [] unless config.shared_changelog?
1488
1595
 
@@ -5,7 +5,7 @@ module Kettle
5
5
  # Version namespace for this gem.
6
6
  module Version
7
7
  # Current gem version.
8
- VERSION = "1.3.39"
8
+ VERSION = "1.3.40"
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kettle-family
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.39
4
+ version: 1.3.40
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter H. Boling
@@ -628,10 +628,10 @@ licenses:
628
628
  - AGPL-3.0-only
629
629
  metadata:
630
630
  homepage_uri: https://structuredmerge.org
631
- source_code_uri: https://github.com/kettle-dev/kettle-family/tree/v1.3.39
632
- changelog_uri: https://github.com/kettle-dev/kettle-family/blob/v1.3.39/CHANGELOG.md
631
+ source_code_uri: https://github.com/kettle-dev/kettle-family/tree/v1.3.40
632
+ changelog_uri: https://github.com/kettle-dev/kettle-family/blob/v1.3.40/CHANGELOG.md
633
633
  bug_tracker_uri: https://github.com/kettle-dev/kettle-family/issues
634
- documentation_uri: https://www.rubydoc.info/gems/kettle-family/1.3.39
634
+ documentation_uri: https://www.rubydoc.info/gems/kettle-family/1.3.40
635
635
  funding_uri: https://github.com/sponsors/pboling
636
636
  wiki_uri: https://github.com/kettle-dev/kettle-family/wiki
637
637
  news_uri: https://www.railsbling.com/tags/kettle-family
metadata.gz.sig CHANGED
Binary file