softschema 0.6.2
softschema 0.6.2 fixes a validation gap that could pass a build while checking nothing:
the CLI bound every artifact to the frontmatter-md profile, so a conforming pure-yaml
artifact — including the spec's own example — could not be validated at all. Upgrading is
safe and requires no changes; the inspect JSON output gains one key.
What's Changed
Fixes
-
validateandinspectresolve the artifact profile instead of assuming
frontmatter-md(#38). Both CLIs read every artifact with the frontmatter reader and
built aContractwith noprofile, so the pure-yaml branch ofvalidate_artifactwas
unreachable from the command line and any pure-YAML file failed withno_frontmatter.
The library was correct throughout; only the binding was wrong.The gap was silent rather than loud, which is what made it worth a patch: a project
could adopt pure-YAML datasets, mark themstatus: enforced, wiresoftschema validate
into CI, and get a passing build that validated nothing — the exact failurestatus
exists to prevent. Anenforcedpure-yaml artifact that violates its bound schema now
fails with exit 1.Profile resolution is
--profile> a*.yaml/*.ymlfile name > a fenceless document
whose root mapping carries asoftschema:block >frontmatter-md. The file name is
checked before the frontmatter fence, because a YAML document may open with the---
document-start marker that the frontmatter reader would otherwise scan as the start of a
fence. Requiring the metadata block for the content case is what separates a pure-yaml
artifact from prose that happens to parse as YAML, so a Markdown document without
frontmatter reportsno_frontmatterexactly as before. -
Envelope inference no longer applies to pure-yaml artifacts. The spec exempts the
profile from single-key inference and multi-key ambiguity rejection, because a pure-yaml
artifact's whole root minus the metadata block is the payload. Reaching that branch
through the CLI would otherwise have rejected a two-key pure-yaml document as ambiguous.
New features
-
--profile {frontmatter-md,pure-yaml}onvalidateandinspectin both
implementations: the explicit escape hatch for an artifact whose name and content do not
settle its shape. -
inspectreports the resolvedprofile, and reads a pure-yaml artifact's root
metadata block rather than reportingmetadata: nullfor it.has_frontmatterstays
literal — a pure-yaml artifact has none — andprofileis what explains the populated
metadata beside it. This adds one key to theinspectJSON output. -
clearValidatorCacheis exported from the TypeScript package, matching Python's
clear_validator_cache.
Performance
-
TypeScript compiled schemas are memoized, closing the last gap with the Python cache
shipped in 0.5.0.validateStructuralconstructed a fresh Ajv instance and recompiled
the schema on every call, so a suite validating many artifacts against one schema paid
full compilation each time; on a repeated validation of the movie example the per-call
cost drops from roughly 17ms to 0.03ms.Both runtimes now key the cache on the schema's own content plus the
enforcedoverlay,
so a rewritten schema can never be served a stale entry and two paths holding identical
schemas share one. Validation withresourcessupplied builds fresh in both, rather than
risk a wrong key, and only a schema that compiles is cached.
Documentation
- The spec now states how a conforming implementation resolves the profile, which was
previously unspecified — the spec presentedpure-yamlas a fully conforming profile
with no indication of how an implementation should recognize one.
Testing and release safety
The profile fix is owned by the shared golden corpus, which runs against Python, Node, and
Bun: a pure-yaml artifact validating with no flags, an enforced pure-yaml artifact
failing its bound schema (the regression guard for the silent-pass hole), a declared
envelope, --profile overriding detection, detection without a *.yaml name, and
inspect on a pure-yaml artifact. The validator cache is covered by TypeScript unit tests,
since it is runtime-specific.
Full end-to-end runbook run before tagging: lint, both unit suites, the golden corpus on
all three runtimes, cross-implementation parity, clean-environment installs of the wheel
and npm tarball, the quickstart from an empty directory, and the skill bootstrap.
Both implementations were additionally swept over 14 profile-detection edge cases and
agree on all of them.
Full Changelog: v0.6.1...v0.6.2