The Build Log
Episode 4 or Episode 5? Let the record count
How We Make the Show, No. 08. Why the site counted wrong, and what counts now.

Mamba Smith is the founder of Queen City Garage, which produces The Grand National Show: a weekly NASCAR panel show on Grand National Today where broadcasters and drivers argue about the last race and pick the winner of the next one.
For part of a day this week, the Grand National Today homepage called Episode 4 of The Grand National Show "Episode 5." Nobody typed a five. The page counted.
This is the post about why counting is the wrong way to know what number something is.
How a page miscounts
The homepage showed the newest episode with a billboard headline over it. To label it, the code counted the show posts that existed and added one. That works right up until there is a post that is not an episode of that show, or an episode that is not a post yet. The week the Truck Series launched, both were true at once. The count went up, the label went up with it, and the NASCAR O'Reilly Auto Parts Series show's fourth episode wore a five.
At the same time the homepage was still leading with Episode 3's billboard, because the billboard had been chosen the same loose way.
The fix is not a better count
The fix was to stop counting. The label now comes from the episode record, where the episode number is a field a person set on purpose. The billboard shows only on the newest episode, and "newest" is read from the same record. A nightly check now watches both, so if the homepage and the record ever disagree, we hear about it before a viewer does.
Then the Truck Series got its own page, with its own panel and its own weekly cadence, and each show links to the other. The Truck show went into the top bar and the footer. That was the second half of the week's site work and it only made sense once the first half was fixed. You cannot give two shows their own pages while the site is counting posts to tell them apart.
The second miscount
Two days later the same shape showed up somewhere else. Our internal planning calendar listed Episode 4 as overdue. It had published on Wednesday afternoon and gone out to the panel the same day. The calendar row had not been told.
The cause was structural. Nothing connected the episode record to its planning row, so the planning row stayed open forever after the episode shipped. Episode 3 had broken the same way the week before and been fixed by hand, which is how you know a fix by hand is not a fix.
So the planning row now carries an explicit link to its episode. Two small rules inside the database itself close the row when the episode publishes: one fires when the episode record changes, the other when the article's status flips, which is the path taken by the job that publishes scheduled articles every fifteen minutes. Neither trigger can block a publish. Bookkeeping never gets to stop the show. A nightly check watches for drift. All seventeen planned episodes across both shows now carry a linked row, and the drift check reads zero.
It was tested in a dry run inside the database, undone at the end, before it went live, including the real Episode 4 failure, re-created and caught by name.
The rule under both
The episode is a database row is the first post in this series for a reason. Every time a page or a planning tool decided for itself what episode something was, it got it wrong. Every time it read the record, it got it right.
A count is a guess dressed as a fact. A record is a fact.
What a person did: noticed a five where a four should be, and decided the record is the only thing allowed to know. What the machine did: reads the record now, closes the planning row on publish, and checks every night that the two agree.
This is No. 08 in How We Make the Show, the Queen City Garage build log on producing The Grand National Show. Both shows: Grand National Today.
Topics: AI Programs · The Shows