From 0379dda90869aa71cc3db33adaeee45c8e075351 Mon Sep 17 00:00:00 2001 From: Levi Neuwirth Date: Thu, 7 May 2026 15:08:54 -0400 Subject: [PATCH] Degrade gracefully on corrupt backlinks JSON MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If data/backlinks.json fails to parse, every page that uses the backlinks context aborts with 'fail'. The JSON is build-generated; corruption is unlikely but not impossible (interrupted writer, disk issue). Switch to noResult so the affected pages render without the backlinks block instead of failing the whole build. The next clean build regenerates the JSON. Note: commonplace.yaml and now.yaml deliberately keep fail-fast — they're hand-edited and silent fallbacks would mask author typos. Co-Authored-By: Claude Opus 4.7 (1M context) --- build/Backlinks.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/Backlinks.hs b/build/Backlinks.hs index b8636d7..f7e9821 100644 --- a/build/Backlinks.hs +++ b/build/Backlinks.hs @@ -356,7 +356,7 @@ backlinksField = field "backlinks" $ \item -> do blItem <- load (fromFilePath "data/backlinks.json") :: Compiler (Item String) case Aeson.decodeStrict (TE.encodeUtf8 (T.pack (itemBody blItem))) :: Maybe (Map T.Text [BacklinkSource]) of - Nothing -> fail "backlinks: could not parse data/backlinks.json" + Nothing -> noResult "backlinks: could not parse data/backlinks.json" Just blMap -> do mRoute <- getRoute (itemIdentifier item) case mRoute of