mirror of
https://github.com/morluto/rea.git
synced 2026-11-17 04:04:25 +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
@@ -10,7 +10,7 @@ import {
|
||||
} from "./referenceSourcePathIdentity.js";
|
||||
import { compareUnicodeCodePoints } from "./unicodeCodePointOrder.js";
|
||||
import { digestSchema, prefixedDigestSchema } from "./digests.js";
|
||||
const boundedTextSchema = z.string().min(1);
|
||||
import { nonEmptyTextSchema } from "./textSchemas.js";
|
||||
const relativePathSchema = z
|
||||
.string()
|
||||
.min(1)
|
||||
@@ -38,9 +38,9 @@ const classificationSchema = z.enum([
|
||||
const entryBaseShape = {
|
||||
path: relativePathSchema,
|
||||
classifications: z.array(classificationSchema).min(1),
|
||||
limitations: z.array(boundedTextSchema),
|
||||
limitations: z.array(nonEmptyTextSchema),
|
||||
// Host presentation is retained evidence, separate from relocatable semantics.
|
||||
local_diagnostics: z.array(boundedTextSchema).exactOptional(),
|
||||
local_diagnostics: z.array(nonEmptyTextSchema).exactOptional(),
|
||||
};
|
||||
|
||||
const sourceFileBaseShape = {
|
||||
@@ -129,7 +129,7 @@ const sourceRelationshipSchema = z.strictObject({
|
||||
const parseFailureSchema = z.strictObject({
|
||||
path: relativePathSchema,
|
||||
parser: z.string().min(1),
|
||||
reason: boundedTextSchema,
|
||||
reason: nonEmptyTextSchema,
|
||||
});
|
||||
|
||||
const exclusionSchema = z.discriminatedUnion("reason", [
|
||||
@@ -144,7 +144,7 @@ const exclusionSchema = z.discriminatedUnion("reason", [
|
||||
"default-ignored",
|
||||
"caller-excluded",
|
||||
]),
|
||||
pattern: boundedTextSchema,
|
||||
pattern: nonEmptyTextSchema,
|
||||
}),
|
||||
z.strictObject({
|
||||
path: relativePathSchema,
|
||||
@@ -196,7 +196,7 @@ const graphShape = {
|
||||
.min(1)
|
||||
.regex(/^[\w .:@\x2f+\x2d]+$/u),
|
||||
}),
|
||||
limitations: z.array(boundedTextSchema),
|
||||
limitations: z.array(nonEmptyTextSchema),
|
||||
};
|
||||
|
||||
const historicalSourceGraphStructureSchema = z
|
||||
|
||||
Reference in new issue
Block a user