Posted by todsacerdoti 7 hours ago
TrunkVer
trunkver.org
73
32
fishtoaster 4 hours ago

I think this is a nice way to clarify the different use cases for version numbers:

- SemVer is a communication tool for when an author needs to tell a potential user what to expect from a new version.

- TrunkVer is an auditing/engineering tool for when you need to give a unique identifier to a version for technical reasons.

I think this page is a nice codification of a useful practice, but it does itself a disservice by positioning itself against SemVar and claiming to be a "drop-in" replacement.

travisgriggs 3 hours ago

I’ve been happily using date base version numbers in any user facing product (e.g apps) for a while now. It’s been great.

While semver makes great sense on paper, and even allows nifty little algebras in dependency declarations, it is been my experience that the delineations are not always as easy to decode and different team members can quibble over the exact realization of the boundaries.

Furthermore, it’s very much been my experience that semver changes, like all code comments, only communicate the intent of the developer and not always the reality. A minor roll may be anticipated as backwards compatible, until an unrealized use case pops up and makes the minor change very breaking.

BugsJustFindMe 1 hour ago

> Furthermore, it’s very much been my experience that semver changes, like all code comments, only communicate the intent of the developer and not always the reality.

This is the truth and the reason why SemVer is fundamentally wrong for almost all cases that people use it for. Fools with keyboards and big salaries hallucinate a contractual certainty where none exists.

echoangle 5 hours ago

In what way is this „SemVer-compatible“ when you just ignore the „Major increment <=> breaking changes“ convention? It has 3 numbers separated by dots? This just increments major version every time a build is started, even though there might not be breaking changes.

Edit: When looking at the SemVer page: https://semver.org/#if-even-the-tiniest-backward-incompatibl...

The formal spec technically only tells you that you MUST increment Major for breaking changes, and not that you can’t do it every time, but the FAQ makes it clear what the spirit of the rule is. I can’t see how TrunkVer can be called SemVer compatible with this construction method.

idle_zealot 5 hours ago

In semver terms, I believe this translates to "every change might be breaking", which sounds right for trunk-based deployments.

wakawaka28 4 hours ago

It sounds like a disaster. Trunk-based deployment does not imply such an extreme degree of instability, because all development may happen on other branches. I see what you're trying to say though. I think the real keyword is "continuous integration."

orf 5 hours ago

It’s semver compatible because it can be parsed, accepted and compared by any system that expects or requires a semver formatted version?

The whole point of this is that in trunk-based releases the version isn’t significant, so why not call each one breaking.

chungy 4 hours ago

20241127214906.0.0 will be marked as incompatible with 20241127214907.0.0 by any such system that parses them.

jhanschoo 1 hour ago

> A TrunkVer is syntactically compatible with SemVer, although it does not respect its semantic interpretation of the version number.

The document specifically disclaims semantic compatibility.

orf 4 hours ago

Sure, but it does parse them and it does rightly understand that one is an newer version.

That’s… compatibility.

wakawaka28 4 hours ago

Newer is not always compatible. That's why SemVer looks like work to authors. They don't like to think about compatibility.

Kinrany 4 hours ago

That's (in-)compatibility between versions, not compatibility between versioning schemes.

wakawaka28 4 hours ago

You're not technically wrong but using the 3 numbers this way is in fact going to create problems for people trying to use this info. It means that you can never know if any version is compatible with others, and even if they were you could not easily link it.

harrall 2 hours ago

It’s not creating a new problem that didn’t already exist.

In many situations at work, trying to follow SemVer would be a technical solution to a non-technical problem.

You know who your users are. Before you make any breaking change, you already have cross-product team meetings with possible executive buy in.

In those scenarios, by time you assign a version number, everyone is already on the same page. The actual version number is meaningless and conveys no useful information. Spending any time on deciding the version creates unnecessary toil.

zvr 4 hours ago

The EBNF in the page does not match the textual description:

    - "ALPHANUMERIC" is only letters, not numbers
    - "BUILD_REF" can contain dashes/hyphens "-"
    - "GIT_COMMIT_REF" is the letter "g" and a single hex character
    - "BUILD_REF" and "SOURCE_REF" may be empty, since they are 0 or more repetitions
    - "TIMESTAMP" is arbitrary numbers, so month or hour may be "99" for example

montroser 3 hours ago

A sequential build/release number would suffice in many cases.

If the thing you're shipping isn't meant to be a dependency for other projects, then semantic versioning doesn't really fit.

In trunkver though, using the timestamp of the build time is a little weird, since you could inadvertently end up building an earlier version of trunk at a later time.

Putting an identifier of the job that built the release in the version number also seems heavy for what could just be an entry in a log file for when you need those forensics.

PaulKeeble 3 hours ago

What happens with build number is you end up going back to the CI system and looking up what change it actually built and when it happened. I can see the advantage of having all 3 in the build name, I have done similar in the past for continuously released server software where there is no need for versioning numbers although typically I too have shortened it to just the build number because we have the CI system to go into if we need to.

status_quo69 3 hours ago

Generally agree with your points about how semver isn't really necessary. I suppose the benefit here would be that dep management tools like dependabot could automatically raise pull requests when a new version is released, which would be pretty cool. If only my peer engineers actually paid attention to dependency updates.

As an aside, instead of an auto incrementing build number I'd suggest the git sha since it's: 1. Already there and points to a specific version of the code in the repo 2. Globally unique 3. Can assist with reproducible builds (i.e. 6afed54 was acting weird, let's build it locally and take a look) 4. Gives you an easy diff target to dump "release notes". Just diff to the previous and dump the merge commit messages.

CGamesPlay 1 hour ago

Another (simpler) versioning "standard" using calendar-based versioning: https://calver.org

makifoxgirl 5 hours ago

I've been using something like this for the Unity game I'm working on where I need regular updates. However, I don't think it let me use 14 numbers in the major field. So I've stuck with something along the lines of <year>.<month>.<date>-<hours*60+minutes> to better saturate. It's nice to know there's a standard for this though.

benatkin 3 hours ago

What if the CI vendor decides to use the same for its ids? Then you have even longer version numbers.

And if CI vendors aren't expected to adopt this, why expect a lot of devs to?

On my computer, the CI version ID wraps, because between the other parts of the version and the padding, there isn't enough space. I think that says something about the length of the version identifier.

1shooner 4 hours ago

I can see using this if what you're building is at the end of the supply chain, and there is really less need to make the claims that SemVer does. Conversely, if you have downstream consumers, I can't imagine taking away the compatibility statements in SemVer.

llIIllIIllIIl 1 hour ago

Git commit sha produces a good enough version for most software.

codethief 4 hours ago

> If the source reference is a git commit checksum, it may be truncated to 7 characters (--short)

Doesn't the length of shortened git hashes depend on the size of the repo (whether or not shortened hashes of a given length collide)?

0xbadcafebee 5 hours ago

Here's the thing about versions: they are never "complete", Because you never have just one version.

Whatever you are looking at is most likely an amalgam of many different things, which all have their own versions. Your one perfect holy version number does not tell you those versions, so you have to look them up at some point (you did save the versions of all your dependencies and pack them into a BOM, right?).

This trunk version similarly does not encode all the information you need. And what is it going to be used for? A python package? Every python package? A docker container? What about all the versions of stuff in that container? What about the helm chart that will ship this container, what's it's version? What about the version of all your helm charts that have been tested as working in stage before shipping them to prod?

If you're going to have a "generic incremented trunk version", just make it a plain-old continuously incrementing integer (or hex, or whatever) with no semver. Because you're going to have to look up more information about what's inside it later anyway, and everything's going to have its own version as you modify individual items.

Packing all this extra information in is actually counter-productive, because it's now much longer and more complex (which makes it harder to just compare a list side by side), yet it doesn't give you enough info. Ok, datestamp; where's the timezone? Ok, git sha; which repo (and has history been rewritten, or the files moved to a different repo)? Ok, CI build number; which build system (if you have multiple, or you moved from one to another)?

Maybe some of it you can intuit, but eventually you'll wish it was different again. Might as well just make it a plain integer you can pass to a script that dumps out everything related to it.

Semver's primary use case is not identifying what's inside or where it came from. The numbers are little more than a simple incrementor, and the use case is just a user who wants to know how afraid they should be. It's intended solely to communicate how likely this thing is to fuck your shit up. If it's a major version change, here be dragons. If it's minor, be cautious. If it's a patch, it should be harmless. Semver is a threat indicator. And it's easy to work with because it's so simple; comparing versions is easy. Comparing a wall of these TrunkVers will be like staring at The Matrix code.

(SemVer's supposed to tell you what dependencies it can work with (>major, >major.minor, etc), but you still need the entire dependency DAG to have a pair of package name and version in order to make sense of it; you could do the exact same thing with a list of names and simple integers (foo >= 23456, foo<1234); now imagine with this TrunkVer (foo >= 20241127214906.0.0-g1f8292a-12058740477-1)...)

zaps 17 minutes ago

Great, now sell this to your marketing department

jiggawatts 3 hours ago

I much prefer Nerdbank Git Versioning (NBGV): https://github.com/dotnet/Nerdbank.GitVersioning

It allows repeatable builds because it uses the "git height" as the increment source.

This is an implicitly updated value that is centrally coordinated, but isn't a separate system. If you have Git, you have a Git commit history, and hence an incrementing counter.

NBGV can stamp binary outputs such as .NET EXEs and DLLs, generates compile-time sources with version strings, works with Node.js projects as well, and integrates with Azure DevOps pipelines automatically.

fuzzzerd 2 hours ago

I have been using MinVer for dotnet projects, which is similar but a little easier (IMO) to work with since its all based on tags.

thrance 4 hours ago

This breaks efficient dependencies resolution. SemVer is called that because versions carry semantic meaning, TrunkVer appears no better than using UUIDs for each version name. You know nothing of the relation between two versions in this scheme, other than which came first.

MrLeap 1 hour ago

Add a metalayer to turn version names into memorable word phrases imo lol.

peterkelly 1 hour ago

And the best part is you can completely disregard the need to maintain backwards compatibility, because every build implies a breaking change! /s

DidYaWipe 4 hours ago

Is what?