Skip to content

feat: add minimum-release-age input, deprecate install-before#45

Merged
23prime merged 2 commits into
mainfrom
feat/minimum-release-age
Apr 27, 2026
Merged

feat: add minimum-release-age input, deprecate install-before#45
23prime merged 2 commits into
mainfrom
feat/minimum-release-age

Conversation

@23prime

@23prime 23prime commented Apr 27, 2026

Copy link
Copy Markdown
Owner

Checklist

  • Target branch is main
  • Status checks are passing

Summary

  • Add minimum-release-age input (forwarded to MISE_MINIMUM_RELEASE_AGE)
  • Keep install-before as a deprecated fallback that emits a warning when used
  • minimum-release-age takes precedence when both inputs are provided

Reason for change

mise v2026.4.22 renamed install_before to minimum_release_age. This change
follows that rename while preserving backward compatibility for existing users
via the deprecated install-before input.

Changes

  • action.yml: add minimum-release-age input; keep install-before as deprecated
  • src/index.ts: prefer minimum-release-age, set MISE_MINIMUM_RELEASE_AGE, emit core.warning when install-before is used
  • __tests__/index.test.ts: add tests for new input, deprecated fallback, and precedence
  • README.md: update inputs table and troubleshooting section
  • .github/workflows/mise-upgrade.yml: update dogfood workflow to use new input

Notes

install-before will continue to work as a deprecated alias. Removal will be
treated as a breaking change in a future release.

mise v2026.4.22 renamed install_before to minimum_release_age.
Add minimum-release-age as the primary input forwarded to
MISE_MINIMUM_RELEASE_AGE, keep install-before as a deprecated
fallback that emits a warning when used.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Apr 27, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

This PR renames the install-before input to minimum-release-age across the GitHub Action's configuration, code, tests, and documentation. The deprecated install-before input is retained for backward compatibility with a deprecation warning mechanism.

Changes

Cohort / File(s) Summary
Input Configuration
action.yml, .github/workflows/mise-upgrade.yml
Introduces minimum-release-age as the primary input, deprecates install-before, and updates environment variable wiring from INPUT_INSTALL-BEFORE to INPUT_MINIMUM-RELEASE-AGE.
Documentation
README.md
Replaces install-before with minimum-release-age in documented inputs and examples; marks install-before as deprecated; updates referenced environment variable and constraint reference.
Core Logic
src/index.ts
Reads new minimum-release-age input, falls back to install-before for backward compatibility, emits deprecation warning when only install-before is provided, and uses MISE_MINIMUM_RELEASE_AGE environment variable.
Test Coverage
__tests__/index.test.ts
Adds tests for minimum-release-age input handling, backward compatibility with deprecated install-before, precedence behavior, and deprecation warning emission.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • PR #17: Modifies src/index.ts and __tests__/index.test.ts to refactor action entry point and test coverage—shares the same core source files undergoing input handling changes.
  • PR #4: Modifies action.yml and src/index.ts for action wiring and input forwarding—relates to the same input configuration and action entrypoint logic.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and clearly describes the main change: introducing a new input while deprecating an old one.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The pull request description is clearly related to the changeset, outlining the addition of minimum-release-age input, deprecation of install-before, and rationale from mise v2026.4.22.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch feat/minimum-release-age

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (3)
__tests__/index.test.ts (2)

147-227: Optional: extract repeated env-var save/restore + input-override boilerplate into helpers.

The four new tests duplicate the same try/finally env-restore pattern and the same input-override scaffolding. Consider a small helper such as withEnvVar('MISE_MINIMUM_RELEASE_AGE', async () => { ... }) and a setInputs({ ... }) helper to reduce noise; behavior unchanged. Pure cleanup — fine to defer.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@__tests__/index.test.ts` around lines 147 - 227, Extract the repeated env
save/restore and mock input setup into small helpers and use them in the tests:
implement a withEnvVar helper that accepts the env var name and an async
callback to save, delete/restore process.env['MISE_MINIMUM_RELEASE_AGE'] around
the callback (used by the three tests), and implement
setMockInputs(mockGetInput, inputs) to centralize the
mockGetInput.mockImplementation logic (returning special-case values like
'minimum-release-age' or 'install-before' when provided); then update the tests
to call withEnvVar('MISE_MINIMUM_RELEASE_AGE', async () => {
setMockInputs(mockGetInput, {...}); await run(); ... }) and replace the inline
try/finally and duplicated mock implementations (references: mockGetInput, run,
core.warning) with these helpers.

229-255: Strengthen precedence test by asserting the deprecation warning is NOT emitted.

When both inputs are provided, src/index.ts intentionally suppresses the deprecation warning (if (installBefore && !minimumReleaseAge)). The current test only checks the env var, so a regression that fires the warning unconditionally would slip through.

♻️ Suggested addition
   it('minimum-release-age takes precedence over install-before', async () => {
     const originalEnv = process.env['MISE_MINIMUM_RELEASE_AGE']
+    const mockWarning = core.warning as jest.MockedFunction<typeof core.warning>
     try {
       delete process.env['MISE_MINIMUM_RELEASE_AGE']
       mockGetInput.mockImplementation((name: string) => {
         if (name === 'minimum-release-age') return '1w'
         if (name === 'install-before') return '3d'
         ...
       })
       await run()
       expect(process.env['MISE_MINIMUM_RELEASE_AGE']).toBe('1w')
+      expect(mockWarning).not.toHaveBeenCalled()
     } finally {
       ...
     }
   })
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@__tests__/index.test.ts` around lines 229 - 255, The test must also assert
that the deprecation warning is NOT emitted when both inputs are present; after
arranging mockGetInput and calling run(), add an assertion that the mocked
warning/logging function (e.g., the test's mockWarning or mocked core.warning)
was not called — use the existing mock for warning (or create one if missing)
and assert expect(mockWarning).not.toHaveBeenCalled() (or equivalent) alongside
the existing check of process.env['MISE_MINIMUM_RELEASE_AGE']; reference the
test helpers mockGetInput and run() and the env var MISE_MINIMUM_RELEASE_AGE
when adding this assertion.
README.md (1)

109-110: Recommended: document mise version requirement and add a brief usage example.

The table introduces MISE_MINIMUM_RELEASE_AGE but does not note that the env var was introduced in mise 2026.4.22 (older mise versions used MISE_INSTALL_BEFORE). Users on older mise will silently get no constraint enforcement. Also, the "Examples" section above does not show the new input; a small snippet would aid discoverability.

📝 Suggested wording addition
-| `minimum-release-age` | No | `` | Minimum age of a tool release before it is eligible for upgrade (e.g. `3d`, `1w`). Forwarded to mise as `MISE_MINIMUM_RELEASE_AGE`. Reduces supply chain risk by avoiding immediately-released versions. |
+| `minimum-release-age` | No | `` | Minimum age of a tool release before it is eligible for upgrade (e.g. `3d`, `1w`). Forwarded to mise as `MISE_MINIMUM_RELEASE_AGE` (requires mise `2026.4.22+`). Reduces supply chain risk by avoiding immediately-released versions. |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@README.md` around lines 109 - 110, Update the README table entry and Examples
to note that the environment variable MISE_MINIMUM_RELEASE_AGE (and the
CLI/input minimum-release-age) is supported starting in mise 2026.4.22 (older
mise used MISE_INSTALL_BEFORE and will not enforce this constraint), and add a
brief usage example showing how to set minimum-release-age (or export
MISE_MINIMUM_RELEASE_AGE) in the Examples section so users can discover the new
input; reference the table keys `minimum-release-age`, `install-before`, and the
env var name `MISE_MINIMUM_RELEASE_AGE` when making the edits.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/mise-upgrade.yml:
- Line 61: The workflow is pinning the action at commit d2ea02a (v1.0.2) which
does not support the minimum-release-age input; update the pinned action
reference (replace commit SHA or tag d2ea02a/v1.0.2) to a newer release/commit
that introduces the minimum-release-age input so the input is recognized (keep
the minimum-release-age: "3d" line as-is once the action is bumped).

In `@src/index.ts`:
- Around line 25-33: The code in src/index.ts currently assigns the release age
to a non-existent env var MISE_MINIMUM_RELEASE_AGE; update the assignment so
process.env uses the correct key MISE_INSTALL_BEFORE (i.e., replace
process.env['MISE_MINIMUM_RELEASE_AGE'] = releaseAge with setting
process.env['MISE_INSTALL_BEFORE'] = releaseAge) while leaving the existing
logic that computes releaseAge from minimumReleaseAge and installBefore and the
deprecation warning intact.

---

Nitpick comments:
In `@__tests__/index.test.ts`:
- Around line 147-227: Extract the repeated env save/restore and mock input
setup into small helpers and use them in the tests: implement a withEnvVar
helper that accepts the env var name and an async callback to save,
delete/restore process.env['MISE_MINIMUM_RELEASE_AGE'] around the callback (used
by the three tests), and implement setMockInputs(mockGetInput, inputs) to
centralize the mockGetInput.mockImplementation logic (returning special-case
values like 'minimum-release-age' or 'install-before' when provided); then
update the tests to call withEnvVar('MISE_MINIMUM_RELEASE_AGE', async () => {
setMockInputs(mockGetInput, {...}); await run(); ... }) and replace the inline
try/finally and duplicated mock implementations (references: mockGetInput, run,
core.warning) with these helpers.
- Around line 229-255: The test must also assert that the deprecation warning is
NOT emitted when both inputs are present; after arranging mockGetInput and
calling run(), add an assertion that the mocked warning/logging function (e.g.,
the test's mockWarning or mocked core.warning) was not called — use the existing
mock for warning (or create one if missing) and assert
expect(mockWarning).not.toHaveBeenCalled() (or equivalent) alongside the
existing check of process.env['MISE_MINIMUM_RELEASE_AGE']; reference the test
helpers mockGetInput and run() and the env var MISE_MINIMUM_RELEASE_AGE when
adding this assertion.

In `@README.md`:
- Around line 109-110: Update the README table entry and Examples to note that
the environment variable MISE_MINIMUM_RELEASE_AGE (and the CLI/input
minimum-release-age) is supported starting in mise 2026.4.22 (older mise used
MISE_INSTALL_BEFORE and will not enforce this constraint), and add a brief usage
example showing how to set minimum-release-age (or export
MISE_MINIMUM_RELEASE_AGE) in the Examples section so users can discover the new
input; reference the table keys `minimum-release-age`, `install-before`, and the
env var name `MISE_MINIMUM_RELEASE_AGE` when making the edits.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c024afc2-89a6-48fc-b66b-0cdced534ff5

📥 Commits

Reviewing files that changed from the base of the PR and between 2df72ad and 5771f77.

⛔ Files ignored due to path filters (1)
  • dist/index.js is excluded by !**/dist/**
📒 Files selected for processing (5)
  • .github/workflows/mise-upgrade.yml
  • README.md
  • __tests__/index.test.ts
  • action.yml
  • src/index.ts

Comment thread .github/workflows/mise-upgrade.yml Outdated
Comment thread src/index.ts
The action reference is still pinned to v1.0.2 which does not support
minimum-release-age. Will update after a new release in a separate PR.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@23prime 23prime force-pushed the feat/minimum-release-age branch from ac2625c to fa0227a Compare April 27, 2026 05:49
@23prime 23prime merged commit dbd4bf8 into main Apr 27, 2026
8 checks passed
@23prime 23prime deleted the feat/minimum-release-age branch April 27, 2026 05:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant