Skip to main content

Module bump

Module bump 

Source
Expand description

Release version bumps, opened automatically once a merge lands.

magi’s own “Update & restart” only ever looks at tagged GitHub Releases (src/updater.rs); it never builds or tags anything itself. The tag comes from auto-tag.yml noticing a Cargo.toml version change on main, and nothing in the graph used to touch that field - a merge that changed the phone-facing binary left main ahead of the last tagged release with nobody to notice, and the next “Update & restart” found nothing newer.

This module is the fix. Once crate::land confirms a merge, the caller in crate::graph hands off here: an agent is asked which digit of major.minor.patch the change earns, and this module opens the same chore/release-vX.Y.Z pull request AGENTS.md already documents as the hand-driven recipe, with automerge enabled so CI green is the only thing standing between the merge and the tag.

Everything that can be decided without touching a network or a cargo binary is a pure function - the version arithmetic, the Cargo.toml rewrite, the prompt, the coalescing policy - so the policy itself is asserted directly, the same split crate::land uses for land::decide.

Structs§

BumpDecision
The agent’s answer: which digit, and why.
PendingBump
magi’s own record of a bump pull request it currently has open, so a burst of merges in quick succession does not each open a competing release.
Version
major.minor.patch, the only shape a [package] version in this ecosystem carries in practice.

Enums§

BumpLevel
Which digit of major.minor.patch a change earns.
Coalesce
What a recorded PendingBump means for a fresh decision, given what the base branch’s Cargo.toml says right now. No I/O: the caller reads both the marker and the version.
PendingAction
What a still-open pending bump means once a fresh decision is in hand.

Functions§

after_merge
After a merge lands, ask an agent how big the change was and open a release bump sized to it.
clear_marker
Drop a recorded marker. Best-effort: a marker that is already gone is not an error.
coalesce
Decide what a pending marker means against current_version.
decision_prompt
Build the prompt asking an agent which digit of major.minor.patch a merged change earns.
is_release_only
Did the merged change touch only the release manifest and its lockfile?
marker_path
Where PendingBump is recorded for repo - one file per repository, so a machine running magi against more than one checkout does not confuse their releases with each other.
parse_decision
Parse the agent’s reply. Never returns a default decision: an unparsable or incomplete reply is Err, and the caller must not open a bump pull request on the strength of a guess.
pending_action
Compare a fresh decision against what a still-open pull request already targets.
read_marker
Read a recorded PendingBump, if any. Missing or unreadable both read as “nothing pending” - a marker is bookkeeping, not a source of truth worth failing a merge over.
rewrite_cargo_version
Rewrite the [package] table’s version = "..." line, leaving every other byte untouched.
should_release_bump
Does this run’s final status mean the merge this call is downstream of actually happened?
write_marker
Persist marker, atomically - the same tmp-then-rename shape crate::updater::write_progress uses, since this file is read by a later, unrelated process invocation and must never be seen half-written.