Skip to content

Keep commas in env values and accept bare KEY=VALUE args in env set - #1197

Merged
evanphx merged 2 commits into
mainfrom
mir-1168-usage-of-commas-in-env-set-e-is-probably-wrong
Sep 10, 2026
Merged

evanphx merged 2 commits into
mainfrom
mir-1168-usage-of-commas-in-env-set-e-is-probably-wrong

Conversation

@evanphx

@evanphx evanphx commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Fixes MIR-1168.

miren env set -e KEY=a,b,c was setting three variables (KEY=a, b, and c) because the flag library splits every repeatable string flag on commas. Once split, the pieces cannot be told apart from three separate -e flags, so the fix lives in mflags: a split:"false" struct tag that keeps each flag occurrence whole (mirendev/mflags#16, merged).

This PR:

  • Bumps mflags to the merge commit of Add split:"false" tag to keep string array values whole mflags#16.
  • Applies split:"false" to the -e and -s flags of env set and deploy, and to --org on auth provider add github, whose documented name:team1,team2 form was being split the same way.
  • Lets env set accept bare KEY=VALUE arguments with no flag, treated the same as -e. Docs and an example cover this.

Tests go through the real flag set for all three commands. The command docs were regenerated and show no drift beyond the env set changes.

The flag library split every repeatable string flag on commas, so
`miren env set -e KEY=a,b,c` arrived as three entries: KEY=a, b, and c.
mflags now has a split:"false" struct tag that keeps each occurrence
whole. This bumps to that version and applies the tag to the -e and -s
flags of env set and deploy, and to --org on auth provider add github,
whose documented name:team1,team2 form was being split the same way.

env set also accepts bare KEY=VALUE arguments with no flag, treated the
same as -e.

Fixes MIR-1168.
@evanphx
evanphx requested a review from a team as a code owner September 10, 2026 20:40
@coderabbitai

coderabbitai Bot commented Sep 10, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 39647b33-8273-4690-bbbf-670bcc38c098

📥 Commits

Reviewing files that changed from the base of the PR and between 15dd8fd and 1b2fee8.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (7)
  • cli/commands/auth_provider_github.go
  • cli/commands/commands.go
  • cli/commands/deploy.go
  • cli/commands/env.go
  • cli/commands/env_set_flags_test.go
  • docs/docs/command/env-set.md
  • go.mod

Included review availability: 4 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 6 reviews per hour.


📝 Walkthrough

Walkthrough

The CLI now preserves comma-containing environment, sensitive, deployment, and GitHub organization arguments as single values. env set accepts positional KEY=VALUE arguments and combines them with flagged values. Tests, command help, and documentation cover the updated parsing behavior.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 1b2fe

This change stops the CLI from incorrectly splitting comma-containing environment values and GitHub team lists, and adds support for bare KEY=VALUE arguments in env set. The behavior is covered by new tests and documentation, and no unresolved correctness or stability concerns were found in the reviewed parsing paths.


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

@miren-code-agent miren-code-agent 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.

🍪 biscuit: ✅ ready to merge — auto-review, non-blocking

I read through this change carefully. It does two concrete things: adds split:"false" to every []string flag that was being silently comma-split (fixing the root bug), and adds a rest:"true" positional-args field to EnvSet so users can write miren env set KEY=VALUE KEY=VALUE without -e. Both changes are wired correctly and consistently through the three affected commands (env set, deploy, auth provider add github).

What I checked:

  • The split:"false" fix is applied to all four []string flags that needed it (Env, Sensitive in both env.go and deploy.go, and Orgs in auth_provider_github.go). I didn't find any other []string flag that handles comma-sensitive values that was left un-fixed.
  • The merge in EnvSet of bare args into env via slices.Concat(opts.Env, opts.Args) is correct. The envSetReference path, the "nothing specified" guard, and ParseEnvVarSpecs all consistently use the merged slice.
  • A bare positional arg without = (e.g. miren env set MYVAR) flows into parseEnvVarSpec, which already treats any arg without = as a "prompt for value" case — that's existing behavior, not a regression from this PR.
  • The three new tests in env_set_flags_test.go are well-targeted: they exercise comma preservation in flag values, interleaved bare args and flag args being routed to the right fields, and the GitHub org team-list round-trip through buildGitHubConfigJSON. The TestAuthProviderGitHubOrgTeamsSurviveParsing test is especially useful because it validates the semantic impact of the split fix, not just the parsed slice.
  • The mflags dependency bump (go.mod/go.sum) is what actually delivers the split:"false" feature; the hashes look consistent and there are no other unexpected dependency changes.
  • Documentation (commands.go, docs/docs/command/env-set.md) accurately describes both features.

The change is clean and self-contained. I'm comfortable approving it.


🍪 full review note · comment /biscuit review to run biscuit again.

@phinze phinze left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved upstream so you can repin to the merged commit

@evanphx
evanphx enabled auto-merge September 10, 2026 23:06
@evanphx
evanphx merged commit 3cc89d6 into main Sep 10, 2026
31 checks passed
@evanphx
evanphx deleted the mir-1168-usage-of-commas-in-env-set-e-is-probably-wrong branch September 10, 2026 23:13
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.

2 participants