fix(articles): two more from a deeper review pass - #134
Merged
Conversation
One malformed article row took the whole sitemap down. `handleSitemap` is not wrapped in a catch, so a row missing its dates threw while building an entry and the request failed with a 500 — crawlers lost the sitemap entirely rather than losing one URL's accuracy. The date helper tolerates a missing or unparseable value now and falls back to today, since `lastmod` is a hint and a slightly wrong one is far cheaper than no sitemap. Posts carried the same risk and are covered by the same fix. The save chain reported a failed follow-up as success. It fell back to the first save's result, so an edit typed during a save that then failed to send would let publish go ahead with text one version behind what the writer was looking at — the exact failure the chain was added to prevent, one step further along. The follow-up's result is returned as-is. Also checked and found clean, by measurement rather than assumption: a fenced code block's info string reaches the DOM only as `language-<first-word>`, so an author cannot smuggle utility classes through it; and `data:` URLs are stripped from both images and links by the markdown renderer's default transform. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Hu1QuLxS84vdf1gmzoGtWP
Contributor
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
tdn-client | 22ca165 | Commit Preview URL Branch Preview URL |
Aug 26 2026, 03:02 AM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A second, deeper pass after #133. Two real defects, plus two suspicions I chased and had to drop.
One bad row took down the whole sitemap
handleSitemapis not wrapped in a catch. An article row missing its dates threw while building its entry, and the request failed with a 500 — crawlers lost the sitemap entirely rather than losing one URL's accuracy.Reproduced with a single row containing nothing but a slug:
The date helper now tolerates a missing or unparseable value and falls back to today.
lastmodis a hint to crawlers, so a slightly wrong one is far cheaper than no sitemap at all. Posts carried the same risk — the entries were built with the same helper — and are covered by the same fix.The save chain reported a failed follow-up as success
#133 added a follow-up save so an edit typed during an in-flight save is not lost. It fell back to the first save's result when the follow-up failed — so publish saw success and went ahead with text one version behind what the writer was looking at. That is the exact failure the chain was added to prevent, one step further along. The follow-up's result is returned as-is now, and publish's existing guard catches it.
Two things I suspected and measured instead of assuming
Both turned out clean, and I'd rather record that than leave them as open questions:
language-<first-word>is ever emitted, so```fixed inset-0 z-50becomes the single classlanguage-fixed, which does not exist in the bundle. Not exploitable.data:URLs in markdown. Stripped from both images and links by the renderer's default transform —srccomes outnull,hrefcomes out empty.Verification
pnpm build,tsc -b,pnpm lintclean. 476 unit tests across 66 files and 29 Playwright tests pass. Both defects have a test that fails onmainand passes here.Still outstanding and not in this PR, since neither is mine to close: a bookmarked article has nowhere to appear (no list endpoint, and
BookmarksPagerenders only posts and comments), and a comment on an article still cannot link back to it.🤖 Generated with Claude Code
https://claude.ai/code/session_01Hu1QuLxS84vdf1gmzoGtWP