Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

5. Webmention storage-centric architecture

Date: 2026-10-23

Status

Accepted. Implemented: phases 1 through 3 landed in PR #60, phase 4 in PR #61, and the moderation workflow from issue #52 landed with the pending, approve, and reject subcommands. See Corrections for two names that changed after the decision landed.

Context

Two webmention implementations existed at once after PR #33 merged.

Live-API, PR #33, on main: listsome build called webmention.io over HTTP while rendering a project page, and wrote per-project output/webmentions/<slug>.json files. The Webmention shape was the API’s own: a nested author object, a wm_property string, and a content object.

Storage-centric, unmerged branches behind PRs #55 through #58: a local .cache/webmentions.json store with verified and approved flags, a flat Webmention shape with author: Option<String> and mention_type: String, and async Fetcher and Sender types behind an HttpClient trait that tests could swap.

The two designs didn’t fit together. src/templates/project.html on main read mention.author.name, and the display branch handed templates mention.author as a string. A build on main also needed the network: an unreachable webmention.io meant an incomplete site, and builds weren’t reproducible.

Decision

Storage is the source of truth for rendering. listsome build reads .cache/webmentions.json and performs no network input or output, and fetching and sending are explicit commands.

  • One model. A single Webmention with a nested Author lives in src/model/site.rs. The fetcher deserializes the jf2 wire format into private Jf2 types in src/webmention/fetcher.rs and converts them through into_webmention(), so the API shape never reaches templates or storage.
  • One HTTP abstraction. src/webmention/http.rs defines HttpResponse, which carries a status, a body, and every header value, because a target may send several Link headers. It also defines an HttpClient trait with get and post. ReqwestClient implements it, and tests implement it with a mock. Fetch and send both build on it.
  • One send path. src/webmention::sender::Sender discovers the endpoint through parse_link_header and find_webmention_link, the same webmention.rocks-compliant functions used elsewhere, and sends the source and target pair. That change deleted the blocking WebmentionClient along with the blocking feature of reqwest.
  • Moderation. Storage keeps every mention, and rendering shows only the ones where approved is true. A fetch verifies each mention against its source page and approves it according to the approval setting. listsome webmention approve, reject, and pending are the human’s tools, and the cache remembers a rejection, so the next fetch doesn’t resurrect the mention.
  • The build records outbound links. The generator writes an outbound-link manifest from generated HTML through extract_outbound_links, and listsome deploy sends from it and tracks delivered pairs in a ledger so redeploys skip them. Markdown-time link discovery lost, because it would have been a second source of truth.

Disposition of the unmerged branches

PRContentOutcome
#55 fetchasync fetcher, flat module layoutsuperseded by 7123ca9 and 4e112af, and the branch kept the pre-unification author: Option<String> model
#56 displaystorage module, template renderingsuperseded by dae50e9 and 1702746, and its WebmentionContext adapter is unnecessary now that model and template agree
#57 sendSender, HttpClient::post, response headerssalvaged into #61, and #61 dropped its duplicate discovery parsers, dead-code-marked link discovery, and suppression attributes
#58 webmentionsdiscovery, manifest, ledger, deploy sendingalready upstream, all five commits are on main from 396191b to 3a6a262

The project closed all four rather than merging them: reconciling them on main first, then merging, would have reverted the unified model and the CI work.

Consequences

Gained: deterministic offline builds, one data model to change, listsome webmention fetch refreshing on demand, an async send path whose failures are per target rather than a deploy that aborts, and both directions testable without a network, which is why the wiremock-dependent blocking tests give way to mock-client tests.

Cost: a two-step workflow rather than one command, so a stale cache renders stale mentions and an automatic or staleness-triggered fetch remains open. read_project_webmentions() used to read the per-project files under output/webmentions/, and nothing wrote them, so a site that relied on that path saw old data until it fetched into the cache. approved is under user control, and a fetch never withdraws an approval, so a mention whose link disappears stays on the site until someone runs listsome webmention show and rejects it.

Corrections

Written 2026-11-13, against 0.1.7.

Two details in the decision moved:

  • The manifest is output/.webmentions/outbound.json, not output/.webmentions/manifest.json. The ledger of pairs already sent is .webmentions/sent.json in the site root rather than beside the manifest.
  • read_project_webmentions() no longer exists, so nothing reads the stale per-project files under output/webmentions/. The cache is the only input to rendering.

The open items are still open. Nothing fetches on a schedule or when the cache goes stale, so refreshing mentions means running listsome webmention fetch and then listsome build. That fetch needs an endpoint you configured, and it refuses the placeholder endpoint listsome init writes. Fetch also sends no authentication, so [webmention] token in the config does nothing today.