The roadmap diagrams referenced issue numbers (#1, #8-#13, #43-#55) that no
longer exist on Codeberg: the GitHub to Codeberg migration reset this repo's
issue tracker, and those numbers were never re-created. scripts/check-roadmap.sh
existed only to keep that roadmap in sync with GitHub epic-labeled issues via
gh, which can't resolve a Codeberg/Forgejo repo anyway, so the gate had been a
silent no-op since the move. Removed the roadmap section, the gate script, its
two call sites, and its now-pointless rule doc, and pointed the remaining
work at the real, live issues (#4, #5, #6, #7, tracked under epic #8). Also
fixed two leftover Mihaela/PureYAML references in docs/RELEASE.md.
The ported engine wins every conflict: main's post-fork patches to the
hand-rolled Scanner and TokenEventParser land on deleted files and are
dropped; their behaviors are carried by the port and guarded by the
whole-suite conformance gate (402/402 passing).
Merge adaptations, all gates green (style, namespacing, forbidden
patterns, changelog, roadmap, swiftformat, swiftlint strict, build,
full test suite, whole-suite conformance sweep):
- PureYAMLJSON representability rules move onto the Check algebra,
replacing the retired legacy Rule type.
- The permissive tag-handle pre-pass is removed; the port rejects an
undefined handle at parse time (suite case QLJ7) and the validation
report carries it as a parse diagnostic.
- EventStreamComposer's nested types split one-per-file per the
namespacing gate.
- Tests pinned to old-engine behavior were re-verified against the
reference and updated: libyaml rejects an explicit-key continuation
ending at a value colon, and suite case QB6E requires rejecting a
quoted continuation at column 0.
- CHANGELOG unreleased entries from both lines are preserved in two
groups with a provenance note.
Closes#1, closes#3
The located-parse port added four public Model types (LocatedValue, LocatedPair,
SourceRange, SourcePosition) that the validation-coverage gate flagged as
unclassified, blocking the push. They are positional projections and pure
position data with no validation invariant of their own: LocatedValue and
LocatedPair wrap an already-validated Model.Value, and SourceRange and
SourcePosition are data-transfer. Classify all four as excluded with reasons.
The pre-push gate ran the self-hosted claw relay (ssh + Lima Debian) as a
hard stage, so any time the host was unreachable the whole hook failed and
the only way past it was a blanket --no-verify, which also discarded the
local macOS Swift gate. The authoritative Linux gate is the GitHub-hosted
workflow (ubuntu-latest + swift:6.2); the relay is a convenience fallback.
check-linux.sh now separates connectivity and provisioning (Stage A, exit 77
to signal skip when the relay is unavailable) from the relayed build and test
(Stage B, exit 1 on a genuine Linux failure). check-all.sh treats 77 as a
non-fatal skip and still aborts on any other non-zero, so a runner outage no
longer blocks a green push and never masks a real failure.
The coverage manifest claimed Tagged.Mapping and Tagged.Node validate key
uniqueness, but the tagged validator's only default check was the built-in
tag check: the claim was false. Tagged.Mapping keeps every parsed pair, so a
duplicate key survives into the tree and is as invalid as in the plain model.
Add Tagged.BuiltinCheck.mappingKeysAreUnique, a Check<Mapping, Node> on the
one validation framework, to the tagged validator's defaults; the traversal
now offers each mapping to the checks. It reports each duplicate at its key
path, with failing, near-miss, and nested fixtures, and the two default
tagged checks are pinned by description.
Correct the Model.Value coverage reason: merges and aliases resolve at parse
time, so they are not a validation-phase invariant. Every validated manifest
entry now names an invariant a check actually enforces. 403 tests pass.
A Rule was exactly a Check<Model.Value, Model.Value>: it fired on every
node, switched on the value itself, and carried the root. It was therefore a
second copy of the one check machinery, the duplication the validation idiom
exists to prevent (principle 10), now also resolved for the tagged layer.
Remove Rule and its Context. The model validator holds only checks; its
default is the type-directed BuiltinCheck.mappingKeysAreUnique; validating
takes a Check. Custom whole-tree rules become Check<Model.Value, Model.Value>
with the former context.root now context.document.
Behaviour is byte-identical: the mapping-key builtin reports the same issues
at the same paths in the same DFS order, so the public validate/collect/blank
surface is unchanged. All 399 tests pass; the coverage gate reconciles to 60
public types.
The tagged-node validator carried its own copy of the validation machinery:
a Tagged.Rule cloning Validation's check type and a Tagged.Context cloning
its context, differing only in subject type. That is the per-layer
duplication the validation idiom exists to prevent (principle 10).
Generalise the type-directed framework over both the subject and the
document: SubjectContext, Check, and AnyCheck now take a Document type
parameter for the validated tree's root. The model layer validates with a
Model.Value document, the tagged layer with a Tagged.Node document, each
truthful rather than forcing one root type to stand in for the other.
The tagged layer keeps only what is genuinely its own: the Node document
type, its built-in check (now Tagged.BuiltinCheck, a Check<Node, Node>), and
its traversal. Tagged.Rule and the tagged Context are removed. The validator
surface is unchanged but validating now takes a Check<Node, Node>.
All 399 tests pass; the coverage gate reconciles to 62 public types.
Introduce the core of the validation-rules idiom: a Check<Subject> with a
positive description, a when predicate, and a Bool or multi-error check
that fires only on values of its Subject type wherever they occur. AnyCheck
erases the subject and dispatches by runtime type, guarding an optional or
a wrong type from matching. The validator gains a checks list, a
validating(_:) overload, and a traversal that offers each node the values
it may specialise on. BuiltinCheck.mappingKeysAreUnique is the
type-directed counterpart of the legacy rule.
The machinery has its own negative tests (wrong type, optional, false
predicate yield nothing; same type twice yields two errors) and the builtin
ships a failing and a near-miss test. The coverage gate catches the five
new public types, which are classified as validation machinery. The default
validator is unchanged, so this is additive; retiring the legacy Rule,
moving the default onto the check, the combinator algebra, the error
rendering, and de-duplicating the Tagged validator are the remaining steps.
Adopt the validation-rules discipline that every public type is either
validated or excluded, enforced mechanically rather than by review. A new
gate enumerates the public surface from the compiler symbol graph and
fails the build, naming the type, if any public type is missing from the
coverage manifest or any manifest entry is no longer public.
scripts/validation-coverage.tsv classifies all 58 public types: the value
models with the mapping-key-uniqueness runtime invariant are validated,
and the namespaces, closed sum types, data-transfer values, error types,
and engine machinery are excluded with a one-line reason each. The gate
runs in check-all.sh and CI; a planted unclassified type was confirmed to
fail it.
This is the coverage-first phase of moving the validation layer to the
type-directed Validation idiom; the framework backing the validated
entries, the de-duplication of the Tagged validator machinery, and the
exhaustive tests follow.
Adds an opt-in harness that runs PureYAML over the canonical YAML 1.2
corpus (github.com/yaml/yaml-test-suite) and reports a parse-level pass
rate: a should-parse case must parse, a should-error case must be
rejected. The data is fetched into a gitignored location by
scripts/fetch-yaml-test-suite.sh, never vendored, and the run is gated
behind PUREYAML_RUN_YAML_TEST_SUITE=1 so the default suite is unaffected.
This turns 'best YAML library' from an assertion into a tracked number.
Baseline: 211/333 (63.4%) parse-level: 177/255 valid documents parse,
34/78 invalid documents are rejected. So 78 valid docs are not yet parsed
and 44 invalid docs are wrongly accepted. The stricter value-level check
against each case's in.json is the next step.
Split the six files that declared multiple sibling types under one
namespace extension so each file declares exactly one top-level type:
the Tagged node component types (Node, NodeKind, Scalar, Sequence,
Mapping, Pair), the validation report types (Report, Source,
SourceReport, BatchReport), DiagnosticKind, TokenKind, ScannerFlowContext
kind, and the event-stream composer helpers. Public type names are
unchanged; the shared report-rendering helpers move from file-private to
internal so the split report types still reach them.
Make check-namespacing.sh namespace-aware: the previous column-anchored
scan was blind to types declared inside indented extension blocks, so it
passed while the rule was violated. It now counts direct members of a
PureYAML namespace extension and ignores nested types and private helpers.
Mirror the shared Swift rules canon (rules-swift, commit 4ebb892) into
docs/rules-swift/ as a read-only reference alongside the repo's tailored
docs/rules/. PROVENANCE.md records the source, commit, and what was
included or excluded; the upstream repo's own VCS, CI, and lint tooling
is omitted as machinery rather than rule content.
Exclude the vendored tree from the style gate (scripts/check-style.sh)
and the pre-commit hook: the canon's enforcement docs quote the
forbidden attribution phrases to define them, the same reason the
repo's own enforcement files are already excluded.
PureYAMLJSON is a separate library product layered on the core engine. JSON is
a subset of YAML 1.2, so the existing parser already reads both into one value
tree; this product adds the missing half and the value-level policy:
- JSON.Writer: a pure-Swift RFC-8259 serializer (no Foundation; WASI-clean),
pretty or compact, rejecting non-string keys and non-finite numbers.
- JSON representability rules expressed in PureYAML's own Validation framework:
mappingKeysAreStrings and numbersAreFinite join the core mappingKeysAreUnique.
- JSON.Validator: the representability rule set plus issues(for:)/isRepresentable.
- JSON.Convert: standalone convert(_:to:) with the round-trip law (parse ->
validate representability -> emit -> re-parse must equal the source). To JSON
rejects complex keys and non-finite numbers; to YAML rejects duplicate keys,
which are legal in JSON but not in YAML.
19 tests cover the writer, the rules, and both conversion directions including
the dual-rejection edges. Carved out of the catch-all Sources/Tests paths via
exclude so the core PureYAML target is unchanged.
The gap-only manifest stopped guarding a case once it was fixed, so later
work silently regressed previously-fixed cases (caught only by an external
full-suite run, not the gated sweep or full corpus). Replace it with a full
manifest of all 402 official cases (Tests/Fixtures/yaml-test-suite-manifest.yaml),
each carrying its conformant expectation and a passing/gap status, with every
case's files vendored. The gated sweep now asserts every passing case still
passes (the regression guard) and every gap still reproduces, so any regression
fails the build.
The honest gate-enforced count is 329/402 passing (the earlier 348 came from a
more lenient one-time oracle).
Repairs three regressions the new gate revealed: the bucket-6 tab rule
over-rejected tabs in block-scalar content and as separation before a scalar
value (root cause: the batch scanner and the incremental TokenCursor had
divergent line-start loops; unified onto a single scanStep, fixing 96NN/00,
96NN/01, R4YG, Y79Y/001, DK95/00, DK95/03, DK95/07, 6CA3, Q5MG, J3BT); an anchor
on a prior line before an alias key wrongly rejected 26DV; and a tag-only flow
key mis-parsed WZ62. Genuine tab-indentation errors (4EJS, Y79Y/000) still reject.
Vendor the 206 official YAML test suite cases (yaml/yaml-test-suite, data branch, commit 6ad3d2c) that PureYAML does not yet handle correctly, under Tests/Fixtures/yaml-test-suite/, with a manifest recording each gap's category and current behavior.
Add an opt-in conformance sweep (scripts/check-yaml-test-suite.sh, gated behind PUREYAML_RUN_YAML_TEST_SUITE=1) that reproduces every recorded gap, so a future fix must update the manifest. Document the measured result (196/402 passing) and the ordered plan for closing the gaps in docs/YAML_TEST_SUITE_CONFORMANCE.md.
No parser behavior changed.
Add structured validation diagnostics, JSON and Yams comparison gates, and lazy token/event parsing so production behavior is measured without retaining full intermediate parser arrays.