Skip to content

Force activate_aggressive off for the mutated-hook checks only - #3018

Merged
jeremy merged 1 commit into
mainfrom
prek-hook-aggressive
Aug 2, 2026
Merged

Force activate_aggressive off for the mutated-hook checks only#3018
jeremy merged 1 commit into
mainfrom
prek-hook-aggressive

Conversation

@jeremy

@jeremy jeremy commented Aug 2, 2026

Copy link
Copy Markdown
Member

Follow-up to the negative control added in the previous PR. Reported on queenbee#1513. Test harness only — the production hook is untouched and was never affected.

The defect

With MISE_ACTIVATE_AGGRESSIVE on, mise exec prepends the resolved install dirs to the very front of PATH — ahead of the decoy — instead of inserting them before the retained shims entry. Measured:

AGGRESSIVE=0   in  decoy:/usr/bin:$shims:/bin   out  decoy:/usr/bin:«installs»:$shims:/bin
AGGRESSIVE=1   in  decoy:/usr/bin:$shims:/bin   out  «installs»:decoy:/usr/bin:$shims:/bin

That repairs the mutated hook, so the negative control cannot demonstrate sensitivity and correctly goes red. A developer with the setting on sees 26/28 against a completely correct production hook — a false failure, which is the exact class of harness bug this whole line of work exists to remove.

Confirmed on merged master, both platforms: AGGRESSIVE=1 → 26/28, AGGRESSIVE=0 → 28/28.

The fix

Force MISE_ACTIVATE_AGGRESSIVE=0 for the mutated-hook invocations only.

The real-hook scenarios keep whatever the developer has set. That is their actual session, and the hook genuinely resolves correctly for them either way — under aggressive activation the installs are prepended, which is if anything more robust. It is only the mutation that needs the canonical ordering in order to mean anything.

Forced to 0, not unset. activate_aggressive is a real mise setting — mise settings get activate_aggressive reports it rather than Unknown setting — so a config file can turn it on with no variable in the environment at all, and only an explicit 0 overrides that. An env -u would have left that case broken.

Verification

Both platforms, at this exact head; test file sha256-identical across all five repos.

  1. shellcheck clean.
  2. Green under every configuration of the setting: variable =0, variable =1, variable absent, and activate_aggressive = true set via a config file (the case a bare unset would have missed). 28/28, launchpad 34/34.
  3. The control is still sensitive — forcing the setting off did not make it vacuous. Pointed at the unmutated hook it goes red in both activation modes under both AGGRESSIVE=0 and AGGRESSIVE=1; with the probe output forced empty it goes red too.
  4. Pre-fix behaviour reproduced on Arch for the record: merged master's test is 26/28 under AGGRESSIVE=1.

Reported on queenbee#1513. With MISE_ACTIVATE_AGGRESSIVE on, `mise exec`
prepends the resolved installs to the very front of PATH -- ahead of the decoy
-- instead of inserting them before the retained shims entry. That repairs the
mutated hook, so the negative control cannot demonstrate sensitivity and goes
red: 26/28 for a developer with the setting on, against a correct production
hook. A harness defect, not a hook defect.

The real-hook scenarios keep whatever the developer has set. That is their
actual session, and the hook does resolve correctly for them either way; it is
only the mutation that needs the canonical ordering to mean anything.

Forced to 0 rather than unset. activate_aggressive is a real mise setting, so a
config file can turn it on with no variable in the environment at all -- `mise
settings get activate_aggressive` reports it rather than "Unknown setting" --
and only an explicit 0 overrides that. Verified 28/28 with the variable set to
0, set to 1, absent, and set true via a config file; and the control still goes
red against an unmutated hook under both settings, and against empty probe
output.
Copilot AI review requested due to automatic review settings August 2, 2026 03:54

Copilot AI 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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@jeremy
jeremy merged commit fb5ebe3 into main Aug 2, 2026
13 of 14 checks passed
@jeremy
jeremy deleted the prek-hook-aggressive branch August 2, 2026 04:22
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