Skip to content

fix(hook): the singleton scan reads mise's subcommand, not its first argument - #973

Merged
wenzowski merged 1 commit into
mainfrom
claude/eloquent-babbage-mbto6k
Sep 17, 2026
Merged

wenzowski merged 1 commit into
mainfrom
claude/eloquent-babbage-mbto6k

Conversation

@wenzowski

Copy link
Copy Markdown
Contributor

What

singleton_task_started (crates/batten/src/hook.rs) recognised a guarded start
with arguments.first() != Some("run"), so it saw mise run land and nothing
else. mise takes its own options before the subcommand, and every one of
them moves run off index 0:

  • mise -C /repo run land
  • mise -E dev run land

Both start land. Neither was seen, so the segment was skipped, no lock was
looked up, and a second land ran with no singleton — an under-deny on exactly
the collision CLOUD-438 exists to stop.

The third measurement of one class

CLOUD-857 found this anchor as split(command, " ")[0], CLOUD-1382 as
segment.words[0], and this is the same mistake one layer in, over a program's
own argv. destructive_reset_target two functions down had already been fixed
for it and reached its verb through a scan that skips options and the values they
consume. The two sat side by side answering one question two different ways.

How

The resolver is shared rather than copied. git_subcommand becomes
subcommand_index(arguments, value_options) — the same scan, parameterised by
the option set — and both call sites use it: git with GIT_VALUE_OPTIONS, mise
with MISE_VALUE_OPTIONS. A second scan beside the first is the second-authority
defect destructive_reset_target's own comment refuses to grow, and it is what
let these two drift. The task scan past run is the same question one position
along, so it is the same call rather than a third loop.

A widening of the anchor, never a replacement: mise run land is still
recognised, a mise call that is not run still is not, and run naming no
task still resolves nothing to look up.

MISE_VALUE_OPTIONS now documents both positions, because mise accepts these
globals before run as well as after, and a set covering only the second left
the first unseen.

Tests

crates/batten/tests/it/singleton_gate.rs, over the compiled binary:
an_option_before_the_subcommand_does_not_hide_the_task — seven denied spellings
including a valueless global and both positions at once, plus the anti-vacuity
half: a global before another subcommand, before another task, mise --version,
and run with no task at all must all still allow.

Shown able to fail by restoring the first-token anchor: the new case reddens on
mise -C /repo run land and the other eight stay green, so it discriminates the
defect rather than the gate.

The cases go here rather than in the singleton_guard.rs the Ready block names —
the fixture, the four lock states and the sibling case for options after run
all live in this file, and a second one would fork them.

Closes CLOUD-1555

🤖 Generated with Claude Code

https://claude.ai/code/session_01Qbw3zwPXfwifgfg4ckf9Bm

@coderabbitai

coderabbitai Bot commented Sep 17, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 50 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: f21f4a60-4173-4abc-b761-63e333aa50a1

📥 Commits

Reviewing files that changed from the base of the PR and between 8fe8429 and 247c886.

📒 Files selected for processing (2)
  • crates/batten/src/hook.rs
  • crates/batten/tests/it/singleton_gate.rs

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.

…argument

`singleton_task_started` recognised a guarded start with
`arguments.first() != Some("run")`, so it saw `mise run land` and nothing else.
`mise` takes its own options BEFORE the subcommand, and every one of them moves
`run` off index 0: `mise -C /repo run land` and `mise -E dev run land` both start
`land`, both were skipped, and a second `land` ran with no singleton — an
under-deny on exactly the collision CLOUD-438 exists to stop.

The third measurement of one class. CLOUD-857 found it as `split(command, " ")[0]`,
CLOUD-1382 as `segment.words[0]`, and this is the same anchor one layer in, over a
program's own argv. `destructive_reset_target` two functions down had already been
fixed for it and reached its verb through a scan that skips options and what they
consume; the two sat side by side answering one question two ways.

So the resolver is SHARED rather than copied. `git_subcommand` becomes
`subcommand_index(arguments, value_options)` — the same scan, parameterised by the
option set — and both call sites use it, git with `GIT_VALUE_OPTIONS` and mise with
`MISE_VALUE_OPTIONS`. Writing a second scan beside the first is the second-authority
defect `destructive_reset_target`'s own comment refuses to grow, and it is what let
these two drift. The task scan past `run` is the same question one position along,
so it is the same call rather than a third loop.

A widening of the anchor and never a replacement: `mise run land` is still
recognised, a `mise` call that is not `run` is still not, and `run` naming no task
still resolves nothing to look up.

`MISE_VALUE_OPTIONS` now documents both positions, because `mise` accepts these
globals before `run` as well as after and a set covering only the second left the
first unseen.

The cases go in `crates/batten/tests/it/singleton_gate.rs` rather than the
`singleton_guard.rs` the Ready block names: the fixture, the lock states and the
sibling case for options AFTER `run` all live there, and a second file would fork
them. Shown able to fail by restoring the first-token anchor, which reddens the new
case and leaves the other eight green.

Refs: CLOUD-1555
@wenzowski
wenzowski force-pushed the claude/eloquent-babbage-mbto6k branch from c14adf0 to 247c886 Compare September 17, 2026 16:36
@wenzowski
wenzowski marked this pull request as ready for review September 17, 2026 16:36
@wenzowski
wenzowski marked this pull request as draft September 17, 2026 20:49
@wenzowski
wenzowski marked this pull request as ready for review September 17, 2026 20:49
@wenzowski

Copy link
Copy Markdown
Contributor Author

/fast-forward

@wenzowski
wenzowski merged commit 247c886 into main Sep 17, 2026
35 of 36 checks passed
@wenzowski
wenzowski deleted the claude/eloquent-babbage-mbto6k branch September 17, 2026 21:03
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