Skip to main content

Module version

Module version 

Source
Expand description

The version: the one place it is authored, what is derived from that place, what the contract requires next and what the commits imply as evidence, and the one writer that raises it.

The product version is authored in exactly one place, the [package] version line of the crate manifest (MANIFEST). Every other statement of it is derived from that line and checked, or is a record of a version that was released:

  apps/majordomus-cli/Cargo.toml   authored    the one place; `release bump` writes it
  crate::VERSION                   compiled    cargo's CARGO_PKG_VERSION
  share/version.txt                projected   `majordomus generate`; bin/majordomus reads it
  apps/majordomus-cli/Cargo.lock   derived     cargo's record; the writer keeps it in step
  generator stamps, the changelog  generated   `majordomus generate`
  .ai/repo/releases/*.yaml         records     the release pipeline, after publication

The shell tool used to state the version a second time, by hand, because an installed tree has no Cargo.toml and the tool cannot read one at run time. It reads PROJECTION instead: a typed generated artifact that ships in every archive beside the tool, that generate --check refuses when it falls behind the manifest, and that nobody edits. diagnose is what refuses a version anybody writes down by hand where the tool’s own files live.

One reader of the authority per language: declared here, scripts/release-version in shell. Nothing else parses the manifest for its version.

use majordomus_cli::release::version::{declared_in, parse_projection, render_projection};
// the authority, and the one line the shell tool reads back from its projection of it
let authority = declared_in("[package]\nversion = \"0.9.0\"\n").unwrap();
assert_eq!(parse_projection(&render_projection(&authority)).as_deref(), Some("0.9.0"));

Structs§

Carrier
One version written down by hand where the tool’s own files live.
Selection
The release selection: the contract’s analysis against the last release, and the version report decided from it — made once, by one function.
Version
A semantic version, only as much as this needs.

Enums§

Bump
How much a set of changes raises a version.
ProjectionState
How PROJECTION stands against the authority.

Constants§

CARRIER_ROOTS
Where the tool’s own files live, and so where a version written by hand is refused.
LABEL_HISTORY
The documents that describe a past version and are allowed to name it by label, one <path> <reason> per line. A record of the design phase says “v0.1” because it is about v0.1; a page describing the tool as it stands says it because nobody changed it.
LABEL_HISTORY_INVALID
The diagnostic id of a LABEL_HISTORY entry that cannot be honoured: no reason, a path that is not tracked prose, or a document that no longer carries a label.
LABEL_IN_PROSE
The diagnostic id of a version label — v0.1, a major and a minor with no patch — typed into hand-written prose, where it states which version the text describes.
LOCK
The lock file, which records the crate’s own version alongside every dependency’s.
MANIFEST
The crate manifest: the one place the version is authored.
PROJECTION
The projection of the version the shell tool reads at start-up, from beside itself.
PROJECTION_STALE
The diagnostic id of a projection that is behind the manifest, or missing: the state between a bump and the derivation after it. A warning — generate --check refuses it.
STATED_BY_HAND
The diagnostic id of a version written down by hand where the tool’s files live.
WRITERS_DISAGREE
The diagnostic id of a projection ahead of the manifest, or unrelated to it: a version no derivation produces, so somebody wrote it.

Functions§

bump_of
What a set of conventional commits says about itself.
carrier_shape
The shape a line states a version in, when it states one.
carriers
Every version written down by hand under CARRIER_ROOTS.
commits_imply
The version the commit subjects imply: the last release raised by their bump — from the declared version only when nothing was released. Evidence, never the answer on its own.
decide
Who answers next, and with what: the contract when it could be measured, and no one when it could not.
declared
The version the crate manifest declares: the authority.
declared_in
The [package] version of a manifest’s text.
default_target
The version release bump raises to when no target is named: the report’s next, the declared version when nothing would be released — and a refusal, with the report’s reason, when the contract could not be measured and so no one decided.
diagnose
Everything wrong with where the version is stated: the projection against the authority, and every version written down by hand where the tool’s own files live.
label_diagnostics
Every version label typed into hand-written prose outside a declared history, and every history entry that cannot be honoured.
locked
The version the lock file records for this crate.
parse_projection
The version PROJECTION states: its first version= line, past the # banner.
projection_current
Whether PROJECTION states what MANIFEST declares — the one comparison every surface reports as agree.
projection_state
How PROJECTION stands against MANIFEST: compared as versions, so that a projection behind the manifest — what a bump leaves until the derivation runs — is told apart from one ahead of it or unrelated to it, which no derivation ever writes.
render_projection
The body of PROJECTION: one version= line, which bin/majordomus reads with shell builtins alone. majordomus generate puts its provenance banner above it.
report
The whole version answer: what is declared, whether the projection the shell tool reads states it, what the public contract requires next, and what the commits since the last release imply — as evidence.
select
Make the release selection (Selection): analyse the contract against the last release, refuse a guess (crate::release::compat::VersionPlan::measured_version), and decide the report from what is left (report).
tool
The version the shell tool prints: what PROJECTION states.
version_labels
Every version label on a line: v, a major and a minor, and no patch — v0.1, v1.2.
write
Write to into the one place the version is authored, keep the lock’s record of it in step, and say which files changed.