Expand description
Frontmatter parsing — port of src/rac/core/frontmatter.py plus the
bounded PyYAML-1.1 SafeLoader subset it rides on (PORT-CONTRACT.d/02).
This is parity landmine #1: the oracle is PyYAML 6.0.3’s pure-Python
SafeLoader (full YAML 1.1) subclassed with three guards — duplicate-key
rejection, alias rejection, and a 32-level node-count depth cap. Byte
parity requires reproducing PyYAML’s implicit resolution, its error
problem strings, and CPython repr() formatting inside issue messages.
The scanner/parser/composer/constructor below are direct ports of the
corresponding PyYAML modules (message strings verbatim).
Known oracle crashes (PORT-CONTRACT decision 3): several inputs crash the
oracle with uncaught non-YAML exceptions (unhashable mapping keys,
explicit-tag/value mismatches like !!int '', out-of-range dates such as
2026-13-01, !!map on a non-empty scalar/sequence, and CPython’s
4300-digit int<->str conversion limit). This port does NOT
crash: every such path returns a distinguishable internal issue (code
internal-oracle-divergence) whose message mirrors the Python exception
("TypeError: unhashable type: 'list'", …). The marker is intentional
and the parity harness treats it as the documented divergence class.
Integers are unbounded like Python’s int: values
beyond i64 construct Yaml::BigInt (sign + decimal digits) instead of
overflowing, and duplicate-key equality / repr() / validator messages
follow CPython semantics for them exactly.
Structs§
- Artifact
Metadata - Artifact
Read - BigInt
- Arbitrary-precision integer (sign + decimal digits), mirroring Python’s
unbounded
intfor values outside i64 (PORT-CONTRACT 02 §4: the YAML 1.1 int constructor never overflows). - Frontmatter
Split - Issue
Enums§
- FileCap
- The per-file byte cap at the READ stage.
- Schema
Version ArtifactMetadata.schema_version: Python keeps the parsed int as-is, which can exceed i64 (an unsupported-but-integer version is stored with only an issue recorded).Displaymatches Pythonstr(int).- Yaml
Constants§
Functions§
- exceeds_
byte_ cap exceeds_byte_cap(text, cap): true whentextexceedscapUTF-8 bytes. (The oracle’s char-count shortcuts are a pure optimization; Rustlen()is already the UTF-8 byte length.)- file_
cap - The per-file byte cap, honoring
DECIDED_MAX_FILE_BYTES— Pythonint()semantics (Unicode digits, underscores, unbounded magnitude; unparseable or non-positive overrides fall back to the default). Shared parser withmarkdown::max_file_bytes_fromso the read and parse stages agree. - file_
cap_ from - is_
valid_ id ^[A-Z][A-Z0-9]{1,9}-[0-9A-HJKMNP-TV-Z]{12}$over the normalized id.- load_
frontmatter_ mapping - The envelope load (
_load_frontmatter_mapping): oversize gate, bounded YAML load, exception→issue mapping, non-mapping rejection. Public so the conformance vectors can compare the loaded value model directly. - non_
utf8_ issue - normalize_
id - Canonical (uppercase) form of an artifact ID (Python
strip().upper()). - oversize_
file_ issue - “file cap” wording — emitted by
parse_filefor an oversized file. - oversize_
parse_ issue - “parse cap” wording — emitted by
parsefor oversized text. Pinned as distinct from the file-cap wording; do not unify. - parse_
frontmatter - Parse and schema-validate raw frontmatter YAML.
- py_eq
- Python
==over the constructed values: numeric cross-class equality (1 == True == 1.0), and NaN keys compare equal to each other because PyYAML returns the one sharednan_valueobject (identity hit in the oracle’s duplicate-keyset). - read_
artifact_ text - The read stage of
parse_file: size check, capped read, strict-then-lossy UTF-8 decode (errors="replace", one U+FFFD per bogus byte — Rust’sfrom_utf8_lossyfollows the same WHATWG policy). - split_
frontmatter - Split a leading
---frontmatter block fromtext— LF-only line split (CRLF leaves\rinraw), Python-whitespace.strip()on delimiter lines (BOM and U+200B are NOT whitespace and defeat the delimiter). - unterminated_
issue - The unterminated-frontmatter issue
markdown.parseappends whensplit.raw is None and split.unterminated. - yaml_
load_ config - Full-document YAML load for the strict
.decided/config.yamlreaders (decided gate,decided.services.init._parse_config_yaml):Ok(root)on a clean parse,Err(problem text)otherwise. The oracle embeds PyYAML’s exact multi-line exception prose in itsinvalid YAML: <exc>message; that prose is not byte-reproducible here (stderr is out of parity scope), so the error text is the engine’s own parse problem.