12 Commits

Author SHA1 Message Date
Sven
67eacf6b99 fix(webmention): livefetch v6 with diagnostic log + reset-stale v11
livefetch v6:
- Adds console.log showing which property links were built per post
  (e.g. "in-reply-to" for replies) — makes it debuggable without server access
- Fixes retryPatchedBlock to include the two comment lines the retry patch
  actually inserts (was missing them, causing "Target block not found" on
  fresh upstream → retry → livefetch path)
- Adds v5 to priorMarkersNoContinue with contentToProcess-line end detection
  so v5 → v6 in-place upgrade works correctly

reset-stale: bump to v11 to retry ca3d8 and any other posts stuck
before v5/v6 deployment.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-22 11:40:57 +01:00
Sven
c0b9878033 fix(webmention): silence retry noise for all livefetch versions, bump stale migration to v10
retry patch: regex now matches [patched:livefetch] and [patched:livefetch:vN]
so it silently skips for any livefetch version, not just v2.

reset-stale: bump to v10 to retry posts stuck during v5 rollout.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 20:56:02 +01:00
Sven
711958b8a9 fix(patches): silence retry noise, tighten h-entry check, fix stale comment
- retry: silently skip when livefetch:v2 marker is present instead of
  logging a misleading "target snippet not found (package updated?)"
  warning on every startup
- livefetch: match `h-entry"` or `h-entry ` instead of bare `h-entry`
  to avoid false positives from body text containing the string
- reset-stale: update comment to reference livefetch v2 (not retry)
  as the patch that prevents recurrence

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-19 21:46:35 +01:00
Sven
c4f654fe9a fix(webmention): validate live page has .h-entry before processing
Root cause: when the livefetch got a 200 response that was actually an
error page (nginx 502 HTML, login redirect, error template), it had no
.h-entry so extractLinks found 0 links — permanently marking the post
as sent with empty results.

Changes:
- livefetch v2: check fetched HTML contains "h-entry" before using it;
  if missing, skip and retry next poll instead of falling back to stored
  content (which also lacks microformat links for likes/reposts/bookmarks)
- livefetch v2: can detect and upgrade from v1 patch in-place
- reset-stale v9: also matches the v1.0.6+ detail format (empty arrays)
  to catch posts stuck by the error-page bug

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-19 14:02:51 +01:00
Sven
ad1d82fc6f fix(patches): bump stale-reset migration to v8
Posts were marked as webmention-sent with 0/0/0 results during the
SyntaxError period. The v7 migration already ran before those posts
were processed, so bump to v8 to reset them for retry now that the
livefetch patch is fixed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-18 17:52:56 +01:00
Sven
fd045d9c0e fix(webmention-sender): fall back to siteUrl for public base URL rewriting
The livefetch patch used `process.env.PUBLICATION_URL || process.env.SITE_URL`
to determine the public base URL for rewriting to INTERNAL_FETCH_URL. Neither
env var is set — the publication URL comes from indiekit.config.mjs which has
a hardcoded fallback. Without a publicBase, URL rewriting never fired, the
public HTTPS URL was fetched directly, failed inside the FreeBSD jail, and fell
back to stored content.

For interaction posts (repost/bookmark/reply/like), stored content is just the
body text — the target URL (repostOf, bookmarkOf, inReplyTo, likeOf) is only
rendered in the live page via reply-context.njk. So 0 webmentions were sent.

Fix: add `|| siteUrl` as fallback. siteUrl is already in scope (derived from
`publication.me`) and is the correct value when env vars are absent.

Also bump reset-stale migration to v7 so interaction posts incorrectly marked
with 0 results (e.g. 342a5 repost) are reset and retried on next startup.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-18 09:49:23 +01:00
Sven
059f36bf06 fix(webmention-sender): bump reset-stale migration to v6
Posts processed before the livefetch patch was applied were re-processed
without live page fetching, leaving them with empty results again.
Bumping the migration ID triggers another reset on next startup so the
poller retries them with livefetch active.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-18 08:48:47 +01:00
Sven
c1f9d64401 fix(patches): rewrite livefetch URL to localhost and add timeout
The webmention sender livefetch patch was fetching the public HTTPS URL
which hangs in the jailed setup (port 443 is on the nginx jail). Rewrite
to localhost like all other internal-fetch patches, and add a 15s
AbortController timeout. Bump reset-stale migration to v5 so posts
incorrectly marked as sent with 0/0/0 get retried.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-17 11:58:35 +01:00
Sven
d501d70e1d fix(patches): restore livefetch patch so webmentions use live page HTML
The webmention sender was using stored post content (just the body text)
instead of the live page, missing template-rendered links like
u-in-reply-to, u-like-of, u-bookmark-of. This caused reply/like/bookmark
posts to be marked as sent with 0 webmentions. Bump reset-stale migration
to v4 so affected posts are retried.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-17 09:56:35 +01:00
Sven
b632af9564 fix(webmention): scope link extraction to .h-entry not .e-content
u-in-reply-to, u-like-of, u-repost-of etc. are rendered in an aside
before the .e-content div, not inside it. Scoping to .h-entry .e-content
caused these microformat links to be missed entirely.

Also bump reset-stale migration to v3 so posts already marked sent with
zero results (like /replies/88feb/) are retried with the corrected scope.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-14 09:40:48 +01:00
svemagie
0862a266e6 fix: always fetch live page for webmention link extraction
The core bug: stored post content (post.properties.content.html) is only
the post body text. Template-rendered microformat links (u-in-reply-to,
u-like-of, u-bookmark-of, u-repost-of) live in the 11ty HTML output, not
in MongoDB. So replies, likes, bookmarks and reposts never had their target
URLs extracted — webmentions were silently skipped.

- patch-webmention-sender-livefetch: always fetch the live page; fall back
  to stored content only if the page is unavailable; skip (don't mark sent)
  when no content is available so the next poll retries it. Handles both
  original upstream code and the older retry-patch variant.
- patch-webmention-sender-reset-stale: bump to v2 so posts incorrectly
  marked as sent today (empty results due to the content bug) get reset
  and retried on next deploy.
- Remove patch-webmention-sender-retry: superseded by livefetch.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-11 20:41:30 +01:00
svemagie
881976f821 fix: prevent silent webmention-sent data loss on fetch failure
Two startup scripts:

patch-webmention-sender-retry: patches the package controller so that
when a post has no stored content and the live page fetch fails (page not
yet deployed), the post is skipped instead of being permanently marked as
webmention-sent with zero results. On the next poll the page will be live
and webmentions will be sent correctly.

patch-webmention-sender-reset-stale: one-time migration (guarded by a
migrations collection entry) that resets all posts already incorrectly
marked as webmention-sent with all-zero results, so they are retried on
the next poll.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-11 20:08:39 +01:00