Module: StillActive::RuntimeCeilingHelper

Extended by:
RuntimeCeilingHelper
Included in:
RuntimeCeilingHelper
Defined in:
lib/helpers/runtime_ceiling_helper.rb

Overview

The language-runtime sibling of the poison-pill signal, kept deliberately generic: it reads a constraint a package declares on its RUNTIME (the version range it can run on) and, given that runtime's support window, answers how much the constraint holds you back. Ruby (ruby_version) is the first consumer, but nothing here is Ruby-specific: the same core serves any runtime with an end-of-life calendar (Python's requires_python, etc.). The runtime-specific parts -- where the constraint string comes from, and how the support window is built -- live in the calibration layer (RubyHelper.supported_ruby_range) and the workflow boundary, exactly as poison keeps ConstraintHelper generic and pushes ecosystem resolution to the lens.

Two tiers, mirroring the severity model:

- EOL-forced (critical): the constraint admits no still-supported runtime,
stranding you on an end-of-life release with no security patches. A genuine
upgrade blocker (e.g. a gem's `ruby_version < 3.2` caps at the EOL Ruby 3.1).
- latest-not-yet (note): runs on a supported runtime but caps below the latest
stable. An FYI ceiling to plan around, or a place to contribute support for
the newest release before you invest.

A bare floor (>= 3.1) or a requires-newer constraint (>= 4.1, ~> 5.0) is NOT a ceiling: it raises the minimum, it doesn't cap you onto a dead release. The distinction is drawn against the live EOL cycles, not the operator alone.

Constant Summary collapse

MAX_REQUIREMENT_LENGTH =

Gem::Requirement caps input via a regex; a registry-derived string could be pathological. Bound it up front like ConstraintHelper does.

256

Instance Method Summary collapse

Instance Method Details

#analyze(requirement:, support_window:) ⇒ Object

=> { requirement:, eol_forced:, severity:, ... } or nil when there's no ceiling. support_window is a { oldest_supported:, latest_stable:, cycles: } hash of Gem::Versions plus normalized EOL cycles (see supported_ruby_range).



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/helpers/runtime_ceiling_helper.rb', line 38

def analyze(requirement:, support_window:)
  return if support_window.nil?

  req = safe_requirement(requirement)
  return if req.nil? || !capping?(req)

  supported_allowed = support_window[:cycles].reject { |c| c[:eol] }.select { |c| req.satisfied_by?(c[:version]) }

  if supported_allowed.empty?
    eol_forced_finding(req, requirement, support_window)
  elsif !support_window[:latest_stable].nil? && !req.satisfied_by?(support_window[:latest_stable]) && !support_window[:latest_stable_fresh]
    # Runs on a supported runtime but not the latest stable. Suppressed while
    # the latest stable is still within its grace window (see supported_ruby_
    # range): right after a runtime ships, "doesn't support it yet" indicts the
    # release calendar, not the gem. After the window it is a real note.
    latest_not_yet_finding(requirement, support_window)
  end
end