test(match): add direct unit tests for requestKey, responseKey, methodOf#14
Merged
Conversation
requestKey and responseKey are exported from src/match.ts and used by diffTranscripts, but had no dedicated unit tests. This adds test/match.keys.test.ts covering: stable key across param key order, volatile-key stripping (timestamp, ts, requestId), method inclusion, result vs. error discrimination, and null/no-params edge cases.
Member
Author
|
auto-deferred for human review: CodeQL SARIF status check stuck in queued state after extended wait The primary CI results:
The CodeQL check (SARIF result processing) has been in queued status for more than 10 minutes without resolving. Self-merge gate requires all checks to be non-pending. Safe to merge manually once CodeQL resolves or is confirmed neutral. Generated by Claude Code |
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.
Why
requestKeyandresponseKeyare exported fromsrc/match.tsandre-exported via
src/index.ts. They form the backbone of thediffTranscriptslogic: every pair comparison goes through them. Yetthey had no dedicated unit tests - only indirect coverage from
test/diff.test.tsexercising them at thediffTranscriptslevel.methodOfis also exported but untested. Adding focused tests closesthis gap and makes regressions in these functions immediately
diagnosable rather than surfacing as mysterious diff failures.
What
test/match.keys.test.tswith 21 tests across three suites.methodOf: returns method string for requests and notifications,undefined for responses.
requestKey: stable across param key order and request ids, stripsvolatile keys (timestamp, ts, requestId), differs on method and
non-volatile params, handles no-params and no-method messages.
responseKey: stable across response ids and result key order,differs on result values and error codes, distinguishes result from
error, strips volatile keys from results.
Tests
test/match.keys.test.ts.before this PR.
Self-merge gate
Generated by Claude Code