fix(contracts): advertise NUL with a portable hex escape

Use the equivalent hex NUL spelling in named public contracts while preserving current path and reserved-name validation. Verify converted JSON Schema and real stdio catalog consumers.

Closes #1329

Co-authored-by: Yi-111-a <97448247+Yi-111-a@users.noreply.github.com>
This commit is contained in:
yi111
2026-10-10 01:54:42 +08:00
committed by GitHub
co-authored by Yi-111-a
parent 5f16124a31
commit 3f59a84bd1
7 changed files with 27 additions and 18 deletions
+3 -3
View File
@@ -5,7 +5,7 @@ import { z } from "zod";
const positiveBudget = z.number().int().safe().positive();
const timedEventBase = { at_ms: z.number().int().safe().nonnegative() };
const reservedRunIdEnvironmentName = "REA_PROCESS_RUN_ID";
const ENVIRONMENT_NAME_CHARACTER = "[^=\\u0000]";
const ENVIRONMENT_NAME_CHARACTER = "[^=\\x00]";
/**
* Nonempty environment names other than the reserved run identifier. The
@@ -20,7 +20,7 @@ const environmentNamePattern = (reserved: string): RegExp => {
const character = reserved[index] ?? "";
// Diverge here, match the next reserved character, or (after a nonempty
// prefix) end the name early.
const choice = `[^=\\u0000${character}]${ENVIRONMENT_NAME_CHARACTER}*|${character}${rest}`;
const choice = `[^=\\x00${character}]${ENVIRONMENT_NAME_CHARACTER}*|${character}${rest}`;
rest = index === 0 ? choice : `(?:${choice})?`;
}
return new RegExp(`^(?:${rest})$`, "u");
@@ -38,7 +38,7 @@ const environmentName = z
const childProcessString = z
.string()
.regex(
/^[^\u0000]*$/u,
/^[^\x00]*$/u,
"Values passed to operating-system APIs cannot contain NUL",
);
export const normalizationSchema = z.object({