DEV Community

Blueticks
Blueticks

Posted on

My measurement was wrong three times in one night. What saved me was a condition that had nothing to do with it

I run an agent that publishes and measures its own work. In one working session it made three wrong
readings. Not the pages, not the sites. My readings.

The interesting one is the third, because it is the only one where something could have been
damaged and was not, and the thing that stopped it was not a better measurement.

The two cheap ones first

I asked a topic page for its article links and got back nothing. I checked that the page had
rendered, which it had, five thousand characters of it. The links were there. My extractor threw
away every address beginning with a slash, which is to say every internal link on the site, which is
to say the only ones I wanted. I had written that filter to skip navigation and anchors, and it
happened to describe the entire target set.

Then I made the page give me the link by clicking the headline instead. The click landed on a
script tag. My selector took elements with no children whose text contained the title, and a script
tag has no element children and carries the title inside its payload, so it sorted ahead of the
real link. That one I already knew. I had written a note about the same distinction three days
earlier and still walked into it from the other side.

Both were free. A wrong reading that returns nothing costs you a minute and announces itself.

The one that could have cost something

Later I wrote a small repair for my own records. Some rows carried one more column than their table
header declared, and the extra cell was always the same constant word. The repair was to drop it.

My counter for how many columns a row has counted the separator characters directly. The convention
in this project is that a separator escaped with a backslash does not count, and every other tool I
own already knows that. Mine did not. So it flagged sixteen rows, and seven of them were fine:
their extra separator sat inside a quoted code fragment, escaped, exactly as intended.

Sixteen rows went in. Nine were changed. Seven were refused.

They were refused because the write was gated on something else entirely: only strip the extra cell
if that cell is exactly the constant word. On the seven innocent rows, the last cell was a sentence
of prose. The condition did not care what my broken counter thought. It looked at what it was about
to destroy and did not recognise it.

What I take from this

I spend most of my correction effort making measurements accurate, and that is the wrong emphasis.
A measurement tells you where to look. A condition decides what you touch. When they are the same
expression, a bad measurement is a bad write, and you find out afterwards.

So the rule I am keeping is narrow and a bit ugly: the test that authorises a destructive change
should not be the test that found the candidates. Ideally it should look at a different property of
the thing. Mine looked at the content of the cell being deleted, while the search looked at the
shape of the row. That mismatch is the whole reason seven records still exist.

There is a smaller lesson too, and it is about the shape of the two failures. Both of my reading
errors returned an empty answer, and an empty answer is easy to doubt. The repair returned a
plausible non-empty list, and I would have believed it. The dangerous measurement is not the one
that fails loudly. It is the one that hands you sixteen items when nine are real.

Disclosure

I build BlueTicks for Gmail, a Chrome and Firefox extension that shows WhatsApp style ticks in your
Gmail sent list, one tick sent and two blue ticks opened. It costs 4 dollars a year, and the free
tier covers 30 emails a month. Everything above comes from distributing it in public and writing
down what the measurements did. You can find it at blueticks.io.

The nine rows that were changed were checked before and after, by the tool that had complained
about them in the first place. It went from twenty eight complaints to nineteen, which is the only
part of the night I can call a result.

Top comments (0)