Urgent.News

What's breaking now, across thousands of outlets.

Tech

A PASS over an empty set is the same string as a real pass

Our journal's tree carries four small instruments that print a verdict over a set of files. A pre-commit hook runs them; the run's output goes into the commit message and the pull-request body, where it serves as the record that the tree was checked. One of them printed this, over a tree we had every reason to believe was clean: set: 0 tracked markdown carriers ... LINKGATE: PASS That was a…

The journal's tree contains four small instruments that print a verdict over a set of files. A pre-commit hook runs them, and their output is included in the commit message and pull-request body, serving as the record that the tree was checked. One instrument printed this over a tree that seemed clean: "set: 0 tracked markdown carriers ...

LINKGATE: PASS." It was a faithful git archive export, with no .git file, causing git ls-files *.md to walk up to the enclosing repository, where its index holds nothing in the target directory. The instrument read nothing and reported PASS, identical to a genuinely clean tree. Nobody could distinguish a clean tree from an unreadable one based on the exit code, verdict word, or counts, as they were all 0 and 0.

The fix isn't better tooling; it's a different verdict. An empty set is not a pass; it's an absence of a reading. The number of verdicts changed from two to three: exit code verdict meaning 0 PASS (set was read and it's clean), 1 FAIL (set was read and something is wrong), and 2 NOT RUN (no verdict was taken). The change includes a window explaining why nothing was read: "NOT RUN: the carrier set is empty - read at the repository root." Naming the root and the command costs one line and removes ambiguity permanently.

The reference gate's reading of a published manuscript remained byte-identical before and after the change (156 entries, 100.0%, GATE: PASS). A fix to the silence of a check should not affect the signal; otherwise, you have swapped one unreadable output for another. Each instrument's self-test now includes an empty-set case, asserted from both sides.

Three additional scenarios from the same codebase show the importance of the empty-set case: 1) A figure read through a narrow window resulted in NUMGATE: PASS, but re-running the instrument showed NUMGATE: sites=1025 carrier=412 package=613. The discrepancy was due to tail -6 dropping the sites= line, which was not within the last six lines of a longer output.

2) A count over a set that the act reporting it can join showed 188 comments, but upon re-take, it became 189/3/186. The gap was caused by the act of posting the comment, which was not included in the initial count. 3) An empty return where the condition never occurred, returning an empty node list for totalCount, was interpreted as "no edits" and "no history available."

The fix in this case was to provide an explicit reading for the empty return: "An empty return means the text that stands is the text that went up." This change turns a silent field into one that answers the question, providing a reusable solution for when an instrument returns nothing.

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

More from Sunday 20 September →