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>
This commit is contained in:
Sven
2026-03-19 21:46:35 +01:00
parent c4f654fe9a
commit 711958b8a9
3 changed files with 6 additions and 2 deletions

View File

@@ -99,7 +99,7 @@ const newBlock = ` // [patched:livefetch:v2] Always fetch the live page s
// Validate the response is a real post page, not an error/502 page.
// extractLinks scopes to .h-entry, so if there's no .h-entry the page
// is not a valid post (e.g. nginx 502, login redirect, error template).
if (_html.includes("h-entry")) {
if (_html.includes("h-entry\"") || _html.includes("h-entry ")) {
contentToProcess = _html;
} else {
console.log(\`[webmention] Live page for \${postUrl} has no .h-entry — skipping (error page?)\`);

View File

@@ -3,7 +3,7 @@
* with empty results because the live page was not yet deployed when the poller fired.
*
* Runs at startup but only executes once (guarded by a migrations collection entry).
* After running, the patch-webmention-sender-retry.mjs code fix prevents recurrence.
* After running, the patch-webmention-sender-livefetch.mjs v2 fix prevents recurrence.
*/
import { MongoClient } from "mongodb";

View File

@@ -91,6 +91,10 @@ for (const filePath of candidates) {
}
if (!source.includes(oldSnippet)) {
// livefetch v2 replaces the same block — this patch is intentionally superseded.
if (source.includes("[patched:livefetch:v2]")) {
continue; // silently skip; livefetch v2 is a superset of this patch
}
console.log(`[patch] webmention-sender-retry: target snippet not found in ${filePath} (package updated?)`);
continue;
}