feat: add minimum-release-age input, deprecate install-before#45
Conversation
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>
📝 WalkthroughWalkthroughThis PR renames the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches✨ Simplify code
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. Comment |
There was a problem hiding this comment.
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/finallyenv-restore pattern and the same input-override scaffolding. Consider a small helper such aswithEnvVar('MISE_MINIMUM_RELEASE_AGE', async () => { ... })and asetInputs({ ... })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.tsintentionally 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_AGEbut does not note that the env var was introduced in mise 2026.4.22 (older mise versions usedMISE_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
⛔ Files ignored due to path filters (1)
dist/index.jsis excluded by!**/dist/**
📒 Files selected for processing (5)
.github/workflows/mise-upgrade.ymlREADME.md__tests__/index.test.tsaction.ymlsrc/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>
ac2625c to
fa0227a
Compare
Checklist
mainSummary
minimum-release-ageinput (forwarded toMISE_MINIMUM_RELEASE_AGE)install-beforeas a deprecated fallback that emits a warning when usedminimum-release-agetakes precedence when both inputs are providedReason for change
mise v2026.4.22 renamed
install_beforetominimum_release_age. This changefollows that rename while preserving backward compatibility for existing users
via the deprecated
install-beforeinput.Changes
action.yml: addminimum-release-ageinput; keepinstall-beforeas deprecatedsrc/index.ts: preferminimum-release-age, setMISE_MINIMUM_RELEASE_AGE, emitcore.warningwheninstall-beforeis used__tests__/index.test.ts: add tests for new input, deprecated fallback, and precedenceREADME.md: update inputs table and troubleshooting section.github/workflows/mise-upgrade.yml: update dogfood workflow to use new inputNotes
install-beforewill continue to work as a deprecated alias. Removal will betreated as a breaking change in a future release.