Skip to content

Comments

fix(edit): strip formatting whitespace from TOML values in mise edit#8162

Merged
jdx merged 7 commits intomainfrom
fix/edit-boolean-formatting
Feb 15, 2026
Merged

fix(edit): strip formatting whitespace from TOML values in mise edit#8162
jdx merged 7 commits intomainfrom
fix/edit-boolean-formatting

Conversation

@jdx
Copy link
Owner

@jdx jdx commented Feb 15, 2026

Summary

  • Fix mise edit generating invalid config with booleans like " true" instead of "true"
  • toml_edit's Formatted<T> wrapper preserves original whitespace; calling .to_string() on it includes that whitespace
  • Use .value().to_string() to extract raw values for Integer, Float, Boolean, and Datetime, matching the existing pattern for String

Fixes #8141

Test plan

  • All 37 existing mise-interactive-config tests pass
  • All linting passes
  • Manual test: create a mise.toml with boolean settings, run mise edit, save without changes, verify booleans remain valid

🤖 Generated with Claude Code


Note

Low Risk
Small, localized change to TOML value stringification; primary risk is subtle formatting/round-trip differences for numeric/boolean/datetime values.

Overview
Fixes mise edit round-tripping TOML scalars by extracting raw values from toml_edit::Formatted<T> rather than preserving its original formatting.

In TomlDocument::value_to_string (crates/mise-interactive-config/src/document.rs), integer/float/boolean/datetime serialization now uses .value().to_string() (matching strings) instead of .to_string(), preventing emitted values like " true" that can make saved configs invalid.

Written by Cursor Bugbot for commit 69dc7ab. This will update automatically on new commits. Configure here.

jdx and others added 5 commits February 11, 2026 12:44
Allow reading environment variable values from stdin for multiline or
binary-safe input. This enables use cases like storing SSH keys or
certificates via `cat key.pem | mise set --stdin MY_KEY`.

Strips a single trailing newline to match `gh secret set` behavior.

Closes #6878

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove "binary-safe" from doc comment since read_to_string requires
  UTF-8 (Copilot feedback)
- Use explicit \r\n / \n check with truncate for clearer newline
  stripping logic (Gemini feedback)
- Regenerate docs/completions

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move the stdin field after remove in the Set struct to maintain
alphabetical ordering of long-only flags, and add requires = "env_vars"
so --stdin without a key gives a clear error instead of silently
listing env vars.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
toml_edit's Formatted<T> wrapper preserves original TOML formatting
including whitespace around values. Calling .to_string() on these wrappers
produced strings like " true" instead of "true", causing invalid config
files when saved. Use .value().to_string() to extract raw values, matching
the existing pattern for String values.

Fixes #8141

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings February 15, 2026 13:29
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @jdx, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a critical bug in mise edit that caused incorrect TOML serialization for certain data types by preserving unwanted whitespace, leading to invalid configurations. Additionally, it enhances the mise set command by introducing a --stdin option, enabling more flexible input for multiline environment variables.

Highlights

  • Fix for mise edit TOML formatting: Corrected an issue where mise edit would generate invalid TOML configurations by including extraneous whitespace when serializing boolean, integer, float, and datetime values, ensuring proper toml_edit value extraction.
  • New mise set --stdin feature: Introduced a new --stdin flag to the mise set command, allowing users to provide multiline environment variable values by reading from standard input, with automatic stripping of a single trailing newline.
Changelog
  • crates/mise-interactive-config/src/document.rs
    • Updated value_to_string to correctly extract raw values from Integer, Float, Boolean, and Datetime types using .value().to_string() to prevent unwanted whitespace from toml_edit's Formatted<T> wrapper.
  • docs/cli/set.md
    • Added documentation for the new --stdin flag, explaining its usage for multiline input and providing examples.
  • e2e/cli/test_set
    • Introduced end-to-end tests for the --stdin flag, covering multiline input, trailing newline stripping, and error handling for incorrect usage (multiple keys or KEY=VALUE syntax).
  • man/man1/mise.1
    • Updated the man page for the mise set command to include the --stdin option and its description.
  • mise.usage.kdl
    • Modified the mise set command definition to include the --stdin flag, its help text, and updated the after_long_help examples to demonstrate its usage.
  • src/cli/set.rs
    • Implemented the --stdin flag for the Set command, including argument parsing, conflict resolution with --prompt, and logic to read from standard input, handle single key requirement, and strip trailing newlines.
  • xtasks/fig/src/mise.ts
    • Added the --stdin option to the Fig completion specification for the mise set command.
Activity
  • All 37 existing mise-interactive-config tests passed.
  • All linting checks passed.
  • A manual test was performed to verify that boolean settings in mise.toml remain valid after running mise edit and saving without changes.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@jdx jdx changed the title fix(config): strip formatting whitespace from TOML values in mise edit fix(edit): strip formatting whitespace from TOML values in mise edit Feb 15, 2026
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces two main changes. First, it fixes a bug in mise edit where TOML values for integers, floats, booleans, and datetimes were being serialized with extra whitespace, potentially creating invalid configurations. This is corrected by using .value().to_string() to extract the raw value, which is a solid fix. Second, it adds a new --stdin flag to the mise set command, allowing multiline values to be provided via standard input. This new feature is well-implemented with appropriate validation, clear documentation, and comprehensive end-to-end tests. The code quality is high, and I have no concerns or suggestions for improvement.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses a bug in the interactive TOML editor where toml_edit's Formatted<T> wrapper preserves formatting whitespace, causing booleans and other values to be serialized with unwanted whitespace (e.g., " true" instead of true). The fix extracts raw values using .value().to_string() instead of directly calling .to_string() on formatted values. Additionally, the PR adds a --stdin flag to mise set for reading multiline environment variable values from stdin.

Changes:

  • Fixed value_to_string() in mise-interactive-config to strip formatting whitespace from TOML values
  • Added --stdin flag to mise set command for multiline environment variable input
  • Added comprehensive tests for the new --stdin functionality

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
crates/mise-interactive-config/src/document.rs Fixed value_to_string() to call .value().to_string() on Integer, Float, Boolean, and Datetime types to strip formatting whitespace
src/cli/set.rs Added --stdin flag implementation with validation, stdin reading, and single trailing newline stripping
e2e/cli/test_set Added 6 new test cases covering multiline values, newline stripping, and error cases for --stdin
xtasks/fig/src/mise.ts Added --stdin flag to Fig autocomplete spec
mise.usage.kdl Updated usage spec with --stdin flag and examples
man/man1/mise.1 Updated man page documentation for --stdin flag
docs/cli/set.md Added --stdin documentation and examples

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jdx
Copy link
Owner Author

jdx commented Feb 15, 2026

bugbot run

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

@jdx jdx enabled auto-merge (squash) February 15, 2026 13:46
@jdx jdx disabled auto-merge February 15, 2026 13:47
@jdx jdx enabled auto-merge (squash) February 15, 2026 13:47
@jdx jdx merged commit 7a8c548 into main Feb 15, 2026
35 checks passed
@jdx jdx deleted the fix/edit-boolean-formatting branch February 15, 2026 14:02
@github-actions
Copy link

Hyperfine Performance

mise x -- echo

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.2.13 x -- echo 23.8 ± 0.5 23.1 29.1 1.00
mise x -- echo 24.4 ± 1.2 23.4 40.5 1.02 ± 0.06

mise env

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.2.13 env 23.5 ± 0.4 22.8 24.9 1.00
mise env 24.3 ± 0.8 23.1 28.4 1.03 ± 0.04

mise hook-env

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.2.13 hook-env 24.0 ± 0.5 23.3 26.6 1.00
mise hook-env 24.6 ± 1.1 23.6 41.4 1.02 ± 0.05

mise ls

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.2.13 ls 23.0 ± 0.7 21.9 26.9 1.00
mise ls 23.3 ± 0.5 22.0 24.6 1.01 ± 0.04

xtasks/test/perf

Command mise-2026.2.13 mise Variance
install (cached) 129ms 129ms +0%
ls (cached) 80ms 82ms -2%
bin-paths (cached) 85ms 83ms +2%
task-ls (cached) 830ms 845ms -1%

mise-en-dev added a commit that referenced this pull request Feb 16, 2026
### 🚀 Features

- **(vfox)** allow plugins to request env var redaction via
MiseEnvResult by @jdx in [#8166](#8166)
- add a default_host setting for rust by @aacebedo in
[#8154](#8154)
- add github_content package support for aqua backend by @risu729 in
[#8147](#8147)
- support devEngines.runtime in deno by @risu729 in
[#8144](#8144)

### 🐛 Bug Fixes

- **(asset_matcher)** penalize vsix files by @risu729 in
[#8151](#8151)
- **(edit)** strip formatting whitespace from TOML values in `mise edit`
by @jdx in [#8162](#8162)
- **(install)** improve --locked support for python and ubi backends by
@jdx in [#8163](#8163)
- **(npm)** suppress npm update notifier while npm install by @risu729
in [#8152](#8152)
- **(schema)** add task_templates, extends, and timeout by @risu729 in
[#8145](#8145)

### 🚜 Refactor

- **(registry)** remove [key=value] options syntax from backends by
@risu729 in [#8146](#8146)

### 📚 Documentation

- **(settings)** remove wrong tip for github_attestations by @risu729 in
[#8158](#8158)

### Chore

- **(release-plz)** delete embedded plugins directory before update by
@risu729 in [#8149](#8149)
- adds necessary env var to the mcp help message in cli by @joaommartins
in [#8133](#8133)

### New Contributors

- @joaommartins made their first contribution in
[#8133](#8133)

## 📦 Aqua Registry Updates

#### New Packages (5)

- [`containers/podlet`](https://github.com/containers/podlet)
-
[`hickford/git-credential-azure`](https://github.com/hickford/git-credential-azure)
-
[`hickford/git-credential-oauth`](https://github.com/hickford/git-credential-oauth)
- [`kovetskiy/mark`](https://github.com/kovetskiy/mark)
- [`openbao/openbao/bao`](https://github.com/openbao/openbao/bao)
lucasew pushed a commit to lucasew/CONTRIB-mise that referenced this pull request Feb 18, 2026
jdx#8162)

## Summary
- Fix `mise edit` generating invalid config with booleans like `" true"`
instead of `"true"`
- `toml_edit`'s `Formatted<T>` wrapper preserves original whitespace;
calling `.to_string()` on it includes that whitespace
- Use `.value().to_string()` to extract raw values for `Integer`,
`Float`, `Boolean`, and `Datetime`, matching the existing pattern for
`String`

Fixes jdx#8141

## Test plan
- [x] All 37 existing `mise-interactive-config` tests pass
- [x] All linting passes
- [ ] Manual test: create a `mise.toml` with boolean settings, run `mise
edit`, save without changes, verify booleans remain valid

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Touches config serialization and the `mise set` write-path; while
changes are small and tested, they affect persisted config output and
CLI input handling.
> 
> **Overview**
> Fixes TOML value stringification in `mise-interactive-config` by
extracting the raw value (`.value()`) for integers, floats, booleans,
and datetimes, preventing preserved formatting whitespace from producing
invalid output.
> 
> Adds `mise set --stdin` to read a single env var’s value from stdin
(supports multiline), strips a single trailing newline, and rejects
invalid usage (multiple keys or `KEY=VALUE`). Updates CLI docs/usage,
shell completions (Fig), and adds E2E coverage for the new flag.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
25580bc. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
lucasew pushed a commit to lucasew/CONTRIB-mise that referenced this pull request Feb 18, 2026
### 🚀 Features

- **(vfox)** allow plugins to request env var redaction via
MiseEnvResult by @jdx in [jdx#8166](jdx#8166)
- add a default_host setting for rust by @aacebedo in
[jdx#8154](jdx#8154)
- add github_content package support for aqua backend by @risu729 in
[jdx#8147](jdx#8147)
- support devEngines.runtime in deno by @risu729 in
[jdx#8144](jdx#8144)

### 🐛 Bug Fixes

- **(asset_matcher)** penalize vsix files by @risu729 in
[jdx#8151](jdx#8151)
- **(edit)** strip formatting whitespace from TOML values in `mise edit`
by @jdx in [jdx#8162](jdx#8162)
- **(install)** improve --locked support for python and ubi backends by
@jdx in [jdx#8163](jdx#8163)
- **(npm)** suppress npm update notifier while npm install by @risu729
in [jdx#8152](jdx#8152)
- **(schema)** add task_templates, extends, and timeout by @risu729 in
[jdx#8145](jdx#8145)

### 🚜 Refactor

- **(registry)** remove [key=value] options syntax from backends by
@risu729 in [jdx#8146](jdx#8146)

### 📚 Documentation

- **(settings)** remove wrong tip for github_attestations by @risu729 in
[jdx#8158](jdx#8158)

### Chore

- **(release-plz)** delete embedded plugins directory before update by
@risu729 in [jdx#8149](jdx#8149)
- adds necessary env var to the mcp help message in cli by @joaommartins
in [jdx#8133](jdx#8133)

### New Contributors

- @joaommartins made their first contribution in
[jdx#8133](jdx#8133)

## 📦 Aqua Registry Updates

#### New Packages (5)

- [`containers/podlet`](https://github.com/containers/podlet)
-
[`hickford/git-credential-azure`](https://github.com/hickford/git-credential-azure)
-
[`hickford/git-credential-oauth`](https://github.com/hickford/git-credential-oauth)
- [`kovetskiy/mark`](https://github.com/kovetskiy/mark)
- [`openbao/openbao/bao`](https://github.com/openbao/openbao/bao)
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