Urgent.News

What's breaking now, across thousands of outlets.

Tech

My freshness check went stale every time someone did the right thing

We keep a register of rows that each cite a place in the codebase. A row is fresh while the bytes it cited are still there and stale once they move or change, so a citation can go red instead of quietly rotting. Nine of those rows cited the same line: the one declaring which layers exist. layers = [ core , codec , index , query , gate , ...] Adding a layer is the correct thing to do. It is also,…

Every time someone did the right thing, the freshness check reverted to a stale state. Rows in the codebase were marked as stale when the bytes they cited moved or changed. However, adding a new layer, which is considered correct, resulted in nine rows becoming stale at once. The register was red for the correct reason – layer additions needed to exist and be findable.

But the pin was guarding a property the row didn't depend on, duplicating a check performed by three other parsers. The register gained a new anchor kind that pointed at a key rather than bytes. Freshness was determined by the key's presence, while ambiguity arose when the key appeared more than once. Two rows moved to the key anchor, while the rest retained the byte pin because they asserted something about the content.

Introducing a weaker anchor alongside a stronger one led to confusion, with the weaker anchor spreading. The test suite expanded from 74 arms to 101, focusing on proving the old form still worked. The rule is to pin the property the row depends on, not the bytes nearby. A check that fires when someone does the right thing is not strict; it answers a different question.

The ideal repair for a noisy pin is not to re-take it, as it makes red and false red indistinguishable. Instead, the pin should question the right thing, and if it's wrong, a different question must be asked.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Mapping Page Ranges to Output Files: A Data-Driven Decision Tree for PDF Splits

Most engineers treat splitting a document into parts as a trivial action — choose a page, hit the button, get a smaller file.

  • Page ranges encoded in PDF using indirect objects and cross-reference table
  • MediaBox and CropBox define visible page region, normalization may lose vector fidelity
  • Three valid splitting strategies: fixed-size, boundary-driven, selector-driven

More from Saturday 12 September →