chore: sync captured review base for PR 2815

This commit is contained in:
morluto
2026-10-13 23:09:50 +08:00
234 changed files with 12183 additions and 1979 deletions
@@ -8,7 +8,10 @@ import { spawnOwnedProviderProcess } from "../../dist/process/ProviderProcess.js
import { createSystemProcessOwnershipHost } from "../../dist/process/ProcessOwnershipObservation.js";
import { liveProcesses } from "../../dist/process/ProcessOwnershipProcessTree.js";
import { CdpConnection } from "../../dist/browser/CdpConnection.js";
import { waitForBrowserDevtoolsPort } from "../../dist/browser/BrowserProcessStartup.js";
import {
BROWSER_DEVTOOLS_STARTUP_TIMEOUT_MS,
waitForBrowserDevtoolsPort,
} from "../../dist/browser/BrowserProcessStartup.js";
/** Launch the synthetic fixture browser and await CDP in its own verified process group. */
export async function startRuntimeFixtureBrowser(executable, origin) {
@@ -50,7 +53,7 @@ export async function startRuntimeFixtureBrowser(executable, origin) {
stderr: () => stderr,
// Match the broader real-browser verifier's allowance for cold Chrome
// startup on shared runners; early process failures still reject at once.
timeoutMs: 60_000,
timeoutMs: BROWSER_DEVTOOLS_STARTUP_TIMEOUT_MS,
});
return {
port,
+58 -11
View File
@@ -1,13 +1,41 @@
import { readFile, readdir, stat } from "node:fs/promises";
import { dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
const readmeLinkTargets = (content, language = "en") =>
[...content.matchAll(/\]\(([^)\s]+)\)/gu)]
.map((match) => match[1] ?? "")
const repoRelative = (root, from, target) => {
const index = target.search(/[#?]/u);
const pathPart = index === -1 ? target : target.slice(0, index);
const suffix = index === -1 ? "" : target.slice(index);
if (pathPart.length === 0 || /^[a-z][a-z0-9+.-]*:/iu.test(pathPart))
return target;
const absolute = resolve(root, dirname(from), pathPart);
const withinRepo = relative(root, absolute);
if (
withinRepo === ".." ||
withinRepo.startsWith(`..${sep}`) ||
isAbsolute(withinRepo)
)
return target;
return `${withinRepo.split(sep).join("/")}${suffix}`;
};
const isLanguageNavigation = (target) => {
const path = target.split(/[#?]/u)[0];
return (
path === "README.md" ||
/^docs\/readme\/README_[A-Za-z0-9-]+\.md$/u.test(path)
);
};
const readmeDestinations = (content) => [
...content.matchAll(/\]\(([^)\s]+)\)/gu),
...content.matchAll(/\b(?:src|href)="([^"]+)"/gu),
];
const readmeLinkTargets = (root, from, content, language = "en") =>
readmeDestinations(content)
.map((match) => repoRelative(root, from, match[1] ?? ""))
.filter(
(target) =>
!target.startsWith("#") &&
!/^README(?:_[A-Za-z0-9-]+)?\.md$/u.test(target),
(target) => !target.startsWith("#") && !isLanguageNavigation(target),
)
.map((target) => {
if (language === "en" || !URL.canParse(target)) return target;
@@ -70,9 +98,19 @@ export const documentationFactIssues = async (root, catalog) => {
const issues = await skillReferenceIssues(
join(root, "skills/reverse-engineer-anything"),
);
const readmePaths = (await readdir(root))
.filter((path) => /^README(?:_[A-Za-z0-9-]+)?\.md$/u.test(path))
.sort();
const translatedFolder = join(root, "docs/readme");
let translatedNames = [];
try {
translatedNames = await readdir(translatedFolder);
} catch (cause) {
if (cause?.code !== "ENOENT") throw cause;
}
const readmePaths = [
"README.md",
...translatedNames
.filter((name) => /^README_[A-Za-z0-9-]+\.md$/u.test(name))
.map((name) => `docs/readme/${name}`),
].sort();
const readmes = new Map();
for (const path of readmePaths) {
const content = await readFile(join(root, path), "utf8");
@@ -94,7 +132,11 @@ export const documentationFactIssues = async (root, catalog) => {
);
}
}
const canonicalLinks = readmeLinkTargets(readmes.get("README.md") ?? "");
const canonicalLinks = readmeLinkTargets(
root,
"README.md",
readmes.get("README.md") ?? "",
);
const languageInventory = JSON.parse(
await readFile(join(root, "website/locales/languages.json"), "utf8"),
);
@@ -104,7 +146,12 @@ export const documentationFactIssues = async (root, catalog) => {
for (const path of readmePaths.filter((path) => path !== "README.md"))
if (
JSON.stringify(
readmeLinkTargets(readmes.get(path) ?? "", readmeLanguages.get(path)),
readmeLinkTargets(
root,
path,
readmes.get(path) ?? "",
readmeLanguages.get(path),
),
) !== JSON.stringify(canonicalLinks)
)
issues.push(`${path}: documentation links differ from README.md`);