Files
reverse-engineering-anything/src/adb/AdbNumericIssues.ts
T
morluto 667ab5ae08 fix(adb): own numeric declaration validation and diagnostics
Parse declarations before selecting values, admit safe integers once, and retain bounded raw numeric issues. Preserve display and package selection policies while distinguishing absent and malformed values.

Keep completed display facts in typed physical-size failures, share the existing diagnostic sample limit, and verify real CLI/MCP contracts with a strict fake ADB.
2026-10-24 06:34:33 +08:00

25 lines
727 B
TypeScript

import { UNPARSED_LINE_SAMPLE_LIMIT } from "./AdbUnparsedLines.js";
/** Retain the first diagnostic facts and exact count without copying command output. */
export const collectNumericIssues = <Issue>() => {
const sample: Issue[] = [];
let total = 0;
return {
add: (issue: Issue) => {
total += 1;
if (sample.length < UNPARSED_LINE_SAMPLE_LIMIT) sample.push(issue);
},
append: (issues: {
readonly sample: readonly Issue[];
readonly total: number;
}) => {
total += issues.total;
for (const issue of issues.sample) {
if (sample.length === UNPARSED_LINE_SAMPLE_LIMIT) break;
sample.push(issue);
}
},
facts: () => ({ sample, total }),
};
};