Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
+7
-94
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env node
|
||||
/* eslint-disable no-console */
|
||||
import { createHash } from "node:crypto";
|
||||
import { mkdir, readdir, readFile, writeFile } from "node:fs/promises";
|
||||
import { mkdir, writeFile } from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { markFailedBaselineGates } from "./baseline-gate-exit.mjs";
|
||||
@@ -11,29 +11,11 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
const repoRoot = path.resolve(__dirname, "..");
|
||||
export const reportPath = path.join(repoRoot, ".tc/baselines/transactional-mail-provider/baseline-health.md");
|
||||
|
||||
const ignoredDirectoryNames = new Set([
|
||||
".git",
|
||||
"node_modules",
|
||||
"build",
|
||||
"dist",
|
||||
".react-router",
|
||||
".tc",
|
||||
".cache",
|
||||
".turbo",
|
||||
".vite",
|
||||
"coverage",
|
||||
]);
|
||||
|
||||
const postmarkScannerSelfFileAllowlist = new Set([
|
||||
"scripts/verify-transactional-mail-provider-baseline.mjs",
|
||||
"scripts/verify-transactional-mail-provider-baseline.test.mjs",
|
||||
]);
|
||||
|
||||
export const gates = [
|
||||
{ id: "typecheck", command: "pnpm", args: ["run", "typecheck"] },
|
||||
{ id: "lint", command: "pnpm", args: ["run", "lint"] },
|
||||
{ id: "vitest-mail-runtime", command: "pnpm", args: ["exec", "vitest", "run", "packages/mail/src/mailersend.test.ts"] },
|
||||
{ id: "postmark-scan", command: "internal", args: ["scan-postmark"] },
|
||||
{ id: "vitest-mail-runtime", command: "pnpm", args: ["exec", "vitest", "run", "packages/mail/src/mailjet.test.ts", "packages/mail/src/queue.test.ts"] },
|
||||
{ id: "removed-provider-scan", command: "pnpm", args: ["run", "verify:removed-modules"] },
|
||||
];
|
||||
|
||||
function shellCommand({ command, args }) {
|
||||
@@ -84,13 +66,9 @@ function countVitestFailures(output) {
|
||||
return failedFilesMatch ? parseNumber(failedFilesMatch[1]) : 0;
|
||||
}
|
||||
|
||||
function countPostmarkScanFailures(stdout, output) {
|
||||
try {
|
||||
const scan = JSON.parse(stdout);
|
||||
return scan.matchCount ?? 0;
|
||||
} catch {
|
||||
return output.trim() ? 1 : 0;
|
||||
}
|
||||
function countRemovedProviderFailures(output) {
|
||||
const match = output.match(/matches found:\s*(\d+)/i);
|
||||
return match ? parseNumber(match[1]) : 0;
|
||||
}
|
||||
|
||||
export function failureCount(gateId, stdout, stderr) {
|
||||
@@ -98,74 +76,10 @@ export function failureCount(gateId, stdout, stderr) {
|
||||
if (gateId === "typecheck") return countTypeScriptFailures(output);
|
||||
if (gateId === "lint") return countEslintFailures(output);
|
||||
if (gateId === "vitest-mail-runtime") return countVitestFailures(output);
|
||||
if (gateId === "postmark-scan") return countPostmarkScanFailures(stdout, output);
|
||||
if (gateId === "removed-provider-scan") return countRemovedProviderFailures(output);
|
||||
return 0;
|
||||
}
|
||||
|
||||
function isIgnoredDirectory(name) {
|
||||
return ignoredDirectoryNames.has(name) || name.endsWith(".cache");
|
||||
}
|
||||
|
||||
async function* walkFiles(root, directory = root) {
|
||||
const entries = await readdir(directory, { withFileTypes: true });
|
||||
for (const entry of entries) {
|
||||
if (entry.isDirectory() && isIgnoredDirectory(entry.name)) continue;
|
||||
|
||||
const absolutePath = path.join(directory, entry.name);
|
||||
if (entry.isDirectory()) {
|
||||
yield* walkFiles(root, absolutePath);
|
||||
} else if (entry.isFile()) {
|
||||
yield absolutePath;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function scanPostmarkOccurrences(root = repoRoot) {
|
||||
const matches = [];
|
||||
for await (const filePath of walkFiles(root)) {
|
||||
const relativePath = path.relative(root, filePath).split(path.sep).join("/");
|
||||
if (postmarkScannerSelfFileAllowlist.has(relativePath)) continue;
|
||||
|
||||
let content;
|
||||
try {
|
||||
content = await readFile(filePath, "utf8");
|
||||
} catch {
|
||||
continue;
|
||||
}
|
||||
|
||||
const lines = content.split(/\r?\n/);
|
||||
lines.forEach((line, index) => {
|
||||
if (/postmark/i.test(line)) {
|
||||
matches.push({
|
||||
file: relativePath,
|
||||
line: index + 1,
|
||||
text: line.trim().slice(0, 220),
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
matches.sort((a, b) => `${a.file}:${a.line}`.localeCompare(`${b.file}:${b.line}`));
|
||||
return {
|
||||
matchCount: matches.length,
|
||||
matches,
|
||||
};
|
||||
}
|
||||
|
||||
async function runPostmarkScanGate() {
|
||||
const startedAt = Date.now();
|
||||
const scan = await scanPostmarkOccurrences(repoRoot);
|
||||
const stdout = `${JSON.stringify(scan, null, 2)}\n`;
|
||||
return {
|
||||
id: "postmark-scan",
|
||||
command: "internal scan-postmark",
|
||||
exitCode: 0,
|
||||
durationMs: Date.now() - startedAt,
|
||||
failureCount: failureCount("postmark-scan", stdout, ""),
|
||||
fingerprint: outputFingerprint(stdout),
|
||||
};
|
||||
}
|
||||
|
||||
function runShellGate(gate) {
|
||||
return new Promise((resolve) => {
|
||||
const startedAt = Date.now();
|
||||
@@ -201,7 +115,6 @@ function runShellGate(gate) {
|
||||
}
|
||||
|
||||
async function runGate(gate) {
|
||||
if (gate.id === "postmark-scan") return runPostmarkScanGate();
|
||||
return runShellGate(gate);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user