Skip to content

chore: pin ajv to exact 8.11.0#1197

Merged
bonustrack merged 1 commit into
masterfrom
chore/pin-ajv-exact
May 7, 2026
Merged

chore: pin ajv to exact 8.11.0#1197
bonustrack merged 1 commit into
masterfrom
chore/pin-ajv-exact

Conversation

@tony8713

@tony8713 tony8713 commented May 7, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Tighten the ajv constraint from ^8.11.0 to an exact pin (8.11.0).
  • No code changes — purely a package.json / yarn.lock adjustment.

Why

ajv-errors@3.0.0 (current latest) emits broken validator code when paired with ajv@8.20.0. Compiled validators end up with references like:

{"str":"err76"}.keyword !== "errorMessage"

instead of the intended:

err76.keyword !== "errorMessage"

…which throws SyntaxError: Unexpected token ':' the first time the validator runs. That blows up snapshot.utils.validateSchema(...) for any non-trivial schema (the space schema is the easy reproducer).

The bug only surfaces in downstream services using bun, because bun resolves ^8.11.0 fresh and lands on 8.20.0. Yarn historically had 8.11.0 locked, so the bug never showed up there. ajv-errors has no newer release and there's no working ajv 8.21+ yet, so the only clean lever is to pin from this side.

8.11.0 is the version snapshot.js has been deployed against in production for years, so this is a no-behavior-change pin rather than a downgrade.

Why not handle this downstream?

snapshot-sequencer#638 currently ships an undocumented "ajv": "8.11.0" direct dependency on each consumer to force-hoist 8.11.0 to the root. Bun doesn't (yet) support nested overrides (oven-sh/bun#6608), so the workaround can't even be scoped. Pinning at the source avoids every downstream having to repeat this hack.

Test plan

  • yarn install regenerates yarn.lock with ajv@8.11.0 (no other resolutions change)
  • yarn typecheck passes
  • yarn lint passes
  • yarn test:once — same 335 passing / 2 pre-existing flaky e2e failures (sepolia ENS resolver, Starknet multicall) as master. No new failures.
  • On release, bump @snapshot-labs/snapshot.js in snapshot-sequencer#638 and drop its direct ajv dependency

🤖 Generated with Claude Code

Tightens the ajv constraint from `^8.11.0` to an exact pin so transitive
resolution is deterministic across yarn/bun/npm consumers.

Why: ajv-errors@3.0.0 (latest) emits broken validator code when paired
with ajv@8.20.0 — compiled validators reference `{"str":"errN"}.keyword`
instead of `errN.keyword`, throwing `SyntaxError: Unexpected token ':'`
at runtime. This surfaces in downstream services that use bun (which
resolves `^8.11.0` to the latest 8.20.0) but not yarn (which had locked
8.11.0 historically). 8.11.0 is the version production has been running
on for years.

Pinning here means consumers no longer need their own `ajv` overrides
(see snapshot-labs/snapshot-sequencer#638 for the workaround this lets
them drop).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@bonustrack
bonustrack merged commit d1484c1 into master May 7, 2026
2 of 4 checks passed
@bonustrack
bonustrack deleted the chore/pin-ajv-exact branch May 7, 2026 17:03
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.

2 participants