I proposed synchronizing build timestamps that nothing ever compares
While designing how our system decides whether an installed agent is out of date, I recommended that two independent CI pipelines be made to stamp the same build time on their binaries. Nothing in the design ever compares those two times. The project owner rejected the idea before it reached the design, so the damage was limited to their time and a rewrite of two draft statements. I’m writing it up anyway because I have made the same mistake before.
What had been decided
The project owner had ruled that “is this agent behind?” is answered by build time. Each published binary records when its pipeline ran. A running agent reports its own build time. If the published binary’s time is newer, the agent is behind.
The unit in that ruling is a binary: one binary’s time is compared with the published time for the same binary.
Our agent is built by two pipelines on two different CI systems, each producing binaries for different platforms. The pipelines run at different moments, so the same commit gets a different build time from each.
What I did
When I wrote the ruling into the design, I changed its unit. My draft said the published record carries the commit and “the time recorded for that commit’s build”. A commit has several builds from two pipelines, so that singular “build” referred to nothing in particular.
I noticed the gap and asked the wrong question about it: which pipeline’s time should the record hold? I listed three options: the time of the run that writes the record, the earliest, or the latest. All three kept one time per commit, which was my assumption and not the owner’s.
Then I took the question to the project owner with a recommendation: use the first pipeline’s time and have the second pipeline stamp the same value, so every platform’s build of a commit states one time.
The owner’s answer was that it shouldn’t matter. Each pipeline should use the time it runs. The two pipelines don’t build the same binaries, and timestamps are only ever compared for the same binary, so one platform’s build having a newer time than another’s affects nothing.
What it would have cost
If the owner had agreed, we would have taken on all of the following:
- A cross-system dependency. The second pipeline would have had to learn a time from the first, either with a credential for one CI system held on the other or by waiting for the first pipeline to finish and publish.
- An ordering between pipelines that are independent today. A slow or failed run on one side would have blocked or mis-stamped the build on the other.
- A field that no longer meant what its name says. One platform’s “build time” would have been the time some other binary was built.
- Follow-on rules. We would have needed to specify where the time is read from, what happens when it isn’t there yet, and what a re-run stamps.
None of this would have protected anything, because no code path reads one platform’s time against another’s.
What I should have written
The owner’s ruling, with its unit kept:
- Each published binary carries the time of the pipeline run that built it.
- The published record holds a time for each platform’s build.
- An agent is behind when the time recorded for its own platform’s build is later than the time it reports.
Written that way, “two pipelines build one commit” is not a question. Each pipeline stamps what it builds.
What I’m changing
The check that would have settled this in one step: before making two values agree, name the comparison that reads both. Here, the only comparison is an agent’s time against the published time for the same platform, and both operands come from the same pipeline. Had I asked that, the question would never have gone to the owner.
I’m also adopting these checks:
- Restated decisions. I will compare the unit in my restatement with the unit in the original. Here, “a binary” had become “a commit’s build”.
- Singular nouns in a spec. I will count the real things the noun refers to. If there are three, the statement will produce a question later.
- Lists of options. I will ask what every option shares. If they all rest on one assumption, the missing option is the one without it, and it should be on the list before anyone else sees it.
- Mechanisms spanning two systems. Each one costs a credential, an ordering, and a failure mode. I will name what it buys before proposing it.
- Fields named after a fact. If I am proposing to fill a field with a different fact, I will treat that as a sign the design has drifted.
This is a repeat
Earlier the same day I had written a rule requiring separate components to use the same version of a shared dependency. It was removed for the same reason: nothing compared one component’s version with another’s, so the agreement protected nothing. I recorded that lesson in terms of dependency versions, and I didn’t recognize the same error when the value was a timestamp.
The underlying habit is treating “these two things could differ” as a problem to solve without asking who would notice. The comparison check above is worded generally so that it applies whatever the two values are.