The easiest thing to sell in a streak game is a fake day.
Someone misses Tuesday. They're annoyed. They would happily pay to turn Tuesday green. One button, one purchase, everybody's happy.
And from that moment, the streak means nothing.
I had to make this call while building Vigilante, my free browser game where your real GitHub pushes open the next day of a 3D survival story. Vigilante has an item called Revival Fluid. It repairs a missed day. You can buy it, and Pro comes with some every month.
So here's the question I'll answer at the end: if you can buy a repair, how can the record still be honest?
Why sell a repair at all?
The hardcore answer is "don't". No freezes, no repairs, miss a day and you're back to zero. Builds character.
I think that's the wrong advice. The most dangerous day in any streak isn't day 1. It's the day after it breaks, when a quiet voice says "well, that's ruined" and you take the week off. A fever, a late office deploy, a family function: none of those should wipe out a 40-day story.
But a "day" quietly means two different things:
- The story gets to keep going.
- You actually coded.
Most streak code stores both in one boolean. That's the bug.
The substitute fielder
In cricket, if a player gets hurt, a substitute can come on and field. He can take a catch. He can stop a boundary. He can't bat and he can't bowl.
The team stays complete on the field. The scorecard never pretends he scored runs.
That's Revival Fluid. It keeps your side on the field. It never scores runs.
Now let's put that in code.
Model it as states, not a boolean
What follows is a simplified sketch for this post, not Vigilante's production code. The idea is what matters.
public enum DayStatus { VERIFIED, // a real push landed that day (junk commits filtered out) REPAIRED, // the day was missed, then patched with Revival Fluid MISSED // nothing happened } Two questions, two functions. They are never allowed to share an answer.
public final class Streak { /** Can the story continue? A repaired day keeps the chain together. */ public static int chainLength(List<DayStatus> pastDaysNewestFirst) { int n = 0; for (DayStatus s : pastDaysNewestFirst) { if (s == DayStatus.MISSED) break; n++; } return n; } /** What goes on the share card. Only real work counts. */ public static long verifiedDays(List<DayStatus> days) { return days.stream().filter(s -> s == DayStatus.VERIFIED).count(); } } chainLength is the fielding. verifiedDays is the scorecard. A repaired day helps the first and does nothing for the second.
That alone already beats a boolean. But an enum doesn't stop a bug. Somebody (probably me, at 1 am) can still write VERIFIED from the wrong place.
The rule that actually matters: one writer
Here's the rule Vigilante follows: buying anything never unlocks a day or counts as verified work.
The way to make that true in code is to give VERIFIED exactly one writer: the GitHub push handler, after it has checked the webhook signature and filtered out empty, merge and lock-file-only commits. The shop gets a different door, and that door only opens onto missed days in the past.
public final class DayLedger { private final Map<LocalDate, DayStatus> days = new HashMap<>(); public DayStatus status(LocalDate day) { return days.getOrDefault(day, DayStatus.MISSED); } // Package-private: only the webhook code, in this package, can call it. void markVerified(LocalDate day) { days.put(day, DayStatus.VERIFIED); } // Public: the shop and inventory code call this. public boolean repair(LocalDate day, LocalDate today) { if (!day.isBefore(today)) return false; // not today, not the future if (status(day) != DayStatus.MISSED) return false; // never overwrite a real day days.put(day, DayStatus.REPAIRED); return true; } } Three small guards do the heavy lifting:
- You can't repair today. Today is still open, so go push something.
- You can't repair the future. No pre-buying a holiday.
- You can't "repair" a verified day, so a purchase can never touch a real one.
And a test that says the rule out loud:
@Test void aRepairNeverCountsAsWork() { LocalDate today = LocalDate.of(2026, 12, 1); DayLedger ledger = new DayLedger(); ledger.markVerified(today.minusDays(3)); // two days ago: missed ledger.markVerified(today.minusDays(1)); assertTrue(ledger.repair(today.minusDays(2), today)); assertFalse(ledger.repair(today.minusDays(3), today)); // already real assertFalse(ledger.repair(today, today)); // today is still open List<DayStatus> past = List.of( ledger.status(today.minusDays(1)), ledger.status(today.minusDays(2)), ledger.status(today.minusDays(3))); assertEquals(3, Streak.chainLength(past)); // the story continues assertEquals(2, Streak.verifiedDays(past)); // the scorecard doesn't lie } Chain of 3. Verified 2. If those two numbers are ever equal after a repair, something is wrong.
The stronger version: don't store VERIFIED at all
Package-private methods are a polite fence. In a real database, I'd rather make the fake day impossible to even write.
Keep two tables that never mix:
-
push_events: one row per accepted push, written only by the webhook handler. -
repairs: one row per used Revival Fluid, written only by the inventory code.
Then derive the day instead of storing it:
SELECT d.day, CASE WHEN EXISTS (SELECT 1 FROM push_events p WHERE p.user_id = :uid AND p.counted_day = d.day) THEN 'VERIFIED' WHEN EXISTS (SELECT 1 FROM repairs r WHERE r.user_id = :uid AND r.repaired_day = d.day) THEN 'REPAIRED' ELSE 'MISSED' END AS status FROM calendar_days d WHERE d.day BETWEEN :from AND :to; Now there is no row a purchase could ever flip to VERIFIED. A verified day exists only if GitHub sent a push for it. Even a bug in the shop can't fake one, because the shop has no write access to push_events. Give it its own database user if you want to be strict.
Notice the order of the CASE too: if a real push exists, the day is verified, full stop. A repair can never hide real work, and real work can never be downgraded by a repair.
So, the question from the top
If you can buy a repair, how can the record still be honest?
Because the story and the record are two different columns, and money can only write to one of them.
Revival Fluid keeps you on the field. The share card you post for #100DaysOfCode only counts the days GitHub actually saw you push. Nobody reading it has to wonder which days were bought, because none of them were.
The same rule works far beyond games. Paid "boost" features, admin overrides, support tools that "fix" a user's progress: give your proof column one writer, and make everything else write somewhere else.
If you want your #100DaysOfCode days checked this way instead of by screenshot, Vigilante has a free 100 Days of Code tracker (full disclosure, I built it): vigilante.ocix.in/100-days-of-code
And if you've built a streak system: did you store progress and proof in the same field? Be honest.
