mirror of
https://github.com/openclaw/openclaw.git
synced 2026-10-03 09:39:25 +00:00
Source and performance budgets shared fatal exits with correctness checks, so ordinary growth could block otherwise valid changes. Centralize limit severity and GitHub annotations/summaries, keep local checks strict, and carry warnings across native lint, container, and BuildKit boundaries. Keep semantic lint, types, API inventories, source ownership, invalid measurements, process failures, and runner admission guards blocking. Validation: P2 review clean; three Linux owner-configuration replays and 20 standalone policy runs passed; typechecks, targeted type-aware lint, Knip export scans, workflow checks, formatting, and diff checks passed. The changed gate found a test environment typing error, corrected and verified by the root-test typecheck. One unrelated preparation process cleanup failure did not reproduce in its diagnostic replay; no fix claimed.
43 lines
1.3 KiB
TypeScript
43 lines
1.3 KiB
TypeScript
import { createReadStream } from "node:fs";
|
|
import { createInterface } from "node:readline";
|
|
import { reportLimitViolations } from "./lib/check-limits.mts";
|
|
|
|
function decodeCommand(value: string) {
|
|
return value.replace(/%25|%0D|%0A|%3A|%2C/gu, (escape) => {
|
|
switch (escape) {
|
|
case "%0D":
|
|
return "\r";
|
|
case "%0A":
|
|
return "\n";
|
|
case "%3A":
|
|
return ":";
|
|
case "%2C":
|
|
return ",";
|
|
default:
|
|
return "%";
|
|
}
|
|
});
|
|
}
|
|
|
|
const input = process.argv[2] ? createReadStream(process.argv[2]) : process.stdin;
|
|
const seen = new Set<string>();
|
|
for await (const line of createInterface({ input, crlfDelay: Infinity })) {
|
|
// BuildKit prefixes process output and can repeat it in a failed-step excerpt.
|
|
const match =
|
|
/^(?:#\d+ (?:\d+(?:\.\d+)? )?)?::warning file=([^,]*),line=(\d+),col=0,title=(.*?)::(.*)$/u.exec(
|
|
line,
|
|
);
|
|
if (!match || seen.has(match[0].replace(/^#\d+ (?:\d+(?:\.\d+)? )?/u, ""))) {
|
|
continue;
|
|
}
|
|
const [, file, sourceLine, title, message] = match;
|
|
seen.add(match[0].replace(/^#\d+ (?:\d+(?:\.\d+)? )?/u, ""));
|
|
reportLimitViolations([
|
|
{
|
|
file: decodeCommand(file!),
|
|
line: Number(sourceLine),
|
|
title: decodeCommand(title!),
|
|
message: decodeCommand(message!),
|
|
},
|
|
]);
|
|
}
|