Skip to content

test(voice): extract the duplicated PassingJudge test double to fixtures/#797

Merged
drewdrewthis merged 1 commit into
mainfrom
tech-debt-fixer-786
Jul 16, 2026
Merged

test(voice): extract the duplicated PassingJudge test double to fixtures/#797
drewdrewthis merged 1 commit into
mainfrom
tech-debt-fixer-786

Conversation

@langwatch-agent

Copy link
Copy Markdown
Contributor

Ticket

Closes #786. Follow-up from the #783 review: PassingJudge (a fake judge that concludes a run successfully on the judge() step) was copied across several voice suites. javascript/src/voice/__tests__/fixtures/ is already the home for shared voice test doubles (FakeVoiceAdapter, AudioUserSimulator).

Change

  • New fixtures/passing-judge.ts exporting a single PassingJudge.
  • Removed the local copies from duration-fidelity, interrupt-truncation, proceed-interrupt, and result-audio and imported the shared one (also dropped the now-unused JudgeAgentAdapter import from each).

The four copies had drifted into two variants (["Agent responds"] / "voice turn completed" vs ["ok"] / "done"). No suite asserts on the judge's criteria, reasoning, or metCriteria (only result.success === true), so consolidating to one canonical version is behavior-preserving. proceed-interrupt's judge-timing rationale comment is kept, relocated to the usage site.

Note: voice-spans-stt.test.ts (named in the issue) has no PassingJudge copy on main, so nothing to change there.

Evidence

  • npx vitest run on the four suites: 22 passed.
  • pnpm typecheck clean.
  • The new fixture lints clean. (Pre-existing import/order errors in these test files are unrelated to this change and are not gated by CI: lint:all skips the root package and lint:lib excludes *.test.ts / __tests__/**.)

Advisory note

Advisory PR from the tech-debt-fixer bot, for human review, not to be merged by the bot.

PassingJudge (a fake judge that concludes a voice run successfully on the
judge() step) was copied across four voice suites in two slightly diverging
variants. fixtures/ is already the home for shared voice test doubles
(FakeVoiceAdapter, AudioUserSimulator), so hoist a single PassingJudge
there and drop the copies. No suite asserts on the judge's criteria or
reasoning text (only result.success), so one canonical version is safe.

Closes #786.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@langwatch-agent langwatch-agent added the tech-debt-fixer Opened by the tech-debt-fixer agent (shared langwatch-agent bot identity) label Jul 13, 2026
@github-actions github-actions Bot added the low-risk-change PR qualifies as low-risk per policy and can be merged without manual review label Jul 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Automated low-risk assessment

This PR was evaluated against the repository's Low-Risk Pull Requests procedure.

  • Scope: Add fixtures/passing-judge.ts and replace local PassingJudge copies in four voice test files (duration-fidelity, interrupt-truncation, proceed-interrupt, result-audio), removing now-unused imports.
  • Exclusions confirmed: no changes to auth, security settings, database schema, business-critical logic, or external integrations.
  • Classification: low-risk-change under the documented policy.

The diff only extracts a duplicated test double into a new test fixture and updates test files to import that fixture; it does not modify authentication/authorization, secrets, database schemas/migrations, business‑critical logic, or external integrations. All changes are limited to test code and comments, which are low-risk and easily reverted if necessary.

An approving review has been submitted by automation. The PR may merge once required CI checks pass.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved by automation: PR qualifies as low-risk-change under the documented policy.

@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

Changes

The duplicated PassingJudge test double is now defined in a shared fixture and imported by four voice tests. Local adapter definitions and unused imports were removed, and one scenario comment was updated to describe the barge-in timing.

Voice test fixture extraction

Layer / File(s) Summary
Shared judge fixture
javascript/src/voice/__tests__/fixtures/passing-judge.ts
Adds a reusable PassingJudge adapter that returns successful judgments.
Test adoption
javascript/src/voice/__tests__/*-test.ts
Updates four tests to use the shared fixture and removes duplicated implementations.

Suggested reviewers: rogeriochaves, 0xdeafcafe, aryansharma28, sergioestebance, github-actions

Poem

I’m a bunny with tests in a row,
Sharing one judge wherever they go.
No copied class, no tangled hedge,
Just passing results on every edge.
Hop, hop—fixtures bloom! 🐇

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly states the main change: extracting the duplicated PassingJudge test double into fixtures.
Description check ✅ Passed The description matches the PR and explains the fixture extraction and deduplication work.
Linked Issues check ✅ Passed The PR satisfies #786 by adding a shared PassingJudge fixture and replacing the duplicated copies in the voice suites.
Out of Scope Changes check ✅ Passed The diff stays focused on the shared test double extraction and removes only related duplicate code.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch tech-debt-fixer-786

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@langwatch-agent langwatch-agent left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No findings. I checked #786 against the current tree: the remaining duplicated PassingJudge copies under javascript/src are gone, the new shared fixture preserves the successful judge behavior the affected suites assert on, and voice-spans-stt.test.ts does not currently contain a copy to migrate.

Validation run locally from the existing PR worktree:

  • npx vitest run javascript/src/voice/__tests__/duration-fidelity.test.ts javascript/src/voice/__tests__/interrupt-truncation.test.ts javascript/src/voice/__tests__/proceed-interrupt.test.ts javascript/src/voice/__tests__/result-audio.test.ts — 22 tests passed.
  • npm run typecheck from javascript/ — passed.
  • npx eslint src/voice/__tests__/fixtures/passing-judge.ts — passed.

CI still had the aggregate JavaScript check and CodeRabbit pending when I checked, so this review is based on the completed local validation plus the changed surface.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
javascript/src/voice/__tests__/fixtures/passing-judge.ts (1)

9-9: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider making criteria readonly.

The criteria property is only read (spread into metCriteria), never reassigned. Marking it readonly aligns with the guideline to use readonly properties where appropriate and prevents accidental mutation.

♻️ Proposed refactor
-  criteria: string[] = ["Agent responds"];
+  readonly criteria: string[] = ["Agent responds"];
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@javascript/src/voice/__tests__/fixtures/passing-judge.ts` at line 9, Mark the
criteria property in the passing-judge fixture as readonly while preserving its
existing string-array value and read-only usage.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@javascript/src/voice/__tests__/fixtures/passing-judge.ts`:
- Line 9: Mark the criteria property in the passing-judge fixture as readonly
while preserving its existing string-array value and read-only usage.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: df788318-1d62-4c73-9c91-516d4acfe007

📥 Commits

Reviewing files that changed from the base of the PR and between 2dfc381 and 50d1aad.

📒 Files selected for processing (5)
  • javascript/src/voice/__tests__/duration-fidelity.test.ts
  • javascript/src/voice/__tests__/fixtures/passing-judge.ts
  • javascript/src/voice/__tests__/interrupt-truncation.test.ts
  • javascript/src/voice/__tests__/proceed-interrupt.test.ts
  • javascript/src/voice/__tests__/result-audio.test.ts

@langwatch-agent langwatch-agent added the hound-checked Triaged by the pr-hound agent at the current head SHA label Jul 14, 2026
@langwatch-agent langwatch-agent self-assigned this Jul 14, 2026
@langwatch-agent langwatch-agent added the review: fast-skim PR Hound review mode label Jul 14, 2026
@drewdrewthis drewdrewthis merged commit 3bd88bd into main Jul 16, 2026
27 of 30 checks passed
@drewdrewthis drewdrewthis deleted the tech-debt-fixer-786 branch July 16, 2026 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hound-checked Triaged by the pr-hound agent at the current head SHA low-risk-change PR qualifies as low-risk per policy and can be merged without manual review review: fast-skim PR Hound review mode tech-debt-fixer Opened by the tech-debt-fixer agent (shared langwatch-agent bot identity)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(voice): extract the duplicated PassingJudge test double to fixtures/

2 participants