Skip to content

build: one-command vendored-asset sync (make sync-vendored)#75

Merged
rickcrawford merged 1 commit into
mainfrom
rickcrawford/wor-1474-vendored-asset-sync-fix
Jun 18, 2026
Merged

build: one-command vendored-asset sync (make sync-vendored)#75
rickcrawford merged 1 commit into
mainfrom
rickcrawford/wor-1474-vendored-asset-sync-fix

Conversation

@rickcrawford

Copy link
Copy Markdown
Contributor

What

Keeps the byte-identical vendored copies of workspace-root assets (the JSON schemas, pricing table, agent-skill markdown) in sync with one command instead of remembering to cp each one.

These files are embedded into publishable crates via include_str!; cargo publish only packages files inside a crate directory, so each canonical file is vendored as an in-crate copy (e.g. schemas/v1.json has copies under both crates/mcptest-config/ and crates/mcptest/, the latter emitted by mcptest schema and asserted byte-for-byte by cli_schema.rs). Until now check-vendored-assets.sh only checked drift; a root-schema edit that synced two of the three copies slipped through and failed CI ~13 min later.

Changes

  • scripts/check-vendored-assets.sh --fix: copies each canonical file over its vendored sibling(s), driven by the same PAIRS list the check already uses (single source of truth). The no-arg check (CI gate, run by check.sh) is unchanged; its fix message now points at make sync-vendored.
  • Makefile: make sync-vendored (propagate) and make vendored-check (gate).
  • AGENTS.md: documents the workflow — edit the canonical file, run make sync-vendored, commit the copies.

Why not the alternatives

  • Symlinks / a single shared file break cargo publish — the include_str! target would not be packaged.
  • A build.rs that writes the source tree is an anti-pattern (dirty tree, rebuild churn) and cannot copy from the workspace root on a published crate.

Testing

--fix on an in-sync tree is a no-op; a drift→--fix→restore cycle leaves git clean; make sync-vendored / make vendored-check work; bad args error with usage (rc 2); em-dash and shellcheck clean.

…ropagate canonical assets (WOR-1474)

Some workspace-root files (the JSON schemas, pricing table, agent-skill markdown)
are vendored as byte-identical copies into publishable crates because
`cargo publish` only packages files inside a crate dir and they are embedded via
`include_str!`. The script only checked drift; after editing a canonical file you
had to remember to `cp` it over each vendored sibling, which is easy to miss (a
root-schema edit synced two of three copies and failed the cli_schema tests in CI).

- check-vendored-assets.sh gains a `--fix` mode: it copies each canonical file
  over its vendored sibling(s), driven by the same PAIRS list the check uses, so
  the source of truth stays single. The no-arg check (the CI gate, run by
  check.sh) is unchanged and now points the fix message at `make sync-vendored`.
- Makefile: `make sync-vendored` (propagate) and `make vendored-check` (gate).
- AGENTS.md documents the workflow: edit the canonical file, run
  `make sync-vendored`, commit the copies alongside the source.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@rickcrawford rickcrawford merged commit e564807 into main Jun 18, 2026
17 checks passed
@rickcrawford rickcrawford deleted the rickcrawford/wor-1474-vendored-asset-sync-fix branch June 18, 2026 16:22
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