fix: walk past an empty-string cursor in the legacy task refresh (#2220)
`ManagedRequestorTasksState.refresh()` drives the legacy `tasks/list` walk itself, and both of its cursor tests were truthiness checks — so the fixed adapter was never reached. `while (cursor)` ended the walk on a `""` `nextCursor`, leaving the user-visible task list on page one, and `cursor ? [...this.tasks, ...page] : page` would have replaced the accumulated list rather than extended it had the walk continued. Both now test `=== undefined`. The other four paged/managed stores already did (`pagedToolsState`, `pagedPromptsState`, `pagedResourcesState`, `pagedResourceTemplatesState`, `pagedRequestorTasksState`, `managedSkillsState`); this was the last walk on the truthiness side. Covered by a new case in `managedRequestorTasksState.test.ts` that paginates `"" → "c2" → end` and asserts the cursor each call received, so a walk that terminated correctly but re-requested page one still fails. Reverting either guard on its own fails exactly that case. Reported by Copilot on #2277. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EN2UfrkQZvtrviMtqURRm4 Signed-off-by: cliffhall <cliff@futurescale.com>
This commit is contained in:
parent
9b35e530fc
commit
3b4eb447c9
1 changed files with 35 additions and 5 deletions
|
|
@ -116,9 +116,12 @@ export class FakeInspectorClient
|
|||
listResourceTemplates = vi.fn(
|
||||
async () => this.resourceTemplatePages.shift() ?? { resourceTemplates: [] },
|
||||
);
|
||||
listRequestorTasks = vi.fn(
|
||||
async () => this.taskPages.shift() ?? { tasks: [] },
|
||||
);
|
||||
// Typed by its signature rather than inferred, so `mock.calls` carries the
|
||||
// cursor a test asserts on — the empty-string pagination case (#2220) turns
|
||||
// on *which* cursor each call received, not just how many there were.
|
||||
listRequestorTasks = vi.fn<
|
||||
(cursor?: string) => Promise<ListResult<"tasks", Task>>
|
||||
>(async () => this.taskPages.shift() ?? { tasks: [] });
|
||||
listSkills = vi.fn(async () => this.skillPages.shift() ?? { skills: [] });
|
||||
// `skills/get` echoes a minimal entry; tests that care override the mock.
|
||||
getSkill = vi.fn(async (uri: string) => ({
|
||||
|
|
|
|||
Loading…
Reference in a new issue