Repository navigation
fix(conformance): interop cross-check self-tests require the expected rejection class (LAB-8795) - #192
Conversation
… rejection class expectRejected accepted any throw that was not a TypeError or ReferenceError, so a self-test could not tell an OutOfModelError from a plain Error. It now takes the expected class and matches it exactly; instanceof cannot work, because OutOfModelError extends Error. Also moves the Symbol-key guard's comment out of the key-sort comment.
Code Review Completed! 🔥The code review was successfully completed based on your current configurations. Kody Guide: Usage and ConfigurationInteracting with Kody
Providing Context (Files & MCPs)Add these hints in your PR description (or a comment) to unlock deeper checks:
Current Kody ConfigurationReview OptionsThe following review options are enabled or disabled:
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
Summary by CodeRabbit
WalkthroughThe interop cross-check now validates rejected self-tests against an expected error class. It reports class mismatches and continues to treat ChangesInterop error checks
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to The changed error checks match the rejection paths inspected, and no actionable merge-blocking issue remains. Pre-merge checks |
|
What
expectRejectedintools/interop-crosscheck.mjsaccepted any throw that was not aTypeErrororReferenceError. So a self-test could not tell the rejection it was testing from any other one: an encoder that threwnew Error("x")whereOutOfModelErrorbelongs still printed OK.expectRejectednow takes the expected error class and requireserr.constructor === errorClass. A different class counts as a failure and is reported asFAIL <test> (<case>): expected <class>, got <class>: <message>.TypeErrorandReferenceErrorare still rethrown as harness bugs.instanceof:OutOfModelError extends Error, soinstanceof Errorwould accept anOutOfModelErrorin the two self-tests that expect a plainError.loneSurrogateSelftestandunsafeNumberSelftestpassError;outOfModelSelftestandnonStringKeySelftestpassOutOfModelError.if, starting "A plain object's data is…". No other comment changes.No change under
spec/,test-vectors/ortools/interop-reference.py, and no vector bytes change.Verification
node tools/interop-crosscheck.mjsprints the same line asmain:OK: 44 key, 6 value, 6 reader accept, 1 reader reject, 1 AAD, 1 encryption, 34 error vectors verified independently.Each mutant below was run against this branch and against
main's harness:mainnew Error("x")OKFAIL nonStringKeySelftest (…): expected OutOfModelError, got Error: xnew Error("x")FAIL outOfModelSelftest (…): expected OutOfModelError, got Error: xOutOfModelErrorOKFAIL loneSurrogateSelftest (…): expected Error, got OutOfModelError: xOutOfModelErrorOKFAIL unsafeNumberSelftest (…): expected Error, got OutOfModelError: xexpected rejection, encoding succeededpython3 tools/conformance.py checkOK;python3 tools/test_conformance.py: all 284 cases pass.Closes LAB-8795