Version numbers are decided too early
I redesigned how Trinity numbers releases three times in six months. The third time, I stopped deciding the number at all until the release landed, and then spent a month trying to break it on seven real repos.
Lorenzo Wynberg · November 20, 2026 · 11 min read
Everyone decides version numbers early. You plan the next release, you call it 1.4.0, and that number goes on the ticket, the branch, the changelog draft and the conversation. It feels like the obvious order of things: first you know what you're shipping, then you ship it.
It works as long as releases happen one at a time.
That's when there's a number at all. For years I led development on my company's side of Costa Rica's national education platform. We won the work through public tenders and contracts and built it with the Ministry of Education, alongside other teams working on the ministry's systems. Not one of those systems I used had a version anyone knew. Not SABER, the main one, which I worked on more than any, and not the others I used as a tester. If you asked which version was running, there was no answer to give. It wasn't for lack of wanting it. The ministry wanted versioning; it genuinely didn't know how to handle it. Everyone was busy building the projects themselves, across multiple teams, and working out versioning on top of that never got its turn. Some teams even kept their own separate, private copy of a repo, out of fear that someone from another team, mine included, would break something. And a couple of times, someone did. And the ministry itself was often in the dark for long stretches, waiting to hear where things stood.
That's where I think a system like this pays off many times over, whether it's Trinity or another one, built in-house or adopted. An organization with several teams, contracts and systems has needs that are hard to meet by hand, and versioning is one of them. With a system where the hard parts and the coordination mostly work themselves out, it gets those for free, and a lot of load comes off the people maintaining everything. Things are just more structured out of the box, so nobody needs a private copy of a repo to feel safe. It changes the other side too. It's their repo and their system, so they should be able to see it. With a system like this, the people the work is for can be right there and check what's going on whenever they want, instead of waiting for an update.
Trinity is built around releases. You plan a project as releases, agents build each release's stories, and a release is what lands, gets tagged and ships. And it doesn't do them one at a time. It runs several in parallel, and they finish in whatever order they finish. I knew that from the start. It still took me three versioning designs to stop assuming the opposite.
This is how that went, including the parts I'm less proud of.
Three models in six months
1 · May–June 2026
Grade it at tag time
Each repo's next number computed from its latest tag, at the moment it's tagged.
Fine for one release at a time. Nothing else.
#423 · 0.3.1
2 · Aug–Oct 2026
Declare it at plan time
The Architect proposes the version, a story writes it, the manifest holds it.
Two releases in flight: the one that finishes second has to renumber, or park.
#4676 · shipped in 0.6.0
3 · From Oct 18, 2026
Assign it at landing
The line's current version plus the release's graded bump, or its pin, decided when it lands.
Ten scenarios, three passes, seven real repos to find out.
#6535 · shipped in 0.7.0
The first model graded each repo's bump at the moment it was tagged: look at the latest tag, look at what landed, compute the next number. For one release at a time, it's correct and simple. I wrote about it in June, in a post about the release pipeline, and I believed it.
The second model was the one I thought was mature. The version became a declared fact: the Architect, Trinity's planning agent, proposes the number while planning; a story writes it into the package's manifest; the manifest holds it. I was confident enough that the design issue says, about writing manifests:
The read closes the gap; the write was never Trinity's.
That shipped in 0.6.0, in October, with maintenance lines and release candidates on top of it. And it had a flaw I documented myself, in the agent's own instructions, a minute before midnight on October 17:
The one out-of-order cost is a renumber. If v0.3.0 ships before v0.2.0 has integrated, v0.2.0 can no longer ship as 0.2.0.
Read that again with parallel releases in mind. In a product whose whole point is running releases side by side, I'd written down, as an accepted cost, what happens every time they finish out of order.
About an hour and a half later I filed seven issues that replaced the model.
The race
Here's the problem in its smallest form. Release A is planned first. Release B is planned second. B finishes first.
Release A
planned first
planned as 0.2.0
Release B
planned second, finishes first
planned as 0.3.0
The line
0.1.0
A is planned first and takes 0.2.0. B is planned next and takes 0.3.0.
Under plan-time numbers, A parks. It sorts below a version that's already shipped, so it's refused until someone edits its bump story to a higher number. In a system where agents plan and ship, "someone" is a person babysitting numbers. And it gets worse with every release in flight.
What I read before deciding
Before writing the new model, I went looking for who'd solved it. The prior-art line in the umbrella issue is short, and it's the honest summary:
Changesets / Nx version plans (declared bump, number computed at release), release-please
Release-As(one-shot pin); GitFlow's cut-time numbering is what breaks with two release branches in flight; no tool models builds-on.
The useful part was that the good tools had already separated two things I'd fused: what kind of change a release is (patch, minor, major) and what number it gets. Changesets and Nx record the first and compute the second at release time. release-please lets you pin a number once when you need to. Package managers (npm, cargo, twine) all take the number from the manifest and treat the tag as a label on a commit.
What none of them modelled was a release that builds on another release that hasn't landed yet. That part I'd have to design.
The rule
The whole model fits in one sentence from the code:
A release gets its version when it lands on its line: the line's current version for the unit plus the release's graded bump, or the version the release is pinned to.
Everything else follows from that:
- Numbers follow landing order. Whichever release lands first takes the next number. A release card says what it would land as right now ("Lands as v1.3.0"), and updates when another release lands first.
- A release branch carries no version. So merging one release into another never conflicts on a version field. Files two releases both change conflict once, at the second landing, and never because of a number.
- Patches and minors land on their own. The release card shows what it would land as before it does, and you can declare a different bump or pin an exact version.
- A major is never minted silently. If a change breaks a public contract, the bump is raised to major even when it was graded smaller, and the release stops and asks: this release is breaking, land it as 2.0.0? Declaring the major up front is the go-ahead.
- Some questions always go to a person. A major, a pin the line has passed, a version that fails its check: the release parks at the version check, and no autonomy level can answer it for you, not even fully unattended. Unattended means agents don't wait on you for routine work, not that a version number gets decided without you.
- You can pin a release to an exact version: a major, a minor or a patch, as long as it's above what the line already has. A pin reserves nothing, though. Releases without a pin don't wait for it, so if the line passes the pinned number first, the pin is refused and a person re-pins it.
- A hotfix stays below unshipped work. It lands on production as a patch above what shipped, and always below what dev is holding. Then production is forward-ported to dev.
- A maintenance line takes patches only. A release graded minor is refused on a
1.4.xline, with the reason: This release grades minor, and a maintenance line takes patch fixes only. A pin there has to stay inside the line's series, too. - A release that builds on another always lands after it, so it always carries the higher number on that line.
- In a monorepo, you choose how packages version. Independently, where only the packages a change reached get bumped, each tagged
package@version. Or as a fixed group that shares one number, the way all of Effect 4's packages move together. The policy is a file in the repo, and moving a package into or out of a group only happens at a major.
Then I tried to break it
A rule like that is easy to believe and hard to trust. Unit tests help (the core version math has around 150 test cases), but unit tests check the cases I thought of. I wanted the cases I hadn't.
So I wrote ten scenarios, each one a thing I'd seen go wrong or expected to: the race, a hotfix while dev holds unshipped work, out-of-order patches on a maintenance line, pinned majors while minors float past, builds-on, a single-trunk project, a release landing during an open release-candidate cycle, a shared build where one package changes, and a package with two targets, one of them waiting on a store review.
Then I made test projects and ran every scenario through Trinity end to end: real repos on GitHub, real pull requests, real tags, a local npm registry for publishing. Seven repos in a week, from a tap counter to a three-package monorepo with a CLI.
The first pass found a lot. The race alone surfaced twelve defects, the hotfix scenario fourteen. One of them was exactly the kind of thing scenarios exist for: a hotfix's version was being checked against what was integrated on dev, not what had shipped to production, so it could propose a number the line had already passed.
So I fixed them and ran everything again. And again.
Version and landing
State machine and gating
Agent narration ≠ state
The versioning itself converged quickly: nine bugs in the first pass, one in each of the next two. The release flow around it took more passes. And some of what the runs caught wasn't about code paths at all: an agent's account of what had happened, checked against what had actually happened. No unit test would have looked there.
The runs found things no unit test would have:
- A package published to the registry without its build output, because its tarball didn't include
dist. Publishing now refuses a package whose tarball lacks the files its manifest points to. - One failed publish stranding every other package in the release. Now a failure holds only that package and the ones that depend on it.
- A test browser download redirecting to a host the sandbox didn't allow.
- My own database quota, at 398 million of 500 million row reads, from running scenarios too hard.
What I'd tell another engineer
Decide things at the last moment you have the information. A version number answers "what's the next number on this line?", and that question only has an answer when the release lands. Deciding it at planning meant deciding it before the answer existed. I spent two designs managing the consequences of that.
Separate the kind of change from its number. Grading a release as patch, minor or major is a fact about the change, and you can know it early. The number is a fact about the line at a moment in time. Once I kept those apart, most of the problem went away.
Test designs like systems, on real repos. The unit tests told me the math was right. The scenarios told me the product was wrong in twenty-nine places, then six. I'd rather hear that from my own test projects than from someone's release.
And keep the record honest. The second model, the one that "was never Trinity's" to write, is still in the issue tracker exactly as I wrote it. It's the most useful thing I have for remembering why the third one looks the way it does.