mirror of
https://github.com/morluto/rea.git
synced 2026-11-15 19:23:24 +00:00
refactor(domain): one owner each for non-empty text schemas and UTF-8 head excerpts (#10569)
Fifteen domain schema files each declared z.string().min(1), eight of them as boundedTextSchema although it bounds nothing. They now share nonEmptyTextSchema from src/domain/textSchemas.ts; the one trimming copy in reconstructionCoverage.ts is renamed trimmedTextSchema. Three private UTF-8 prefix truncators (gdb recent MI records, rizin diagnostics, environment replay) and src/process/boundedUtf8Text.ts are replaced by utf8HeadExcerpt in src/domain/utf8HeadExcerpt.ts, which encodes only the retained prefix and returns a slice of the source text.
This commit is contained in:
1 parent
1ba93b4602
commit
eead7a5815
29 files changed
+236
-173
No files matched your search
@@ -25,7 +25,7 @@ import type {
|
||||
} from "../domain/analysisErrorBase.js";
|
||||
import { analysisErrorWithCleanupFailure } from "../domain/analysisErrorCleanup.js";
|
||||
import { safeParseJson } from "../domain/safeJson.js";
|
||||
import { boundedUtf8Text } from "./boundedUtf8Text.js";
|
||||
import { utf8HeadExcerpt } from "../domain/utf8HeadExcerpt.js";
|
||||
import { createDarwinHelperCache } from "./DarwinHelperCache.js";
|
||||
import { snapshotEnvironment } from "./snapshotEnvironment.js";
|
||||
import {
|
||||
@@ -266,8 +266,8 @@ const compilerFailureFacts = (
|
||||
| undefined => {
|
||||
const failure = execFileOutputFailure(cause);
|
||||
if (failure === undefined) return undefined;
|
||||
const stderr = boundedUtf8Text(failure.stderr, MAX_COMPILER_OUTPUT_BYTES);
|
||||
const stdout = boundedUtf8Text(failure.stdout, MAX_COMPILER_OUTPUT_BYTES);
|
||||
const stderr = utf8HeadExcerpt(failure.stderr, MAX_COMPILER_OUTPUT_BYTES);
|
||||
const stdout = utf8HeadExcerpt(failure.stdout, MAX_COMPILER_OUTPUT_BYTES);
|
||||
const outcome =
|
||||
failure.code === "ETIMEDOUT"
|
||||
? "timed_out"
|
||||
@@ -336,7 +336,7 @@ const compilerInspectionError = (
|
||||
code === "ENOENT"
|
||||
? `macOS process ownership inspection requires the Apple Swift compiler via ${launcher}`
|
||||
: `macOS process ownership helper compilation failed via ${launcher}`;
|
||||
const stderr = boundedUtf8Text(outcome?.stderr ?? "", STDERR_EXCERPT_LIMIT);
|
||||
const stderr = utf8HeadExcerpt(outcome?.stderr ?? "", STDERR_EXCERPT_LIMIT);
|
||||
const diagnostics = stderr.text.trim();
|
||||
const truncated =
|
||||
stderr.truncated ||
|
||||
|
||||
Reference in new issue
Block a user