README.md
Config capacity admission
The supported YAML limit remains 64 KiB. Parser admission is input-derived, not
based on the number of valid fields. yaml.v3 builds a tree before config can
reject a root sequence, unknown mapping, aliases or other invalid shape.
ResolveConfigLimits returns the independent read, decode, canonical encoding,
projection and maximum-operation capacities. OperationCapacityBytes is the
full constant charge taken before reading or replacement encoding:
- Read capacity uses
state.ReadCapacity(MaxBytes), including growth overlap. - Decode capacity follows
store.decodeCapacity's convention of four nodes/tokens per input byte, withyaml.Nodestorage plus 128 bytes for child pointer growth and scanner/parser tokens. Two full-input trees cover the checked tree and strict decoder tree, including a second document. Input and scanner copies add 32 bytes per input byte. Closed-shape typed conversion adds 512 nodes at 512 bytes each, only after shape validation. - The operation includes four read capacities, decode capacity, canonical encoding growth and 256 KiB of typed/projection headroom. The projection allowance alone does not cover malformed YAML parsing.
DecodeReserved, LoadReserved, LoadEffectiveReserved and
ReplaceLockedReserved accept a context and state.Reserver. Admission is
nonblocking; rejection occurs before reads, parsing or replacement effects.
Errors and cancellation release the one operation charge exactly once. Private
helpers share that charge instead of reserving again. Replacement still requires
the caller's administration lock and preserves the protected inode/token checks,
staging cleanup and final rename window.
Plain wrappers, context wrappers and nil reservers use a separate finite local
pool. Its minimum budget is eight maximum-operation charges; eight operations
can overlap and a ninth is rejected. It never means unlimited. Startup and
offline callers use this counted pool. Online service configuration reads and
replacements pass snapshotReserver{s.snapshotBudget} instead, independently of
the configured DATA/control budgets.
Integrators own reservations for results retained after a call. The operation charge ends when the function returns. Returned typed config values do not retain YAML trees or raw input; 256 KiB covers the typed result and its projection/canonical serialization under the private API's result prepayment. These numbers bound explicit owned capacity, not allocator overhead, garbage collector retention, runtime stacks or process RSS. Smaller admission budgets reject work rather than changing the 64 KiB document contract.