chore: pin ajv to exact 8.11.0#1197
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ajvconstraint from^8.11.0to an exact pin (8.11.0).package.json/yarn.lockadjustment.Why
ajv-errors@3.0.0(current latest) emits broken validator code when paired withajv@8.20.0. Compiled validators end up with references like:instead of the intended:
…which throws
SyntaxError: Unexpected token ':'the first time the validator runs. That blows upsnapshot.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.0fresh and lands on8.20.0. Yarn historically had8.11.0locked, 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.0is 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 nestedoverrides(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 installregeneratesyarn.lockwithajv@8.11.0(no other resolutions change)yarn typecheckpassesyarn lintpassesyarn test:once— same 335 passing / 2 pre-existing flaky e2e failures (sepolia ENS resolver, Starknet multicall) asmaster. No new failures.@snapshot-labs/snapshot.jsinsnapshot-sequencer#638and drop its directajvdependency🤖 Generated with Claude Code