The desktop app behind Notifio has an activity log: a black monospace box that prints what the monitor is doing. Important lines are green. That is nine lines of component:
const HIGHLIGHT_RE = /new listing|sent|found/i;
// ...
<span className={HIGHLIGHT_RE.test(line)
? "font-semibold text-[#4ade80]"
: "text-[#a3a3a3]"}>
{line}
</span>
Three alternatives, one colour, no state. I went to add a fourth alternative and checked what the existing three actually catch first.
The log has exactly one author
This part makes the audit tractable. Every line in that box comes from one function in one module:
function log(msg: string): void {
const line = `[${new Date().toLocaleTimeString()}] ${msg}`;
console.log(line);
_logListeners.forEach((fn) => fn(line));
}
log() is private to monitor.ts, there are 38 call sites, and the listener list has exactly one subscriber, registered once in the local server that streams lines to the UI. So the set of strings the highlighter can ever see is knowable: grep the module.
log() call sites in monitor.ts 38
single-line string literals a grep can extract 28
matching /new listing/ 4
matching /sent/ 4
matching /found/ 0
distinct lines highlighted 7
One of the three alternatives matches nothing. found appears twice in the whole module, once inside a comment and once in setNotice('error', 'No licence found. …'), which is a status notice rendered somewhere else entirely and never passes through this component. A third of the regex has never fired.
The three green lines that mean nothing happened
The dead alternative is harmless. The two live ones are worse, because the regex has no idea what the words mean in context. Here are three of the seven lines it paints green:
No new listings on ${site.name}
Baseline saved for ${site.name}: ${current.length} listing(s) recorded, no alert sent
Skipping alert for ${site.name}: …
The first is the single most common line in the log. On a quiet evening it is most of what the box contains, once per search per poll, and it means the opposite of a find. It matches because new listing is a substring of No new listings.
The second is the first-run line, when the app records what is on a page already so it can tell what is new later. It matches sent because the string ends in the words "no alert sent". The regex sees sent, the sentence says the opposite, and there is no negation anywhere in nine lines of component.
So of the seven highlighted lines, two are genuine (a find, and the line reporting an alert email going out), two are status emails about a particular search, and three mean that nothing was delivered. The one line in the whole log that most deserves to be green, the find, is the same colour as the line that says there was nothing to tell you.
The fix is not a better regex. A log line is a string for a human, and colour is semantics, so semantics should come from the sender:
function log(msg: string, level: "info" | "hit" = "info"): void { ... }
Thirty-eight call sites, one of which passes "hit". That is a smaller change than teaching a regular expression what "no" means.
Where found came from
The regex's third alternative was not invented from nothing. The word is all over the product, just never in a log line. The homepage demos are where it lives.
The homepage shows the app working instead of a screenshot, as four animated components rather than a video. The hero one prints a fake activity log, scripted as a const:
const LOG_LINES = [
"[09:14:01] Monitor started",
"[09:14:02] Poll #1: 2 site(s)",
"[09:14:03] Baseline saved for site 1",
...
"[09:15:06] 1 new listing found on site 1",
];
That last line is the climax of the loop, the moment the demo exists for. It is also the sentence the real app has never printed. The real one is:
log(`${newListings.length} new listing(s) on ${site.name}`);
The same word shows up in the notification mockup three times, as the banner title New listing found. The real notification title:
const title = finds.length === 1
? `New listing on ${siteName}`
: `${finds.length} new listings on ${siteName}`;
So the website's copy and the app's copy disagree about the product's single most important sentence, and the highlighter in the app is written against the website's version.
Eleven demo lines, one of them real
Once I was reading the two side by side, the rest of the demo log did not survive either:
demo app
[09:14:01] Monitor started identical
[09:14:02] Poll #1: 2 site(s) "Poll #1 started, 2 site(s)"
[09:14:03] Baseline saved for site 1 "Baseline saved for Kamernet: N listing(s)
recorded, no alert sent"
[09:14:03] Poll complete. two separate lines, "Poll complete" and
Next poll in 30s "Next poll in 30.0s"
[09:14:35] No new listings on site 1 identical in shape
[09:15:06] 1 new listing found on "1 new listing(s) on Kamernet"
site 1
Of eleven scripted lines, one message is byte-identical to something the app can print, two match in shape, and the rest are rewritten: one merges two real lines into one, one drops the detail the real line exists to carry, and the timestamps are wrong in a way that is almost funny. The demo prints [09:14:01]. The app prints toLocaleTimeString(), which on a US machine is [9:14:01 AM]. Zero-padded 24 hour time is what a European locale gives you, so the demo is accidentally honest for the audience the product actually has and wrong for the one reading this post.
And none of those strings is in the HTML. All four demos are "use client" components, so the whole fake log ships as JavaScript:
$ grep -c "New listing found" <(curl -s https://notifio.app/)
0
$ grep -l "new listing found on site 1" chunks/*.js
chunks/0bbs0aiyg54mh.js
Zero bytes of it in 38 pages of served HTML, all of it in one chunk.
Which one should change
The tempting answer is to fix the demo. It is wrong six ways and the app is the source of truth.
I think it is mostly the other way round. "1 new listing found on Kamernet" is better copy than "1 new listing(s) on Kamernet", because (s) is a plural nobody writes by choice and found is the verb that tells you what the app did. What the demo should take from the app is the site name: hiding it behind "site 1" removes the single most useful word in the real line, since knowing which search fired is the whole point of running more than one.
So the app's line becomes the demo's sentence with the real name in it, the demo stops inventing a log format, and the highlighter stops guessing from substrings. The reason to do the census first is that none of that was visible from either side alone. The app looked fine, the demo looked fine, and the word found sat in a regex in the app for months as the only evidence that the two had ever been written by the same person.
Earlier on the demos: Four animated product demos, 997 lines, four copies of the same delay function. Earlier on the notification they mock: Two options on our desktop notification name three platforms between them. You can get the app itself from /download.
Top comments (0)