--- type: Module title: "@effected/yaml" description: Pure-tier YAML 1.2 parsing, editing, formatting and linting as Effect schemas, with a vendored engine and full per-node comment fidelity. status: stable x-okfit-kind: package resource: ../../packages/yaml tags: [architecture, bundle] generated: by: "okfit/claude-code" at: 2026-11-29T01:09:21Z x-okfit-integrity: generated: body: 0639fd84cd81b5a5 --- # @effected/yaml `@effected/yaml` is YAML 1.2 as pure Effect schemas, and the largest package in the kit. It carries a full layered pipeline (lex → CST → compose → value), a "the class is the schema" AST, an edits-not-mutations model, a warnings-as-data recoverable-parse design, a vendored compliance harness, string→domain schema factories, full per-node comment fidelity, and a yamllint-class lint system over a public token stream. DX is class-based throughout: statics and instance methods on the schema classes, never floating functions. Three subsystems are large enough to carry their own contract document: - [The comment model](../interfaces/yaml-comment-model.md) — per-node capture, attribution, the one-string encoding and its escape, emission and the recorded divergences. - [Stringify presentation and compatibility options](../interfaces/yaml-stringify-options.md) — `indentSequences`, the explicit-key spill, `lineWidth`, `requoteScalars` and `quoteCompat`. - [The lint system](../interfaces/yaml-lint.md) — the rule engine, the built-in catalog, autofix and config inference. This package follows the kit's [format-package convention](../conventions/format-package-convention.md) and [sync-primitive policy](../conventions/sync-primitive-policy.md), and is held to the [fidelity obligation](../decisions/format-fidelity-obligation.md). ## Tier and dependencies Pure tier, per [the tier taxonomy](../glossary/library-tier.md) — no IO anywhere. Inputs are strings; outputs are values, documents, edits, streams or domain errors, and even the visitor streams are pure. `effect` is the only peer; no `@effect/platform*` or `node:` imports. The one runtime dependency is [`@effected/source`](source.md), a regular `workspace:^` dependency: it is pure, has no dependency of its own and carries no shared-instance contract, so the [peer discipline](../conventions/peer-dependency-discipline.md) does not ask for a peer. `@effected/config-file` depends on this package through a one-file codec adapter, never the reverse. The package ships `"sideEffects": false`. ## Positions Every `line`/`character` the package reports comes from `@effected/source`'s `LineIndex` with its default `"lsp"` line breaks: `\n`, `\r\n` and a bare `\r`, YAML 1.2's own `b-break` set. U+2028 and U+2029 are **not** line breaks (YAML 1.2 dropped them, which only 1.1 had). `character` counts UTF-16 code units, and an offset at the `\n` of a `\r\n` reads as the end of its line. There is no hand-rolled offset loop left in the package; a new producer reuses the index rather than growing one. The engine breaks lines at a bare `\r` too, so diagnostics, tokens, lint lines and the composed value all agree. Each engine entry point (the scanner, `parseCSTAll`, the composer state) maps a bare `\r` to `\n` before it scans (`src/internal/line-breaks.ts`): one code unit for one, so no offset moves, and `\r\n` is left alone because the engine already treats it as `\n`. Anything that hands source text back (token `text`, verbatim regions of formatted output) slices the caller's original string. Before this, the composer read a bare `\r` as content (`"- x\r- y"` was one scalar, `"a: 1\r..."` was `{ a: "1 ..." }`), so tokens and lint lines had to stay on `"lf"` or a fix aimed at a line end landed inside a scalar. `__test__/line-breaks.test.ts` pins that a document parses to the same value under LF, bare CR and CRLF breaks. A leading byte order mark (U+FEFF) is framing, not content (YAML 1.2 §5.2), so every parse steps over it with no option, unlike `@effected/markdown`, whose `MarkdownParseOptions.bom` defaults to `"keep"`. Positions still count it: node offsets and diagnostic offsets are relative to the text as passed, and a line-0 diagnostic's `character` is one higher than its markless twin's. The lexer gives the mark no column, so indentation on line 0 is unaffected. `__test__/Yaml.test.ts` pins the node offsets and diagnostic positions; a `bom` parse option would only add a `"keep"` reading the spec forbids. - `YamlDiagnostic.fromRaw(raw, text | SourceIndex)` (the structural interface, so an index from another installed copy of `@effected/source` is accepted) derives its position with `positionAt`. The parse entry points materialize all of one parse's diagnostics against a single index, built lazily (`lazyLineIndex` in `src/YamlDiagnostic.ts`), so a parse with no diagnostics never builds one. - `YamlToken` positions are `positionAt(token.offset)` over one index per tokenize (`tokensOf` in `src/YamlToken.ts`). - `LintContext.lines` are the index's lines (`lineText`, `lineStart`), the terminator stripped, the empty segment after a trailing line break dropped, none for `""`. The lint context builds ONE index for its lines, its tokens and its document's diagnostics, so a rule may index `ctx.lines` by any token's or diagnostic's `line`. `eof-newline` and `document-end` treat a trailing bare `\r` as a final line break (`endsWithLineBreak` in `src/internal/rules/util.ts`): a bare-CR document lints as its LF twin. - `YamlDiagnostic` satisfies `SourceDiagnostic` and `YamlToken` satisfies `SourceLocation`; both are pinned by type-level tests. - The entry point re-exports `@effected/source`'s surface (`LineIndex`, `LineBreaks`, `LineIndexOptions` and the position shapes), so a consumer computing positions over the same text it parsed ([#1126](https://github.com/spencerbeggs/effected/issues/1126)) writes `LineIndex.make(text)` with no second dependency and gets exactly the package's answers. `YamlDocument` keeps no source text, so it carries no `lineIndex` of its own (markdown's `MarkdownDocument` does). Adoption changed output in three classes and nowhere else, measured by a differential of the pre-adoption build against the new one over every string of up to five characters from `{a, \n, \r, U+2028, U+2029, U+1F600}` and from a YAML-shaped alphabet, at every offset: a diagnostic at the `\n` of a `\r\n` (was `character: -1` on the next line); a diagnostic after U+2028 or U+2029 (was one line further down). The engine's bare-`\r` fix then changed two more: the parsed value of a document holding a bare `\r` (now its LF twin's), and the tokens, lint lines and lint findings of such a document, which were all on line 0 and now break at each `\r`. A document with no bare `\r` parses, tokenizes and lints exactly as before. The value-preservation property in `__test__/lint-fix-values.test.ts` pins the fix half. Lint fixes never change the parsed value; where one would, the rule declines and reports the finding without a fix. The rulings and the property that pins them are in [the lint interface](../interfaces/yaml-lint.md#autofix-surgical-and-comment-safe). ## Module layout Module-per-concept, with the engine behind `internal/`. `src/index.ts` re-exports; nothing else is public. - `Yaml.ts` — the value-level facade: a namespace object of statics over the parser, stringifier and schema layers, not a schema class. Owns the parse and stringify option and error vocabulary. - `YamlDiagnostic.ts` — the structured diagnostic concept carrying errors *and* warnings-as-data, the staged code unions and the single fatal-code predicate. - `YamlNode.ts` — the mutually-recursive AST, co-located in one file. The co-location is what breaks the AST import cycle. - `YamlDocument.ts` — `YamlDocument` and `YamlDirective`: the parsed AST plus recovered `errors`/`warnings` arrays. - `YamlEdit.ts` — the edit class and the shared `YamlRange` / `YamlPath` / `YamlSegment` vocabulary bound by the jsonc/yaml parity convention. - `YamlFormat.ts` — non-mutating `format` and `modify` edits, and `YamlFormattingOptions`. - `YamlVisitor.ts` — SAX-style AST events as a `Stream`, including comment events discriminated by `placement`. - `YamlToken.ts` — the public positioned token stream: `YamlTokenKind`, `YamlToken`, and the `YamlTokens.tokenize` / `.stream` pair (`src/YamlToken.ts:65,119`). - `YamlLintRule.ts` — the lint model: `LintContext`, `LintLine`, `YamlRule`, `YamlLintSeverity`, `YamlLintDiagnostic`. - `YamlLint.ts` — the lint config and facade: `YamlLintRuleSetting`, `YamlLintConfig` and `YamlLint.run` / `.fix` / `.builtins`. - `internal/` — the engine: lexer, CST parser and visitor, the `composer/` directory split along its seams (including `composer/comments.ts`), the stringifier, the folder, the differ, equality, requoting, the raw-document materializer and `rules/` — one file per built-in lint rule. The engine is **vendored** — ported with attribution from the `yaml` package rather than taken as a runtime dependency. House policy for pure-tier format packages: a pure package owns its parser. Do not add `yaml` as a dependency. ### Cycle firewall `noImportCycles` is error-level, and two rules keep it green. The engine returns raw records (`{ code, message, offset, length }`) and never imports a public module; the facade materializes `YamlDiagnostic` — computing `line`/`character` from `offset` against the source — and constructs the typed errors. `YamlDiagnostic` and its code unions live in their own module because that is where diagnostics are materialized. Mutual recursion threads through a dispatch record on state, never a direct import. The block composer needs the flow composer, so `composer/state.ts` declares a `FlowComposers` record and `composer/document.ts` injects the implementations. No generic node dispatcher is needed. The lint layer obeys the same firewall, and it is what split the lint model out of the facade: built-in rules construct `YamlLintDiagnostic` while the facade imports the rule catalog, so one module would close `YamlLint → rules → YamlLint`. The model lives in `YamlLintRule.ts`, which imports nothing back. ### The token layer is public; the CST stays internal The public surface is the value and document layers, the AST, the edit/format/modify concepts, the AST-level visitor, the schema factories, the lexical token stream and the lint system. The CST parser, pull-based scanner and CST visitor remain internal — there is no public CST type. The token layer was held private until a tooling consumer materialized, and the lint system was that consumer, so `YamlToken.ts` promotes the internal lexer token behind a `Result` primitive and a derived `Stream` (see [the lint interface](../interfaces/yaml-lint.md#the-public-positioned-token-stream)). The promotion is deliberately additive: public `line`/`character` are derived from `offset` against a line index and `text` is the raw source slice, because the internal `column` carries a construct's indent on synthetic markers and the internal `value` is the processed form of a quoted scalar. Deriving left the lexer and CST parser untouched, so nothing behind the new surface could regress. A `Stream` is deferred on the same terms — the CST layer gets promoted only when something needs it. ## Effect-wrapping policy Pure synchronous where nothing can fail; `Effect` only where the error channel is real; `Stream` for the visitor. The split makes fallibility legible at the call site — an `Effect` return type means "this can produce a domain error." Pure and total: node navigation, value extraction, edit application, the formatting-edit computation, comment stripping and semantic equality. An `Effect<_, never>` wrapper over any of these is ceremony. Fallible, and therefore `Effect`: parsing, stringifying, modification and the schema decode path. Every one of these also has a synchronous `Result` twin for config-time callers that cannot enter a runtime — a `vitest.config.ts`, say — per the [sync-primitive policy](../conventions/sync-primitive-policy.md). `parseResult` is the package's single parse path, with `Yaml.parse` defined in terms of it behind the named span, so the two cannot diverge. The `Result` forms drive the same synchronous engine and share the same defect-materialization helpers, so hardening is identical across both: a fatal diagnostic, duplicate key, alias bomb, circular reference, depth overflow or unrepresentable value returns a failed `Result` and never throws. The visitor is infallible by design: every composer diagnostic, including stream-level directive errors and the alias-count guard, surfaces as an error event in the union rather than failing the stream. ## AST and value extraction Each node is a `Schema.TaggedClass`, recursion handled with `Schema.suspend` and no parent pointers — those would break structural equality, serialization and Schema encode/decode. Absence stays `Option`, never a `NotFound` error. `pathOf` is reference-identity based, the inverse of `find` and composable with `findAtOffset`. A node's span (`offset`/`length`) is its value alone and never covers its properties: `!!float 0.10` and `&a 0.10` both span `0.10`. The properties have their own spans, `tagRange` (the tag as written, a verbatim `!<...>` whole) and `anchorRange` (`&name`), on `YamlScalar`, `YamlMap` and `YamlSeq`, present only on nodes read from source. An empty scalar that carries properties (`a: !!null`, `- &x`) is zero-length immediately after its last property token, never at the next line's content (#1439); every such scalar is built by `makeEmptyScalar` (`src/internal/composer/scalars.ts`), so a new composer site must use it. Its value resolves through the tag (`!!str` is `""`), at the document root too. `YamlScalar.sourceText(text)` is the span sliced from the text the document was parsed from: quotes and a block scalar's header included, properties never (#1440). Two value-extraction rules are load-bearing. Single-document parse resolves aliases against the most recently seen anchor at the point of use, while multi-document parse builds an independent anchor map per document. And `__proto__` mapping keys become own data properties via `Object.defineProperty`, closing the prototype-pollution footgun a naive `obj["__proto__"] = value` assignment would open. `YamlDocument.schema` targets `Schema.instanceOf(YamlDocument)` as its `decodeTo` destination, because `Schema.decodeTo(Class)` expects the transformation to produce the class's *encoded* struct rather than instances. `YamlEdit.applyAll` applies in reverse-offset order — byte-minimal, comment- and whitespace-preserving, the library's real differentiator — and rejects overlapping edits as a defect. It is a programmer-error guard on hand-constructed arrays; `YamlFormat` never emits overlapping edits. All four format siblings across the kit share this posture. ## Schema transformation strategy Mirrors `@effected/jsonc`'s arrangement: a pre-bound `YamlFromString` singleton on default options, a `fromString(options?)` factory, `allFromString(options?)` for the multi-document case (no jsonc analog), `schema(Target, options?)` composing with a target schema and `bind(Target)` returning `{ schema, decode, encode }`. `bind` is single-document only. A bound codec's `decode: (text) => T` shape has no natural array reading, and inventing a `bindAll` for a surface with no jsonc or toml analog would spend parity for no consumer. Like its neighbors it is thin sugar introducing no new error taxonomy, and like all the schema-producing functions its result should be bound to a `const` on a hot path — each call returns a fresh instance and v4 derivation caches key by reference. `fromString` takes parse options only; the encode direction uses default stringify options. **Boundary discipline.** A `Schema` cannot fail with a domain error, so the `decodeTo` transformation fails with a `SchemaError` whose issue message is the aggregate parse message. The *domain* `YamlParseError` is constructed directly by the `parse`/`parseAll` path, which drives the composer and bypasses `Schema` — that is why `SchemaError` never escapes as the documented contract of those methods. Consumers wanting the domain error out of a schema pipeline normalize with `Effect.catchTag("SchemaError", ...)`. ## Diagnostics and the error set Errors are `Schema.TaggedError` with structured payloads and a `message` getter derived from the fields — never preformatted strings, never collapsed to a `reason: string`. `YamlDiagnostic` is itself a `Schema.Class`, so error payloads are serializable for free. See `src/Yaml.ts` and `src/YamlFormat.ts` for the current set. `YamlDiagnostic` is the single source of truth for fatality: it owns the staged code unions and one fatal-code predicate, so fatality is a property of the code, declared once rather than inlined at each parse entry point. The lint layer's `YamlLintDiagnostic` is deliberately a separate class rather than a reuse: it carries a rule id, a severity and an optional fix, none of which belong on an engine error-code type. The `parse-validity` rule bridges the two, mapping engine diagnostics into lint ones and keeping the engine's own grading. There is deliberately no format error: `format` is pure and returns no edits on input whose parse has fatal errors, so it never corrupts a malformed document and never needs a fallible path. ## Input hardening Malformed and adversarial input must fail typed, never as a defect. Four surfaces are guarded, all regression-tested: 1. **Composer depth cap** — `MAX_NESTING_DEPTH = 256` (`internal/composer/state.ts:201`), a fatal nesting diagnostic. The uncapped engine overflowed the stack around 900 levels. 2. **CST parser depth cap** — `MAX_CST_DEPTH = 256 + 8` (`internal/cst-parser.ts:30`), deliberately set a few levels above the composer's cap so the composer's guard fires first and the user gets a positioned diagnostic rather than the CST parser's flat error node. Never lower it to or below the composer cap. 3. **Stringify recursion** on both the value path and the node path, capped at the shared depth constant; the internal throw is materialized into a typed stringify error at the facade. Both paths also keep an ancestor set, so a cycle — in a plain value or in a hand-built AST — is reported as `CircularReference` on the first re-entry rather than left for the depth cap to catch as `NestingDepthExceeded`. Both paths also refuse a value with no YAML rendering — a function or symbol, or a hand-built scalar node holding anything but `null`, a boolean, a number, a bigint or a string — as `UnrepresentableValue`. The alternative, the `String(value)` fallback both paths once had, wrote a function's source text or `Symbol(s)` into the document as a quoted string that only surfaced on the next read. 4. **Alias-expansion budget** — a "billion laughs" bomb can stay under `maxAliasCount` and still exhaust the heap during materialization, so materialized nodes are bounded by a budget derived from `maxAliasCount` (`aliasExpansionLimit`, `src/YamlNode.ts:556`), with the internal throw materialized into a typed parse error. Raw C0 control characters other than tab, LF and CR are fatal anywhere in a document's span, scanned once per document per YAML 1.2 §5.1 c-printable. The lesson from the alias budget generalizes: depth is not the only DoS vector. When an engine expands references during materialization, budget the *materialization*, not just the input's static depth. ## jsonc/yaml parity reconciliation The jsonc/yaml parity convention requires `YamlEdit`, `YamlRange`, `YamlPath`, `YamlSegment` and the diagnostic core to be structurally identical to their `Jsonc*` counterparts. `YamlDiagnostic` adopts the shared five-field core (code, offset, length, line, character), with `message` and `severity` additive on top; the core is now named by `@effected/source`'s `SourceLocation` / `SourceDiagnostic`. The line-break rules are no longer identical: jsonc counts U+2028 and U+2029, yaml does not (see Positions). All of that holds exactly. The point is codec-generic consumer code — one function over "a document codec's Edit/Range/Path" that works against both packages — and it is the pre-work for a possible future extraction, deferred until a consumer needs it. `YamlFormattingOptions` is the one exception. All three options classes (`YamlStringifyOptions`, `YamlFormattingOptions` and the lint layer's per-rule option schemas) use bare `optionalKey` fields with implementation-level `?? default` rather than v4 constructor or decoding-default wrappers, which keeps the class-factory annotations tractable. `YamlFormattingOptions` derives its shared fields at runtime by spreading `YamlStringifyOptions.fields` (v4 classes expose `.fields`), adding its own on top. Because those mechanics differ from jsonc's hand-derived shape, it is deliberately *not* structurally identical to `JsoncFormattingOptions` even though field names and semantics line up — the recorded parity exception. The spread earns its keep: `indentSequences` was added to the stringify options alone and appeared on the formatting options derived, not hand-duplicated — exactly the drift it exists to prevent. See [the stringify options interface](../interfaces/yaml-stringify-options.md) for what the individual options mean. ## Multi-document support A yaml-specific surface with no jsonc analog. YAML's `---`/`...` document-stream model gets first-class support at both the value and document layers. This is genuinely yaml's own concern — anchors, aliases, pairs-versus-properties, multi-document — and no shared tree abstraction is extracted across jsonc and yaml: the trees differ enough that a shared abstraction would be premature and leaky. ## Equal and Hash semantics Structural `Schema.TaggedClass` equality is load-bearing for the visitor and AST tests and works as designed; no node customizes `[Equal.symbol]`, so the `[Hash.symbol]` obligation never arises. `Yaml.equals`/`equalsValue` implement the *semantic* relation — comment- and format-ignoring, alias-resolving — which is different, so they stay explicit statics. Any recorded parse error, or a duplicate-key warning, on either side yields `false`: malformed input is never equal to anything, including itself. Should a node ever customize `[Equal.symbol]`, it must override `[Hash.symbol]` too, since `Equal.equals` fast-paths on hash mismatch. ## Internal construction The house rule is `X.make(...)`, never `new X(...)`. The engine is the recorded exception: it retains `new` for AST construction on the hot recursive composition path, where nodes are trusted (built from validated CST) and per-node `make` validation is exactly the hot-path cost the observability posture already refuses to pay. All public surface, tests and doc examples use `make`. The twins cover the document and format layers too: `YamlDocument.parseResult`, `parseAllResult` and the instance `stringifyResult`, and `YamlFormat.modifyResult` / `modifyToStringResult`. Every stringify path — value, document and `modify` — maps the stringifier's internal throws through one shared `stringifyDefectToError` triage. `modify` lowers the caller's value counting depth from the target's own path depth, because the stringifier counts from the document root; a value that fits at `[]` can fail `NestingDepthExceeded` a few keys down, and it fails typed, never as a defect. A scalar edit splices only the one region, even when `indent` or `indentSequences` is set, so the scalar's comment and quote style survive; a caller who wants the whole document re-laid out calls `YamlFormat.format`. `modify` and `Yaml.stringify` agree on what every JavaScript value means, and a test pins the agreement byte for byte: a `bigint` renders bare on both paths (the node stringifier renders a bigint scalar like any other integer, preferring its `raw` source form, so an integer past `MAX_SAFE_INTEGER` round-trips through `YamlDocument#stringify` unquoted and a hex literal keeps its spelling), and a function or symbol fails `UnrepresentableValue` on both — `modify` through its own lowering guard, `stringify` through the engine — matching jsonc's typed refusal of the same values. Neither path ever writes `String(fn)` into a document. `new` on a v4 tagged class still validates structurally — explicit `undefined` for an `optionalKey` field throws even with `{ disableChecks: true }`, which only skips refinement checks. The engine's `new` sites therefore use conditional spreads for every optional field. ## Observability Named `Effect.fn` spans at public *fallible* boundaries only — parse, stringify and modify at the facade, document and format layers. Pure synchronous operations are not instrumented, there is no per-node instrumentation inside the composer (a hot recursive path), and internal helpers get no spans. The visitor carries no span: stream construction is lazy and pure, with no clean `Effect.fn` boundary. The library is telemetry-agnostic. ## No services A pure-tier library needs none — class statics suffice, and a codec adapter is the consumer's layer. `src/` defines no `Context` and no `Layer`. `@effected/config-file`'s `ConfigCodec` interface is exactly the `Yaml` facade shape, so its `YamlCodec` adapter is one file; the codec lives there, not here, because the dependency arrow points *at* yaml, never from it. ## Comment model Per-node comments round-trip: every scalar, collection and alias carries `commentBefore`, `comment` and `spaceBefore`; `YamlPair` carries none; attribution runs forward; and a whole run of comment lines lives in one string. See [the comment-model interface](../interfaces/yaml-comment-model.md) before touching capture in `internal/composer/comments.ts` or any of the stringifier's comment branches, since capture and emission are paired code and a schema change routinely leaves one half behind. ## Fixture corpus and compliance harness The vendored yaml-test-suite is committed as plain files (nested `.git` stripped) under `__test__/fixtures/yaml-test-suite/`, pinned to a recorded upstream ref — deterministic, offline and Turbo-cacheable, with no fetch-on-test dependency. The harness is the regression safety net: an e2e suite covering parse success/failure, JSON equivalence, canonical-output byte equality and round-trip. It must stay at 100% with empty skip maps, and it is a ratchet in both directions — a passing count that rises means a fixture's assertion changed, which is as much a failure as one that falls. The same corpus carries a second e2e suite: token position fidelity. Every token of every fixture must tile the source — ordered, non-overlapping, `text.slice(offset, offset + length)` equal to the token's `text`, and every gap between consecutive tokens horizontal-whitespace-only. It is the invariant the whole lint layer rests on, since every diagnostic position and every autofix span is a token position, and tiling (rather than slice-equality alone) is what proves the stream *covers* the source instead of merely quoting correctly where it speaks. A floor assertion on the token count keeps a silently-empty walk from passing as green. ## Testing `@effect/vitest` with `it.effect` as the default mode, split per concept under `__test__/` with the two compliance suites in `__test__/e2e/` and the lint rule suites under `__test__/rules/`. Construct via `X.make(...)`. Beyond the behavior-contract suites, three families are structural: property tests via `it.effect.prop` with `Schema.toArbitrary` on the AST classes (round-trip and format idempotence — pattern-field checks use lookahead-free regexes so derivation works), diagnostic-position tests pinning `line`/`character` computation and the fatal-code predicate, plus structure-preserving-error tests asserting that failures carry diagnostic arrays rather than reason strings. The lint rules add a fourth: a shared fixture harness (`__test__/rules/harness.ts`) taking each fixture as input → expected diagnostics → expected fixed output, so the built-in rules cannot drift into as many dialects of "tested". Two guards ride on it. Every fixture input must parse cleanly unless it declares `expectsParseErrors`, checked bidirectionally — a fixture with an accidental syntax error would otherwise test a rule against a document the composer never built, and an unchecked opt-out would decay into a suppression pasted everywhere. And every rule is proven falsifiable by two automated mutants: a dead-rule mutant that reports nothing, and an unfixing mutant that reports but declines to fix. The second catches what the first cannot — correct diagnostics with an inert `fix`. ## Lint system `@effected/yaml` ships a yamllint-class lint system: a rule engine whose first rule is parse-validity, a catalog of built-in rules under `internal/rules/`, a rule-aware `YamlLintConfig` with `default` / `relaxed` presets, surgical autofix that routes only through `YamlEdit.applyAll`, and config inference — `YamlLint.observe` / `.resolve*` / `.infer*` derive the config a document's style already follows. Its full contract is [the lint interface](../interfaces/yaml-lint.md). Three things matter at this level: - It stays inside the pure tier. No file discovery, no config-file loading, no CLI, no autofix-to-disk — strings in, diagnostics or a fixed string out. The runner is a consumer's tier. - It adds no parser. Rules read the one materialized token array, the composed document and the source lines; the engine tokenizes and composes once per run. - Autofix is not `format`. Fixes are surgical `YamlEdit`s, never a reflow — a structural test asserts `YamlLint.ts` does not import `YamlFormat`. ## Build All class factories are written inline with no exported `*_base` const; the synthesized `_base` heritage symbols — including the co-recursive AST bases and the visitor-event union — are suppressed narrowly in the bundler's default config and land in the `issues.json` `suppressed` bucket, keeping it zero-warning. Never widen the suppression. The `Schema.suspend` callbacks' own return-type annotations survive where recursion requires them, and genuinely reusable public schemas stay `@public` on their own merit.