The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
chore: files changed scripts/__tests__/retry-markdown-links.test.mjs,scripts/ci/retry-markdown-links
Steven Enamakelc66c81b44a72
diff --git a/scripts/__tests__/retry-markdown-links.test.mjs b/scripts/__tests__/retry-markdown-links.test.mjsindex ce384a4f5f..ad6ddbde07 100644--- a/scripts/__tests__/retry-markdown-links.test.mjs+++ b/scripts/__tests__/retry-markdown-links.test.mjs@@ -94,3 +94,47 @@ test("retry inputs deduplicate repeated failures without dropping URL fragments""https://example.test/docs#anchor",]);});++test("executable retries preserve report files and propagate final success or failure", async () => {+ const { mkdtempSync, writeFileSync, readFileSync, rmSync } =+ await import("node:fs");+ const { tmpdir } = await import("node:os");+ const { join } = await import("node:path");+ const { recheckReport } = await import("../ci/retry-markdown-links.mjs");+ for (const recover of [true, false]) {+ const folder = mkdtempSync(join(tmpdir(), "lychee retry test "));+ try {+ const report = join(folder, "report.md");+ const binary = join(folder, "fake checker.mjs");+ const counter = join(folder, "calls.json");+ writeFileSync(report, unavailable);+ writeFileSync(+ binary,+ `#!/usr/bin/env node+import { readFileSync, writeFileSync, existsSync } from 'node:fs';+const counter = ${JSON.stringify(counter)};+const count = existsSync(counter) ? JSON.parse(readFileSync(counter, 'utf8')) + 1 : 1;+writeFileSync(counter, JSON.stringify(count));+const args = process.argv.slice(2);+const input = readFileSync(args.at(-1), 'utf8');+if (!input.includes('https://example.test/docs#anchor')) process.exit(3);+const success = ${recover} && count === 2;+writeFileSync(args[args.indexOf('--output') + 1], success ? '' : ${JSON.stringify(unavailable)});+process.exit(success ? 0 : 2);+`,+ { mode: 0o755 },+ );+ assert.equal(+ await recheckReport(report, binary, { wait: async () => {} }),+ recover ? 0 : 2,+ );+ assert.equal(JSON.parse(readFileSync(counter, "utf8")), recover ? 2 : 3);+ assert.equal(+ readFileSync(join(folder, "retry-1.md"), "utf8"),+ "- <https://example.test/docs#anchor>\n",+ );+ } finally {+ rmSync(folder, { recursive: true, force: true });+ }+ }+});diff --git a/scripts/ci/retry-markdown-links.mjs b/scripts/ci/retry-markdown-links.mjsindex adf551a852..496717e4db 100644--- a/scripts/ci/retry-markdown-links.mjs+++ b/scripts/ci/retry-markdown-links.mjs@@ -32,11 +32,13 @@ export async function retryServiceUnavailable({return status;}-async function main(reportPath, binary) {+/** Recheck a Lychee Markdown report with the installed executable. */+export async function recheckReport(reportPath, binary, { wait = delay } = {}) {const initialReport = readFileSync(reportPath, "utf8");let attempt = 0;const status = await retryServiceUnavailable({initialReport,+ wait,check(urls) {const input = join(dirname(reportPath), `retry-${++attempt}.md`);writeFileSync(input, urls.map((url) => `- <${url}>`).join("\n") + "\n");@@ -63,12 +65,12 @@ async function main(reportPath, binary) {};},});- process.exitCode = status;+ return status;}if (process.argv[1] &&resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {- await main(process.argv[2], process.argv[3]);+ process.exitCode = await recheckReport(process.argv[2], process.argv[3]);}