Skip to main content

Artifact validation

Offline schema validation of every publisher's rendered artifact before a release

Before a release uploads anything, anodizer renders each configured publisher's artifact — the winget manifest set, the scoop JSON, the chocolatey .nuspec, the snap.yaml metadata, the Homebrew formula and cask, the nfpm config plus the built .deb/.rpm, the AUR PKGBUILD and .SRCINFO, the nix derivation and flake, and more — and validates each one against the destination registry's own schema and rules. It runs offline and hermetically, so a structural defect (a wrong-typed value, an out-of-enum field, a missing required key, a malformed manifest) is caught in --snapshot / --dry-run, before a release can push a manifest the registry rejects.

This closes the gap between "the inputs are populated" and "the whole rendered document conforms". A required-field check proves a value is present; artifact validation proves the assembled artifact is one the registry will accept.

Execution

Artifact validation runs automatically — no config needed — as part of the emission-validate pass, which runs in every mode: snapshot, dry-run, nightly, and real releases (the render is a millisecond in-memory check, so production manifests get the same scrutiny):

$ anodizer release --snapshot

It is also exercised by task prepush, which drives the same snapshot pass, so a malformed publisher artifact fails the local pre-push gate before it can reach a real release.

On a real release the same validators run a second time, in the pre-publish guard, which sits before the GitHub release is created: a template that cannot render aborts the run with no release behind it, draft or live. A single crate that disqualifies itself there — two archives claiming one platform, a repository: with no owner and name — is reported as a skip, exactly as the live publisher reports it, and the crates and publishers after it are still checked.

On a sharded determinism build

When determinism runs as a target-restricted shard matrix (a shard, or a host-only --single-target build), emission-validate checks the emissions the current shard can satisfy and self-skips a publisher whose input archives this shard did not produce — a cross-platform aggregator (homebrew, nix) is validated on the shard that built its inputs and skipped on the others. On a full build (neither restriction set), the self-skip does not apply for the index/manifest publishers (homebrew, nix, aur, krew, winget, scoop, chocolatey): a configured one with no eligible artifact still errors, since it would otherwise generate an installable reference that 404s. The build-time packagers nfpm/snapcraft and the image-reference publisher mcp aren't covered by this gate — with no eligible input they simply produce nothing (or a config-driven skip, for mcp) and report no error. See Emission-validate on sharded builds.

Two layers

Validation runs in two layers per publisher.

An always-on hermetic minimum check. Every artifact is checked with no external tools and no network:

  • Vendored JSON schemas (held at fixed versions and embedded at build time) for winget, scoop, krew, mcp, snapcraft, and nfpm.
  • Pure-Rust structural checks for the artifacts that have no JSON schema: the chocolatey nuspec XML, the Homebrew Ruby formula/cask, the AUR PKGBUILD/.SRCINFO, and the nix derivation.

This minimum check always runs and always reports. It does not depend on host tooling.

Optional stronger checks, gated on tool presence. When the matching tool is installed (typical on CI and consumer hosts), anodizer runs a deeper check on top of the minimum check:

ToolDeeper check
xmllintValidate the chocolatey .nuspec against its XSD
ruby -cSyntax-check the Homebrew formula/cask Ruby
bash -nSyntax-check the AUR PKGBUILD
dpkg-deb -f / rpm -qipRead back a built .deb/.rpm's control fields
nix-instantiate --parseParse the rendered nix expression

When a gated tool is absent the check is skipped and does not fail — the hermetic minimum check still stands, so a missing tool can never turn into a false rejection.

Checks

PublisherArtifactWhat is checked
wingetversion / installer / defaultLocale manifestsMicrosoft's published JSON schemas (ManifestVersion 1.12.0)
scoopApp manifest JSONThe Scoop project's draft-07 manifest schema
krewPlugin manifestkrew's plugin-validation rules (transcribed schema)
mcpserver.jsonThe MCP registry's server.json schema
chocolatey.nuspec XMLPure-Rust minimum structural check; XSD via xmllint when present
snapcraftsnap.yaml metadatasnapd's snap.yaml validation rules (transcribed schema)
homebrewFormula + cask RubyMinimum structural stanza check; ruby -c when present
nfpmnfpm config + built .deb/.rpmnfpm's config schema; control fields via dpkg-deb/rpm when present
aurPKGBUILD + .SRCINFOMinimum structural check; bash -n when present
nixDerivation + flakeMinimum structural check; nix-instantiate --parse when present

Example: a defect caught in snapshot

A misconfigured field is caught and named before any upload. Each finding is reported as publisher: field '<path>' — <what the schema expected>:

$ anodizer release --snapshot
...
       Error publisher artifact schema validation failed:
winget: field '/PublisherUrl' — "acme.example" does not match "^([Hh][Tt][Tt][Pp][Ss]?)://.+$"

The message names the offending publisher, the JSON-Pointer path to the field, and the registry schema's own expectation — so the fix is a one-line config edit made before anything is released.

Schema provenance

The vendored schemas live in crates/stage-publish/schemas/ and are held at the registry / tool versions anodizer targets. Each is self-contained (no external $ref that would trigger a network fetch), so validation stays hermetic. Refreshing a schema is a deliberate, reviewed bump documented in crates/stage-publish/schemas/SOURCES.md, which records each schema's source, fixed version, and refresh procedure.