Documentation
¶
Index ¶
Constants ¶
const ( HardMaxBytes int64 = 10 * 1024 * 1024 DefaultMaxDepth = 128 DefaultMaxNodes = 250_000 DefaultMaxStringBytes = 1024 * 1024 )
Variables ¶
This section is empty.
Functions ¶
func UnpairedSurrogateEscape ¶ added in v0.23.0
UnpairedSurrogateEscape reports the offset of the first \uD800-\uDFFF escape that is not one half of a well-formed pair, and whether one was found.
Go's decoder replaces such an escape with U+FFFD without complaint, which is silent lossy repair of a value RFC 8785 §3.2.2.2 says a canonicalizer must refuse: an authored "\ud800" would otherwise canonicalize to the same bytes as a literal U+FFFD, so two different documents would compare equal and a byte comparison §8.3 requires to be exact would not be. Refusing at the carrier fixes it once for every document that reaches this runtime — pack, matrix, facts, evidence, configuration, and graph — rather than once per reader.
It is exported for the one caller outside this package that faces the same defect one level up: the MCP stdio transport, where the escape is written in the JSON-RPC message rather than in a document it carries, and no carrier is reached because the tool argument has already been repaired into a Go string (ADR-0038). Every other reader gets this through Decode.
Callers must hand it bytes that already parsed as JSON, so a backslash appears only inside a string and every escape is well-formed; the walk still checks its own bounds rather than trusting that. Over bytes that are not JSON its string tracking is a guess — an unterminated string makes the rest of the input look like string content — so a caller settles JSON validity first and reports that defect instead.
Types ¶
type Failure ¶
type Failure struct {
Resource bool
Diagnostic result.Diagnostic
}