feat(config): add lockfile_platforms setting to restrict lockfile platforms#8966
feat(config): add lockfile_platforms setting to restrict lockfile platforms#8966
Conversation
…latforms Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Greptile SummaryAdds a Confidence Score: 5/5Safe to merge; all remaining findings are P2 test-coverage suggestions that do not affect runtime behaviour. The logic changes are minimal and well-bounded — two functions whose return types were promoted to e2e/lockfile/test_lockfile_platforms_setting — Test 3 could add negative assertions to fully validate the
|
| Filename | Overview |
|---|---|
| src/lockfile.rs | Adds lockfile_platforms setting awareness to both auto-lock and explicit-lock platform resolution; return types promoted to Result; logic is correct and well-structured. |
| src/cli/lock.rs | Minimal change: propagates the new Result return type from determine_existing_platforms; --platform flag continues to bypass the setting correctly. |
| src/config/settings.rs | Adds lockfile_platforms() helper that parses and validates platform strings; empty-vec guard returns None (default behaviour) cleanly. |
| settings.toml | New lockfile_platforms setting entry is complete with description, env var, comma-list parsing, and updated docs noting the always-included current platform. |
| e2e/lockfile/test_lockfile_platforms_setting | Five test cases covering env-var, mise lock, --platform override, mise.toml, and mise use; positive + negative assertions added; Test 3 (--platform override) missing negative assertions for the configured platforms. |
| schema/mise.json | Schema updated to include the new lockfile_platforms array-of-strings field; straightforward addition. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[mise install / mise use / mise lock] --> B{--platform flag given?}
B -- Yes --> C[Platform::parse_multiple CLI args\nreturn those platforms only]
B -- No --> D{lockfile_platforms\nsetting configured?}
D -- Yes --> E[Use configured platforms\n+ always insert current platform]
D -- No --> F{Existing lockfile\nhas platform entries?}
F -- Yes --> G[Use existing lockfile platforms\n+ current platform]
F -- No --> H[Use all common platforms\n+ current platform]
E --> I[Resolve checksums / update lockfile]
C --> I
G --> I
H --> I
Reviews (6): Last reviewed commit: "[autofix.ci] apply automated fixes" | Re-trigger Greptile
There was a problem hiding this comment.
Code Review
This pull request introduces the lockfile_platforms setting, allowing users to restrict lockfile operations to specific platforms to reduce file size and improve installation speed. The implementation includes updates to the configuration schema, documentation, and the logic for resolving target platforms. Feedback suggests refactoring duplicated platform-merging logic in src/lockfile.rs into a helper function and updating the documentation to clarify that the current platform is always included in the target set regardless of the configuration.
…assertions Address bot review feedback: - Document that current platform is always included in lockfile_platforms - Add positive assertions to e2e test (verify configured platforms ARE present) - Use $MISE_PLATFORM to verify current platform auto-inclusion Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Tip: Greploops — Automatically fix all review issues by running Use the Greptile plugin for Claude Code to query reviews, search comments, and manage custom context directly from your terminal. |
Platform::current() auto-inserts the current platform (e.g. linux-x64-musl on musl runners), so negative assertions for musl platforms are unreliable. The windows-x64 assertions already prove the restriction works. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The original issue was about `mise use` overwriting lockfile platforms. Add explicit test coverage for this code path. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
### 🚀 Features - **(config)** add lockfile_platforms setting to restrict lockfile platforms by @cameronbrill in [#8966](#8966) - **(sandbox)** support wildcard patterns in allow_env by @jdx in [#8974](#8974) - bump usage-lib v2 → v3 to render examples in task --help by @baby-joel in [#8890](#8890) ### 🐛 Bug Fixes - **(activate)** handle empty __MISE_FLAGS array with set -u on bash 3.2 by @jdx in [#8988](#8988) - **(env)** add trace logging for module hook PATH diagnostics by @jdx in [#8981](#8981) - **(go)** Query module proxy directly for version resolution by @c22 in [#8968](#8968) - **(install)** render tera templates in tool postinstall hooks by @jdx in [#8978](#8978) - **(install)** add missing env vars to tool postinstall hooks by @jdx in [#8977](#8977) - **(task)** prevent hang when skipped task has dependents by @jdx in [#8937](#8937) - **(task)** invalidate dependent task sources when dependency runs by @jdx in [#8975](#8975) - **(task)** prevent deadlock when MISE_JOBS=1 with sub-task references by @jdx in [#8976](#8976) - **(task)** fetch remote task files before parsing usage specs by @jdx in [#8979](#8979) - **(task)** prevent panic when running parallel sub-tasks with replacing output by @jdx in [#8986](#8986) - **(upgrade)** update lockfile and config when upgrading to specific version by @jdx in [#8983](#8983) ### 📚 Documentation - **(node)** remove "recommended for teams" from pin example by @jdx in [b334363](b334363) ### 📦️ Dependency Updates - update ghcr.io/jdx/mise:alpine docker digest to 17a29f2 by @renovate[bot] in [#8995](#8995) - update docker/dockerfile:1 docker digest to 2780b5c by @renovate[bot] in [#8994](#8994) ### New Contributors - @baby-joel made their first contribution in [#8890](#8890) - @cameronbrill made their first contribution in [#8966](#8966) - @c22 made their first contribution in [#8968](#8968)
Summary
lockfile_platformssetting that controls which platforms are targeted during lockfile operationsmise install,mise use, andmise lock(without--platform) only resolve checksums/URLs for the configured platforms instead of all 7 common platformsmise lock --platform— invalid platform strings produce a hard errormise lock --platformflagsCloses #8610
Usage
Or via environment variable:
Test plan
cargo check— compiles cleanlymise run lint— all lints passmise run test:e2e test_lockfile_platforms_setting— new e2e test passes (4 test cases: auto-lock restriction,mise lockrestriction,--platformoverride, setting viamise.toml)mise run test:e2e test_lockfile_existing_platforms— existing test still passes🤖 Generated with Claude Code