Repository navigation
test: rethrow stack overflows in the sanity-bridge oracle reference - #3587
Conversation
The reference conversion's `safeGetOf` swallowed every error thrown by a schema getter, including a `RangeError` when the call stack ran out inside one. The recursion then returned early instead of overflowing, so the cycle scenario's `toThrow(RangeError)` failed on some runs. The fuzz rounds had the same hole: a swallowed overflow gave a truncated reference result to compare against.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
|
Bundle Stats✅ No significant changes. All scenario measurements (37)🗺️
Significant means at least 1.0 KB and 1% gzip, or at least 5 ms and 10% import time. |
The cycle scenario in the sanity-bridge conversion oracle failed intermittently in CI with
expected function to throw an error, but it didn't, on PRs that don't touch the bridge.The test-only reference conversion reads array members through
safeGetOf, which wrapped Sanity's lazyofgetter in a barecatch. On the block to inline object to Portable Text field cycle, the stack can run out inside that getter, and theRangeErrorwas swallowed. The recursion then returned early instead of overflowing, sotoThrow(RangeError)failed.safeGetOfnow rethrows aRangeErrorand keeps ignoring other getter errors. The fuzz rounds had the same gap: a swallowed overflow produced a truncated reference result to compare against, and now that round takes the existing overflow branch, which only asserts the rework terminates.On Node 26.13.0 (the CI version) the oracle file failed 1 of 20 runs on main and 0 of 20 with the change. A getter that throws
RangeErrorpasses throughsafeGetOfwith the change and is swallowed on main. Test-only, so no changeset.Note
Low Risk
Test-only change to error handling in the oracle reference; no production bridge behavior.
Overview
Fixes intermittent CI failures in the conversion oracle where cyclic block ↔ inline-object schemas were supposed to overflow the recursive reference but sometimes did not throw.
In the test-only reference helper
safeGetOf, the catch around Sanity’s lazy arrayofgetter no longer swallowsRangeError. Other getter errors are still ignored. When overflow happened inside the getter, swallowing it made recursion exit early, sotoThrow(RangeError)and fuzz rounds that expect a reference crash could fail despite unrelated PRs.Production conversion code is unchanged; only the oracle reference in
sanity-schema-to-portable-text-schema.oracle.test.tsis updated.Reviewed by Cursor Bugbot for commit ca754a1. Bugbot is set up for automated code reviews on this repo. Configure here.