Problem
Two instances of dead code exist in the core SDK:
1. _failedTasks field in CompositeTask (src/task/composite-task.ts, lines 12, 19)
The _failedTasks field is declared and initialized to 0 in the constructor, but never incremented or read by any code in the entire codebase. Neither WhenAllTask.onChildCompleted() nor WhenAnyTask.onChildCompleted() ever modifies this counter. The field misleadingly suggests that failed tasks are tracked separately from _completedTasks, but they are not.
Additionally, a stale comment in WhenAllTask (line 14) references _failedTasks as something that should not be re-initialized, but since the field is unused, the comment is misleading.
2. Dead src/utils/async-pageable.ts file (91 lines)
This file contains a complete AsyncPageable class with Page interface and PageFetcher type that is never imported by any file in the entire codebase. The actual pagination implementation lives in src/orchestration/page.ts (which is exported from index.ts and used by client.ts). The dead file creates confusion for developers navigating the codebase.
Root Cause
The _failedTasks field was likely planned as a counter for failed child tasks but was never wired into the WhenAllTask or WhenAnyTask completion logic. The async-pageable.ts file appears to be an earlier implementation that was superseded by page.ts but never cleaned up.
Proposed Fix
- Remove the
_failedTasks field from CompositeTask
- Update the stale comment in
WhenAllTask that references _failedTasks
- Delete the dead
async-pageable.ts file
- Add unit tests that explicitly verify the
_completedTasks counter correctly counts both successful and failed child completions (documenting the intended behavior)
Impact
Low severity. This is dead code cleanup that reduces maintenance burden and prevents confusion. No behavioral change.
Problem
Two instances of dead code exist in the core SDK:
1.
_failedTasksfield inCompositeTask(src/task/composite-task.ts, lines 12, 19)The
_failedTasksfield is declared and initialized to0in the constructor, but never incremented or read by any code in the entire codebase. NeitherWhenAllTask.onChildCompleted()norWhenAnyTask.onChildCompleted()ever modifies this counter. The field misleadingly suggests that failed tasks are tracked separately from_completedTasks, but they are not.Additionally, a stale comment in
WhenAllTask(line 14) references_failedTasksas something that should not be re-initialized, but since the field is unused, the comment is misleading.2. Dead
src/utils/async-pageable.tsfile (91 lines)This file contains a complete
AsyncPageableclass withPageinterface andPageFetchertype that is never imported by any file in the entire codebase. The actual pagination implementation lives insrc/orchestration/page.ts(which is exported fromindex.tsand used byclient.ts). The dead file creates confusion for developers navigating the codebase.Root Cause
The
_failedTasksfield was likely planned as a counter for failed child tasks but was never wired into theWhenAllTaskorWhenAnyTaskcompletion logic. Theasync-pageable.tsfile appears to be an earlier implementation that was superseded bypage.tsbut never cleaned up.Proposed Fix
_failedTasksfield fromCompositeTaskWhenAllTaskthat references_failedTasksasync-pageable.tsfile_completedTaskscounter correctly counts both successful and failed child completions (documenting the intended behavior)Impact
Low severity. This is dead code cleanup that reduces maintenance burden and prevents confusion. No behavioral change.