Skip to content

test(diff): cover empty-transcript edge cases and first-occurrence deduplication - #33

Merged
protosphinx merged 1 commit into
mainfrom
bot/diff-dedup-tests
Aug 4, 2026
Merged

test(diff): cover empty-transcript edge cases and first-occurrence deduplication#33
protosphinx merged 1 commit into
mainfrom
bot/diff-dedup-tests

Conversation

@protosphinx

Copy link
Copy Markdown
Member

Why

diffTranscripts builds its comparison index via indexPairs, which maps each
ReplayPair to a (method, volatile-stripped-params) key and keeps only the
first occurrence when duplicates appear. Two important behavioral guarantees
had no test coverage:

  1. Empty-transcript edge cases - one or both sides empty. These feed
    directly into diffTranscripts in real fixture-update workflows when a
    server adds or removes an entire method.

  2. First-occurrence deduplication - when a recording contains the same
    (method, params) more than once (common in long sessions), only the first
    response is used for comparison. A test author relying on "the second call's
    response" being compared would get the wrong result silently.

  3. Volatile-key collision - two calls with identical non-volatile params but
    differing timestamp / requestId values collide to the same slot, meaning
    the second is silently discarded. This is the correct behavior (it mirrors
    the normalizedMatch semantics used everywhere else) but was untested.

What

  • New file test/diff.dedup.test.ts with 9 tests across 4 describe blocks:
    • empty transcripts: both empty, A populated/B empty, A empty/B populated
    • first-occurrence deduplication in A: second duplicate ignored when it
      matches B, when first matches B, three duplicates
    • first-occurrence deduplication in B: second duplicate in B ignored
    • deduplication interacts with volatile key stripping: timestamp and
      requestId variants collide to one slot

Tests

  • npm run lint - clean (tsc --noEmit)
  • npm run build - clean
  • npm test - 227 tests pass (218 before this PR, 9 new)
  • New tests live entirely in test/diff.dedup.test.ts; no source changes

Self-merge gate

  • all CI checks pass
  • LOC delta < 250 (145 lines added, 0 removed)
  • no public-API surface change (no src/ files modified)
  • no runtime-dependency additions
  • no workflow file changes
  • tests added or extended (test/diff.dedup.test.ts, 9 new tests)

Generated by Claude Code

…duplication

diffTranscripts uses indexPairs to build a (method, volatile-stripped-params)
keyed map, keeping only the first ReplayPair per key. Previously there were no
tests for: (a) empty transcripts on either or both sides, and (b) the
first-occurrence deduplication guarantee when a recording contains duplicate
(method, params) entries. The new suite covers both scenarios, including the
interaction between deduplication and volatile-key stripping (timestamp,
requestId, etc.) that lets two recorded calls with the same non-volatile params
collide to one comparison slot.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@protosphinx protosphinx added the automated Opened by the daily bot label Aug 4, 2026 — with Claude
@protosphinx
protosphinx merged commit f93e05a into main Aug 4, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automated Opened by the daily bot

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant