fix(e2e): resolve plugin load error and SDK timeout warnings#312
fix(e2e): resolve plugin load error and SDK timeout warnings#312
Conversation
Fix two E2E test failures: 1. Plugin load error (#289): The `isSystemMessage` type guard only checked `type === "system"` but the SDK has multiple system message types (init, status, hook_response, etc.). Only the `init` message has the `plugins` array. Added check for `subtype === "init"`. 2. SDK timeout warning (#290): E2E config helper was missing `api_timeout_ms` and `temperature` fields for generation and evaluation configs. Added these fields with schema defaults. 3. Test file updates: Updated `runExecution` and `runEvaluation` calls to use options objects (matching the function signature changes from the recent refactoring in #311). Fixes #289 Fixes #290 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
Claude finished @sjnims's task in 1m 39s —— View job PR Review: fix(e2e): resolve plugin load error and SDK timeout warningsTodo List
Verdict: ✅ Looks good - ApproveAll quality checks pass and the fixes are sound. The PR correctly addresses both E2E test failures with appropriate solutions. Quality Checks
What's Good1. Correct Root Cause Analysis
2. Proper Default Values
3. Consistent Refactoring
4. Good Testing
SuggestionsMinor: Consider Type Safety Enhancement (Optional) The type cast in /**
* Type guard for system init message (the one with plugins).
* The SDK has multiple system message types (init, status, hook_response, etc.),
* but only 'init' has the plugins array we need.
*
* TODO: If SDK exports subtype on base type, remove cast
*/
export function isSystemMessage(msg: SDKMessage): msg is SDKSystemMessage {
return (
msg.type === "system" && (msg as { subtype?: string }).subtype === "init"
);
}However, this is purely optional - the current implementation is correct and the comment adequately explains the situation. Architecture ReviewStage 3 - Execution ✅
Testing Patterns ✅
SummaryThis is a well-executed bug fix that:
Recommendation: Merge ✅ |
CI Failure Analysis: TestRun: #21151522900 | Commit: SummaryThe test suite failed with 1 test failure in Failures Found
Root CauseThe This suggests either:
How to Fix
Run locally to debug: npm test sdk-client.test.tsYou can also run just the failing test: npm test -- --reporter=verbose -t "returns true for minimal system message"Test Results Summary
Analyzed by Claude |
The isSystemMessage type guard now checks for subtype === "init" since only init messages have the plugins array. Updated tests accordingly: - Renamed "minimal system message" test to "minimal system init message" - Added subtype: "init" to make it a valid init message - Added new test verifying non-init system messages return false Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
Fixed CI failure: Updated the unit test for Changes in a100552:
|
|
Claude finished @sjnims's task in 2m 35s —— View job Todo List
Verdict: ✅ Looks good - ApproveThis PR correctly fixes both E2E test failures with well-reasoned solutions. All quality checks pass and CI is green. Quality Checks
What's Good1. Correct Root Cause Analysis & Fix The Before (line 275-278): export function isSystemMessage(msg: SDKMessage): msg is SDKSystemMessage {
return msg.type === "system";
}After: export function isSystemMessage(msg: SDKMessage): msg is SDKSystemMessage {
return (
msg.type === "system" && (msg as { subtype?: string }).subtype === "init"
);
}The type cast 2. Proper Schema Default Values The E2E config helper (
3. Consistent Refactoring Test file updates correctly use options objects for
4. Comprehensive Test Coverage The unit test updates in
This ensures the type guard correctly distinguishes between different system message subtypes. 5. Good Documentation Both the JSDoc comment and the PR description clearly explain:
Architecture ReviewStage 3 - Execution ✅
Testing Patterns ✅
TypeScript Quality ✅
Code Pattern Compliance
Minor ObservationsType Safety Enhancement (Optional) The type cast in // Future improvement if SDK exports subtype on base type:
export function isSystemMessage(msg: SDKMessage): msg is SDKSystemMessage {
return msg.type === "system" && msg.subtype === "init";
}However, this is purely optional - the current implementation is correct and properly documented. SummaryThis PR successfully resolves two distinct E2E test failures:
The fixes are:
Recommendation: Merge ✅ |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Description
Fix two E2E test failures that were preventing the test suite from passing:
Plugin load error ([Bug]: E2E test fails with plugin load error "Cannot read properties of undefined (reading 'find')" #289): The
isSystemMessagetype guard insdk-client.tsonly checkedtype === "system", but the SDK has multiple system message types (init, status, hook_response, etc.). Only theinitmessage has thepluginsarray, so when a non-init system message was received first, it caused "Cannot read properties of undefined (reading 'find')".SDK timeout warning ([Bug]: E2E test shows "timeout must be an integer" SDK warning causing retries #290): The E2E config helper was missing
api_timeout_msandtemperaturefields for generation and evaluation configs, causingundefinedvalues to be passed to the SDK.Test file updates: Updated
runExecutionandrunEvaluationcalls to use options objects (matching the function signature changes from the recent refactoring in refactor: convert 5-6 parameter functions to options objects #311).Type of Change
Component(s) Affected
Pipeline Stages
src/stages/1-analysis/)src/stages/2-generation/)src/stages/3-execution/)src/stages/4-evaluation/)Core Infrastructure
src/cli/)src/index.ts)src/config/)src/state/)src/types/)src/utils/)Other
tests/)CLAUDE.md,README.md)config.yaml,eslint.config.js,tsconfig.json, etc.).github/)Motivation and Context
E2E tests were failing with two distinct errors:
Both issues only manifested during E2E tests with real API calls because unit tests use mocks that don't expose these edge cases.
Fixes #289
Fixes #290
How Has This Been Tested?
Test Configuration:
Test Steps:
npm run typecheck- passesnpm run lint- passesnpm run format- no changesnpm run knip- no dead codenpm run jscpd- no new duplicatesnpm run madge- no circular dependenciesRUN_E2E_TESTS=true npm test -- tests/e2e/pipeline.test.ts- 4 passed, 1 skippedChecklist
General
TypeScript / Code Quality
npm run typecheck)_anytypes without justificationDocumentation
Linting
npm run lintand fixed all issuesnpm run format:checkmarkdownlint "*.md"on Markdown files (N/A - no MD changes)uvx yamllint -c .yamllint.ymlon YAML files (if modified) (N/A)actionlinton workflow files (if modified) (N/A)Testing
npm testand all tests passStage-Specific Checks
Stage 3: Execution (click to expand)
Example Output (if applicable)
Additional Notes
The root causes were:
init,status,hook_response, etc.) but onlyinithas thepluginsarrayReviewer Notes
Areas that need special attention:
isSystemMessageis necessary because the SDK's type union doesn't exposesubtypeon the base typeKnown limitations or trade-offs:
🤖 Generated with Claude Code