-
Notifications
You must be signed in to change notification settings - Fork 431
Add SDK support for enhanced task status #1864
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -116,6 +116,14 @@ async def test_task_status_polling(self, client, tmp_path): | |
| status = await client.documents.get_task_status(task_response.task_id) | ||
| assert status.status is not None | ||
|
|
||
| enhanced_status = await client.documents.get_task_status_enhanced( | ||
| task_response.task_id | ||
| ) | ||
| assert enhanced_status.status is not None | ||
|
|
||
| enhanced_tasks = await client.documents.list_tasks_enhanced() | ||
| assert isinstance(enhanced_tasks.tasks, list) | ||
|
Comment on lines
+119
to
+125
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shared root cause: enhanced integration tests are under-asserting contract fidelity in 🤖 Prompt for AI Agents |
||
|
|
||
| final = await client.documents.wait_for_task(task_response.task_id) | ||
| assert final.status in ("completed", "failed") | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Guard
data.taskswithArray.isArraybefore calling.map().If the API returns a non-array truthy value for
tasks, this will throw at runtime. A narrow shape guard keeps the method resilient.Suggested change
async listTasksEnhanced(): Promise<TaskListResponse> { const response = await this.client._request("GET", "/api/v1/tasks/enhanced"); const data = await response.json(); + const tasksRaw = Array.isArray(data.tasks) ? data.tasks : []; return { - tasks: (data.tasks ?? []).map((task: Record<string, unknown>) => + tasks: tasksRaw.map((task: Record<string, unknown>) => this.parseTaskStatus(task) ), }; }📝 Committable suggestion
🤖 Prompt for AI Agents