Skip to content

fix(lockfiles): write only the updated tools' mise.lock entries - #393

Merged
sweepies merged 3 commits into
mainfrom
fix/mise-lock-keys
Nov 23, 2026
Merged

sweepies merged 3 commits into
mainfrom
fix/mise-lock-keys

Conversation

@sweepies

@sweepies sweepies commented Nov 23, 2026 •

Copy link
Copy Markdown
Owner

Two bugs held most mise tool updates on this repository's dashboard.

Version skew ("mise lock changed unrelated entries or lockfile metadata"). mise rewrites the whole lockfile. Our committed mise.lock was written by a newer mise, which recorded checksum_source = "mise-versions" on some platform entries. The Count's pinned mise (2026.10.11) doesn't know that field and drops it from unrelated tools, so the Count held every mise update. Reproduced by hand with the real binaries in the Count's sandbox environment: 2026.10.11 drops the field, while 2026.10.25, 2026.11.5 and 2026.11.12 leave unrelated entries byte-identical. Any repository whose developers run a newer mise than the Count hits the same hold. Dropping the field would also be wrong to publish: it marks a checksum no download confirmed.

The Count now writes only what it asked for:

  • Unchanged entries keep their committed bytes. That includes entries mise left alone and entries it wrote back with fields left out.
  • A selected tool that mise changed takes mise's entry. Its sections are grafted into the committed text.
  • Any other change still holds, and now names what changed: another tool's entry, an entry added or removed, or anything outside tools, such as lockfile_version.
  • The grafted text must parse back to the committed lock with exactly the taken entries replaced, or the update holds.

Key mismatch ("mise lock removed a selected tool"). The Count looked tools up in the lock by their manifest key, such as github:github/gh-actions-lock[bin=gh-actions-lock]. mise records them by their short name: no bracketed options or core:, and nodejs, golang and dotnet-core unaliased (BackendArg::from, strip_opts and unalias_backend in mise's source). The keys were checked against the real mise 2026.11.12. The new lock_key in crates/tools/src/lockfiles/mise.rs gives that name (kept out of crates/mise so cached extraction state is not invalidated), and the Count still passes mise the manifest's spelling. Several places shared the flaw:

  • Maintenance couldn't lock a tool declared with options.
  • Platform selection fell back to every platform in the file.
  • A task's nodejs beside [tools].node went unnoticed. Two declarations that mise records under one name now hold.

Fable 5.2 reviewed the design. Its points that shaped this change:

  • A changed unrelated entry must still hold, because that check is the only guard on the key mapping.
  • Lockfile format 4 arrived in mise on 2026-11-03, and 2026.10.11 can't read it. Moving the Count's mise pin is a separate change; this PR doesn't do it.

Known gap: in a multi-version declaration, unchanged sibling entries inside a changed selected tool still come from mise's output.

Tests use the fake mise and are behavioural:

  • Unrelated bytes from a newer mise are kept.
  • Each kind of unasked-for change holds.
  • Tools are found under mise's name for three spellings.
  • Two spellings of one tool hold.
  • Maintenance works with a bracketed key and keeps unchanged bytes.

Four of the new tests fail on main. cargo test -p patchula-tools and clippy pass. The guide's mise.lock section is updated.

View guided diff Turn on auto-fix

mise writes the whole lockfile back, and the Count's mise drops fields a
newer mise wrote (`checksum_source`), so every mise update in a repository
locked by a newer mise was held for "unrelated entries". The Count now
grafts only the selected tools' entries that mise changed into the
committed lock and keeps every other byte. An entry mise wrote back
without fields keeps its committed bytes. Any other change still holds,
now naming what changed: another tool's entry, an entry added or
removed, or the lockfile's own metadata.

Tools are found under the name mise records them by (`lock_key`): no
bracketed options or `core:`, and `nodejs`, `golang` and `dotnet-core`
unaliased. A tool declared with options, such as
`github:github/gh-actions-lock[bin=gh-actions-lock]`, was held as
"removed a selected tool", and maintenance could not lock it at all. Two
declarations mise records under one name hold.
@sweepies
sweepies merged commit 4b8505a into main Nov 23, 2026
13 checks passed
@sweepies
sweepies deleted the fix/mise-lock-keys branch November 23, 2026 20:47
@sweepies-ops sweepies-ops Bot mentioned this pull request Nov 23, 2026
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