PureYAML/Sources/Tagged
Mihaela Mihaljevic 2fcf54684e fix: correct emitter and tagged round-trip and validation bugs
Seven correctness fixes to the recently landed anchors/styles, canonical,
timestamp/binary, and full-node-key work, each reproduced and covered by a
regression test.

- Stream dump doubled the `---` marker under explicitDocumentStart or
  canonical: the single-document body now renders marker-free and the
  stream path owns marker emission, so a two-document stream reparses as
  two documents, not four.
- Tagged flow-mapping keys used block-context safety, so a key like `a,b`
  emitted bare and reparsed as several entries; flow keys now use the
  flow-aware plain-scalar check.
- Plain scalars ending in `:` reparse as an empty-valued mapping key, so
  both the model and tagged emit paths now fall back to quoting them.
- An alias mapping key pointing at a defined non-scalar anchor raised the
  misleading undefinedAlias; it now raises expectedScalarKey, and a truly
  undefined alias key still raises undefinedAlias.
- Tagged duplicate-key detection keyed on source spelling: it now keys on
  the resolved scalar value plus effective tag, so 0x1 and 1 collide while
  1 and "1" do not and custom-tagged keys stay distinct.
- Dumping a tree nested past the emitter limit overflowed the stack.

- Timestamp now accepts a leap-second value of 60, counted as 60 elapsed
  seconds in the epoch math.
- Tagged.Dumper honors sortKeys in its block and canonical paths for
  all-plain-string-key mappings, matching the model dumper.

Nesting-guard design: dump is public and non-throwing across 90+ call
sites, so making it throwing would be a breaking change. A tree nested
deeper than the parser's own maxNestingDepth cannot round-trip through
PureYAML (the parser rejects it), so no faithful emission exists. Each
dump entry point now measures depth iteratively (no recursion, so the
guard itself cannot overflow) and, past the limit, returns a documented,
reparseable marker document that resolves to null. Under the limit the
existing recursive renderers run byte-identically, so parsed trees and
every realistic hand-built tree are unaffected. This mirrors the parser's
enforceNestingLimit, which bounds depth before any recursive consumer.
2026-07-16 16:29:08 +02:00
..
Tagged.BuiltinValidation.swift fix: correct emitter and tagged round-trip and validation bugs 2026-07-16 16:29:08 +02:00
Tagged.CollectionStyle.swift feat(tagged): preserve anchors, aliases, and per-node styles end to end 2026-07-12 13:20:12 +02:00
Tagged.ConstructionContext.swift feat(tagged): add typed constructor policy 2026-06-05 16:24:11 +02:00
Tagged.ConstructionError.swift feat(tagged): add typed constructor policy 2026-06-05 16:24:11 +02:00
Tagged.Constructor.swift fix(ci): prepare 0.1.0 release 2026-06-05 21:20:20 +02:00
Tagged.Document.swift feat(tagged): add tag-preserving validation 2026-06-05 15:35:52 +02:00
Tagged.Dumper.Canonical.swift fix: correct emitter and tagged round-trip and validation bugs 2026-07-16 16:29:08 +02:00
Tagged.Dumper.Scalars.swift fix: correct emitter and tagged round-trip and validation bugs 2026-07-16 16:29:08 +02:00
Tagged.Dumper.swift fix: correct emitter and tagged round-trip and validation bugs 2026-07-16 16:29:08 +02:00
Tagged.EventComposer.swift fix: correct emitter and tagged round-trip and validation bugs 2026-07-16 16:29:08 +02:00
Tagged.Mapping.swift feat(tagged): preserve anchors, aliases, and per-node styles end to end 2026-07-12 13:20:12 +02:00
Tagged.MappingKeyIdentity.swift fix: correct emitter and tagged round-trip and validation bugs 2026-07-16 16:29:08 +02:00
Tagged.Node.ModelValue.swift feat(tagged): preserve anchors, aliases, and per-node styles end to end 2026-07-12 13:20:12 +02:00
Tagged.Node.swift feat(tagged): preserve anchors, aliases, and per-node styles end to end 2026-07-12 13:20:12 +02:00
Tagged.Node.Traversable.swift refactor(validation): rename framework to match the validation idiom 2026-07-12 18:10:00 +02:00
Tagged.NodeKind.swift feat(tagged): preserve anchors, aliases, and per-node styles end to end 2026-07-12 13:20:12 +02:00
Tagged.Pair.swift feat(tagged): carry mapping keys as full nodes 2026-07-16 15:42:56 +02:00
Tagged.Parser.swift feat(tagged): add tag-preserving validation 2026-06-05 15:35:52 +02:00
Tagged.Scalar.Builtins.swift feat(tagged): add typed timestamp and binary scalar accessors 2026-07-12 14:20:23 +02:00
Tagged.Scalar.swift feat(tagged): preserve anchors, aliases, and per-node styles end to end 2026-07-12 13:20:12 +02:00
Tagged.ScalarStyle.swift feat(tagged): preserve anchors, aliases, and per-node styles end to end 2026-07-12 13:20:12 +02:00
Tagged.Sequence.swift feat(tagged): preserve anchors, aliases, and per-node styles end to end 2026-07-12 13:20:12 +02:00
Tagged.Tag.swift feat(tagged): add tag-preserving validation 2026-06-05 15:35:52 +02:00
Tagged.Timestamp.swift fix: correct emitter and tagged round-trip and validation bugs 2026-07-16 16:29:08 +02:00
Tagged.Validator.swift refactor(validation): rename framework to match the validation idiom 2026-07-12 18:10:00 +02:00