Skip to content

docs+test(mise): guard against disabling lock enforcement in the convergence path#729

Merged
mkobit merged 4 commits into
mainfrom
fix/mise-lock-enforcement-guardrail
Jul 20, 2026
Merged

docs+test(mise): guard against disabling lock enforcement in the convergence path#729
mkobit merged 4 commits into
mainfrom
fix/mise-lock-enforcement-guardrail

Conversation

@mkobit

@mkobit mkobit commented Jul 20, 2026

Copy link
Copy Markdown
Owner

Summary

  • dot_config/mise/AGENTS.md: documents why script 06 now regenerates the global mise.lock (mise merges the global config into any mise install -C <dir> call, so script 07's locked repo-tools install re-validates global tools too) and makes explicit that script 07 must never gain a MISE_LOCKED=0-style bypass.
  • tests/integration/test_lock_enforcement.py: regex-based pytest checks that (1) root mise.toml keeps locked = true, (2) any run_onchange_after_* script installing from the repo-tracked mise.toml has no lock bypass, (3) every uv sync in .github/workflows/*.yml keeps --frozen/--locked. Dynamically parametrized over the real files on disk via chezmoi source-path/glob, not hardcoded filenames.
  • tests/integration/conftest.py: chezmoi_source_root (and the new repo_root) now resolve via chezmoi source-path instead of __file__ parent-walking, matching how chezmoi_dest already resolves via chezmoi target-path.

Prompted by #728: an agent-authored PR "fixed" a locked-install CI failure by disabling locked mode in the deployment script instead of regenerating the stale lockfile it was validating against. This guard would have caught that at the PR stage.

Test plan

  • uv run pytest tests/integration/test_lock_enforcement.py passes locally
  • Manually reintroduced MISE_LOCKED=0 into script 07 and confirmed the test fails on it, then reverted
  • uv run pytest tests/integration -q — no new failures vs baseline
  • uv run ruff check / ruff format --check / uv run ty check all pass
  • CI green on this PR

mkobit added 4 commits July 19, 2026 20:29
…lock enforcement

AGENTS.md: explain why script 06 now regenerates the global mise.lock
(mise merges global config into any -C <dir> install, so script 07's
locked repo-tools install re-validates global tools too) and make
explicit that script 07 must never gain a MISE_LOCKED=0-style bypass --
that's what keeps uv pinned to the committed mise.lock.

CI: add a regex guard (mise.toml locked = true, no lock bypass in
script 07, uv sync always --frozen/--locked in ci.yml) so an
agent-authored PR that "fixes" a locked-install failure by disabling
the check fails CI instead of merging quietly, per #728.
…est test

Swaps the standalone check-lock-enforcement.yml workflow for
tests/integration/test_lock_enforcement.py: it's pure source-tree
reading (mise.toml, script 07's template, ci.yml), needs no deployed
environment, and already runs for free in the existing integration
job's `uv run pytest tests/integration` -- no new CI wiring needed.
… __file__ math

chezmoi_source_root previously assumed src/chezmoi lived exactly three
parents above the test file; now it asks chezmoi itself via
`chezmoi source-path`, which honors .chezmoiroot and matches how
chezmoi_dest already resolves via `chezmoi target-path`. Same helper is
reused at collection time for the chezmoiscript_path/workflow_path
glob-parametrization in pytest_generate_tests, replacing the equivalent
__file__-based computation there too.

repo_root is now derived from that resolved source root
(chezmoi_source_root.parent.parent) rather than its own independent
__file__ guess.
CHEZMOI_CONFIG/CHEZMOI_DEST aren't visible to the plain subprocess call
inside the integration job's `mise exec -- uv run pytest` step, so
_chezmoi_source_path() silently fell back to chezmoi's bare default
($HOME/.local/share/chezmoi) and resolved garbage. Pytest always runs
from the repo root, so anchor on that directly via --source instead of
depending on config env vars this call doesn't need in the first place.
@mkobit
mkobit merged commit 09fc27d into main Jul 20, 2026
6 checks passed
@mkobit
mkobit deleted the fix/mise-lock-enforcement-guardrail branch July 20, 2026 03:46
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