Skip to content

Commit c26e2b1

Browse files
TMHSDigitalclaude
andcommitted
Stop reporting linked API endpoints that answer 405 as dead (#305)
The weekly link check fetches every URL in an entry's Evidence and Notes with GET. Notes also link API endpoints (soundza's MCP server), and those answer GET with 405 Method Not Allowed: the server is up and the endpoint exists. The report listed it as a page that no longer loads, and would have done so every week. Linked pages now go through classifyLinkedPage, which treats 405 as reachable and otherwise defers to classify. An entry's own url keeps the stricter rule from #275, where 405 is dead. The other three rows in #305 were a transient DNS failure: all three static.makehumancommunity.org pages resolve and return 200 on a recheck (2026-11-17), so the mpfb and makehuman entries need no change. Fixes #305 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent e683bde commit c26e2b1

3 files changed

Lines changed: 31 additions & 8 deletions

File tree

‎site/check-links.mjs‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import { safeFetch } from "./lib/safe-fetch.mjs";
3030
import { isListed } from "./lib/shared.mjs";
3131
import { normalizeEntry } from "./lib/entry-fields.mjs";
3232
import { cliArgs } from "./lib/cli.mjs";
33-
import { checkMaintenanceRepos, classify, evidenceUrls, manualHostReason, reportUrl, staleDaysFrom } from "./lib/link-check.mjs";
33+
import { checkMaintenanceRepos, classify, classifyLinkedPage, evidenceUrls, manualHostReason, reportUrl, staleDaysFrom } from "./lib/link-check.mjs";
3434
import { evidenceSection, notesSection } from "./lib/frontmatter.mjs";
3535

3636
const __dirname = path.dirname(fileURLToPath(import.meta.url));
@@ -62,31 +62,31 @@ function loadEntries() {
6262
return out.sort((a, b) => a.id.localeCompare(b.id));
6363
}
6464

65-
async function check(entry) {
65+
async function check(entry, classifier = classify) {
6666
const opts = { headers: { "user-agent": UA, accept: "text/html,*/*;q=0.8" } };
6767
try {
6868
// Redirects are followed hop by hop, and none may reach a private address.
6969
const { response: res, finalUrl } = await safeFetch(entry.url, { ...opts, signal: AbortSignal.timeout(TIMEOUT_MS) }, { schemes: ["https:", "http:"], maxRedirects: 10 });
7070
res.body?.cancel().catch(() => {});
71-
return classify(entry.url, res.status, finalUrl);
71+
return classifier(entry.url, res.status, finalUrl);
7272
} catch (err) {
7373
const cause = err.cause?.code || err.name || "error";
7474
if (cause === "TimeoutError") return { kind: "dead", detail: `no answer in ${TIMEOUT_MS / 1000}s`, timedOut: true };
7575
return { kind: "dead", detail: cause };
7676
}
7777
}
7878

79-
async function run(entries) {
79+
async function run(entries, classifier = classify) {
8080
const results = new Array(entries.length);
8181
let next = 0;
8282
await Promise.all(
8383
Array.from({ length: CONCURRENCY }, async () => {
8484
while (next < entries.length) {
8585
const i = next++;
86-
let r = await check(entries[i]);
86+
let r = await check(entries[i], classifier);
8787
// One retry for anything that did not answer cleanly, except a full
8888
// 20 s timeout: a second one would cost a worker 40 s per dead host.
89-
if ((r.kind === "dead" || r.kind === "unavailable") && !r.timedOut) r = await check(entries[i]);
89+
if ((r.kind === "dead" || r.kind === "unavailable") && !r.timedOut) r = await check(entries[i], classifier);
9090
// A refusal is not retried, and the checker never poses as a browser:
9191
// a host that refuses scripts goes on the manual list (config.json).
9292
results[i] = r;
@@ -124,7 +124,7 @@ const results = await run(entries);
124124
// Only a page that is gone counts as a problem; a refusal says nothing about the licence.
125125
// Temporary server errors are listed under "Could not check".
126126
const pageJobs = [...new Map(entries.flatMap((e) => e.licencePages.map((url) => [url, { id: e.id, rel: e.rel, url }]))).values()];
127-
const pageResults = await run(pageJobs);
127+
const pageResults = await run(pageJobs, classifyLinkedPage);
128128
const pageRows = pageJobs.map((j, i) => ({ ...j, ...pageResults[i] }));
129129
const deadPages = pageRows.filter((r) => r.kind === "dead");
130130
const { mismatches: maintenance, skipped } = await checkMaintenance(entries);

‎site/lib/lib.test.mjs‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -841,7 +841,7 @@ await section("block at line 828", async () => {
841841

842842
/* review fixes, 2026-10 (#59-#66) ------------------------------------------ */
843843
import { csvField } from "./exports.mjs";
844-
import { checkMaintenanceRepos, classify, reportUrl, siteOf, staleDaysFrom } from "./link-check.mjs";
844+
import { checkMaintenanceRepos, classify, classifyLinkedPage, reportUrl, siteOf, staleDaysFrom } from "./link-check.mjs";
845845
import { listEntryFiles } from "./entry-files.mjs";
846846
import nodeFs from "node:fs";
847847
import nodeOs from "node:os";
@@ -910,6 +910,17 @@ await section("link-check transient classification (#275)", async () => {
910910
eq("HTTP 200 stays ok", classify(url, 200, url).kind, "ok");
911911
});
912912

913+
/* linked API endpoints answer 405 (#305) ---------------------------------- */
914+
await section("link-check linked-page classification (#305)", async () => {
915+
const api = "https://mcp.assets.test/mcp";
916+
eq("HTTP 405 on a linked page is ok", classifyLinkedPage(api, 405, api).kind, "ok");
917+
eq("HTTP 405 on an entry url stays dead", classify(api, 405, api).kind, "dead");
918+
eq("HTTP 404 on a linked page is dead", classifyLinkedPage(api, 404, api).kind, "dead");
919+
eq("HTTP 503 on a linked page is unavailable", classifyLinkedPage(api, 503, api).kind, "unavailable");
920+
eq("HTTP 403 on a linked page is blocked", classifyLinkedPage(api, 403, api).kind, "blocked");
921+
eq("HTTP 200 on a linked page is ok", classifyLinkedPage(api, 200, api).kind, "ok");
922+
});
923+
913924
await section("link-check transient report (#275)", async () => {
914925
const { execFileSync } = await import("node:child_process");
915926
const { pathToFileURL } = await import("node:url");

‎site/lib/link-check.mjs‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,18 @@ export function classify(entryUrl, status, finalUrl) {
7171
return { kind: "ok" };
7272
}
7373

74+
/**
75+
* What a finished request says about a page linked from Evidence or Notes.
76+
* Notes also link API endpoints (a REST base, an MCP server), and those answer
77+
* a GET with 405: the server is up and the endpoint exists, it just takes
78+
* another method, so it is not a dead page (#305). An entry's own `url` keeps
79+
* the stricter `classify`, where 405 is dead.
80+
*/
81+
export function classifyLinkedPage(pageUrl, status, finalUrl) {
82+
if (status === 405) return { kind: "ok" };
83+
return classify(pageUrl, status, finalUrl);
84+
}
85+
7486
/**
7587
* A URL as inert Markdown for the report issue: a code span, so a crafted URL
7688
* cannot add links, images or @mentions to the issue.

0 commit comments

Comments
 (0)