Skip to content
Castellan
Steward's icon

How-to · Steward

Read as

Versions claimed up front

Ask the Steward for a version before work starts, so two pieces of work never take the same one; how claims are chosen, shared and given back, and keeping changelog entries in a changes folder, which the build stamps.

Article
1305
Applies to
Steward 0.36.139
Last reviewed
For
For developers
Written for Steward 0.36.139. Steward is at 0.36.354 now (40 small releases since: what changed).

Why claim a version#

Two pieces of work started side by side on one repository would each take "the next version" when they began: the same one. The second found out only when it conflicted on its way in. Instead, whoever starts the work, you or your AI coding assistant, asks the Steward for its version first, once the branch is known.

Claim one#

In a terminal:

node $HOME\.steward\app\src\cli.ts claim-version example-app --branch feature/search --for "search in the toolbar"

It answers with the version, and the files to set it in:

Example App 1.4.3: yours. Set it in package.json, package-lock.json.
  • The repository can be its id, its name, or owner/name: one the Steward looks after, one Reeve found on this PC, or the clone the command runs in.
  • --branch is the branch the work is on. The same branch asking again gets the same version ("claimed already for this branch").
  • --for says what the work is, for whoever looks at the claims.
  • --minor asks for the next minor version rather than the next patch.
  • --by says who's asking.
  • --json prints the claim as JSON, for scripts.

Set exactly the version it hands out, in the files it names, and in the changelog: other work started beside yours has claimed the ones around it.

How the version is chosen#

It's the next version no one has. That's above all of these:

  • the version on the repository's branch on its host;
  • every release;
  • every open pull request's version, read from its title;
  • every live claim.

Claims are handed out one at a time, so two pieces of work asking at once get two versions. Put the version in your pull request's title (Example App 1.4.3: search in the toolbar), as that's where the Steward reads it.

How long a claim lasts#

A claim lives until:

  • its version is on the branch, or a release has overtaken it (the work landed);
  • you give it back;
  • three days go by with no open pull request that names it (by its branch, or its version in the title).

Each round lets go of the ones that ended. Nothing holds a pull request for its version: claiming first is what keeps two pieces of work apart. Merged out of order, a version below one already released isn't released. See Versions merged out of order.

Give one back when the work is dropped:

node $HOME\.steward\app\src\cli.ts release-version example-app 1.4.3

List them with claims (or claims --json).

Across your PCs#

Claims are shared by every PC that looks after the repository, through a ref in the repository's own remote (refs/manor/claims), with plain git. When the remote can't be reached, the claim is made on this PC alone, and shared at the next round that reaches it. If another PC claimed the same version meanwhile, the page marks it: give that one back with release-version, and claim a new one for that work. See The Steward on several PCs.

Changelog entries in a changes folder#

Pull requests side by side still meet in the same lines: the version files, and the top of CHANGELOG.md. A repository can avoid that altogether.

Add a changes/README.md to the repository's branch (it can say anything: what the folder is for). From then on:

  1. claim-version claims nothing. It says the repository rides the build pipeline, and names the file to write the entry in: changes/<your branch>.md, the branch's name as one word, such as changes/feature-search.md.
  2. The work adds that one file: its entry (its bold line, then its sections), without a ## <version> heading, and leaves the version files and CHANGELOG.md as they are. A first line minor: true asks for a minor step.
  3. You merge it, as any pull request.
  4. The next build stamps it. Every entry merged since the last release goes under one version: the branch's own, if it isn't released yet, else the next free one above the last release. It's set in the version files, the entries are folded into CHANGELOG.md under ## <version> (several together as one entry, "Brings 3 changes: …"), and the files are deleted, all in one commit. The Steward opens a pull request for it ("Example App 1.4.3: version and changelog, stamped by the Steward"), merges it, and the build releases it.

An entry that says nothing, or whose heading names another version, isn't stamped: it waits for whoever wrote it.

A release then carries the entries of every version merged since the release before, so one release after several merges loses no notes.

Is this page right?

If something on it is wrong or out of date, tell us and we'll fix the page.

Still stuck? Write to support@castellan-software.com and mention article 1305. Every version of Steward, and what changed in it, is in its release notes.