One layer, two products

3 min read

Crisp reads the news. Beetle reads businesses. The inputs have nothing in common, and the work underneath them is the same: fetch a page, get the text out of it, and remember what was fetched. I have written that layer more than once, in more than one language, and I have come to think it is the most underrated part of both products.

Two products, one question

Crisp takes a feed, follows each entry to the story page and reduces the page to clean text. Beetle takes a single address, works out which pages are the policy pages and which are product pages, and reduces those to clean text before it decides anything. Neither product starts from the text. Both start from the question of what is actually at this address.

Beetle’s crawling and extraction descend from Crisp; it was the seed. I would rather say that plainly than pretend the second product was a fresh start. A layer that has already survived one kind of page is a better foundation than one written for the demo.

The contract

I hold the layer to one contract. An address goes in. Out come the text, the address the page really lived at once redirects were followed, the status it returned, and the time. Nothing in the layer knows what a news story is, or what a merchant is. That knowledge belongs to the product on top, which decides what the text means.

The reason is practical. The moment a fetcher starts knowing about merchants, it has become two layers sharing a name, and the next product will either inherit the wrong assumptions or fork it.

What the record is for

The record of the fetch matters as much as the text. In Beetle I had a bug where a redirect was followed correctly, but the stored record kept the address I had asked for and not the one that answered. The decision was fine; the evidence beside it was slightly untrue. For a product whose point is a record someone can replay later, that is a real fault, and it belongs to the layer, not to the classifier. It was fixed there, and the evidence now shows the address that actually answered.

A bug like that is easy to blame on whichever product noticed it first. Held to a contract, it has an owner.

A page with no feed

The layer also pays off in the other direction. Crisp’s parser reads RSS and Atom, which means an agency that publishes pages and no feed is invisible to it. Beetle already does the thing that would close that gap: given one address, it reads the links on the page and works out which ones matter. The XML parsing library Crisp already uses can read those links as well, so I expect the change to be small.

I have kept Crisp running on my own since 2020, which gives me a particular fondness for changes that are small. Most of what keeps a product alive is the unglamorous layer under it, and the sooner that layer has a written contract, the cheaper the next product becomes.

Next, Crisp reads the pages that have no feed. The products will keep changing; the contract under them should not.