Skip to content

feat(init): --vendor-schemas pins built-in schemas on-disk against upgrades (#431)#537

Open
avrabe wants to merge 1 commit into
mainfrom
feat/431-vendor-schemas
Open

feat(init): --vendor-schemas pins built-in schemas on-disk against upgrades (#431)#537
avrabe wants to merge 1 commit into
mainfrom
feat/431-vendor-schemas

Conversation

@avrabe

@avrabe avrabe commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

What

A project that lists only built-in schema names in rivet.yaml (no local schemas/) validates against whatever schema definitions are compiled into the installed rivet binary. So every release that tightens or adds a rule to a built-in schema silently changes validation for embedded-schema consumers — the same rivet validate that passed now flags unchanged artifacts (#431).

The version is already surfaced (REQ-176/177, #483) and CI warns on unbumped schema changes (REQ-206), but nothing let a project pin the schema set it validates against. This adds the one-step pin.

How

rivet init --vendor-schemas writes the resolved schema set — the names in schemas: plus auto-discovered bridges — from the binary's embedded copies into schemas/<name>.yaml. The loader already prefers on-disk over embedded, so the vendored set is committed to the project's git and immune to release-to-release drift. Vendoring never overwrites an existing schema file (a locally-edited schema is kept).

$ rivet init --preset aspice --vendor-schemas --dir proj
  ...
  vendoring schemas (pinned against upgrades):
    + proj/schemas/common.yaml
    + proj/schemas/aspice.yaml
$ rivet --project proj validate
  Schemas: common@0.1.0 (on-disk), aspice@0.2.0 (on-disk)   # ← pinned, not embedded
  Result: PASS

Tests

init_vendor_schemas_pins_schemas_on_disk: vendors common+aspice, asserts the files exist, that validate reports them (on-disk), and that a locally-edited vendored schema survives a re-vendor (idempotency guard). cargo test -p rivet-cli --test cli_commands 132 pass; clippy --all-targets -D warnings + fmt clean.

Scope

This is the cheapest high-value slice of #431 (the issue's "mitigation that already works today", now one command). Out of scope (separate slices): a rivet.yaml-recorded expected-version pin with a validate-time drift diagnostic, and a rivet schema vendor command for already-initialized projects.

Refs #431. Implements REQ-220.

🤖 Generated with Claude Code

…grades (REQ-220, #431)

A project that lists only built-in schema names validates against whatever
schema definitions are compiled into the installed rivet binary (the loader
prefers on-disk, else the embedded copy). So every release that tightens a
built-in schema silently changes validation for embedded-schema consumers — the
same `rivet validate` that passed now flags unchanged artifacts.

`rivet init --vendor-schemas` writes the resolved schema set (the names in
`schemas:` plus auto-discovered bridges) from the binary's embedded copies into
the project's `schemas/<name>.yaml`. Because the loader prefers on-disk, the
vendored set is committed to the project's git and immune to release-to-release
rule drift. Vendoring never overwrites an existing schema file.

Confirmed: `rivet init --preset aspice --vendor-schemas` writes common.yaml +
aspice.yaml, and `rivet validate` then reports them `(on-disk)` and PASSes; a
locally-edited vendored schema survives a re-vendor. New
`init_vendor_schemas_pins_schemas_on_disk` test; `cargo test -p rivet-cli
--test cli_commands` 132 pass; clippy --all-targets + fmt clean; rivet validate PASS.

Out of scope (separate slice): a rivet.yaml expected-version pin with a
validate-time drift diagnostic; `rivet schema vendor` for existing projects.

Implements: REQ-220
Refs: REQ-010
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

📐 Rivet artifact delta

Change Count
Added 1
Removed 0
Modified 0
Downstream impacted (depth ≤ 5) 0

Graph

graph LR
  REQ_220["REQ-220"]:::added
  classDef added fill:#d4edda,stroke:#28a745,color:#155724
  classDef removed fill:#f8d7da,stroke:#dc3545,color:#721c24
  classDef modified fill:#fff3cd,stroke:#ffc107,color:#856404
  classDef overflow fill:#e2e3e5,stroke:#6c757d,color:#495057,stroke-dasharray: 3 3
Loading
Added
  • REQ-220

📎 Full HTML dashboard attached as workflow artifact rivet-delta-pr-537download from the workflow run.

Posted by rivet-delta workflow. The graph shows only changed artifacts; open the HTML dashboard (above) for full context.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'Rivet Criterion Benchmarks'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.20.

Benchmark suite Current: cc303eb Previous: 18db3e9 Ratio
traceability_matrix/1000 55095 ns/iter (± 210) 43785 ns/iter (± 554) 1.26

This comment was automatically generated by workflow using github-action-benchmark.

@codecov

codecov Bot commented Jun 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@avrabe avrabe mentioned this pull request Jun 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant