a2aproject / a2aproject/a2a-js

[Bug]: REST create push config ignores path taskId

Đang mở Phù hợp với người mới
#680 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
TypeScript
Star
613
Fork
169
Merge trung bình
1 ngày 6 giờ
Pull request đã merge (30 ngày)
21

Mô tả

### What happened?

`POST /tasks/:taskId/pushNotificationConfigs` parses only the JSON body (`TaskPushNotificationConfig.fromJSON(req.body)`). `req.params.taskId` is never copied onto the config. `fromJSON` defaults a missing taskId to `""`, and after #629 empty IDs are `RequestMalformedError`.

The proto HTTP mapping is `post: "/tasks/{task_id=*}/pushNotificationConfigs"` with `body: "*"`, so transcoding clients put task_id in the URL and may omit it from the body. Same-SDK RestTransport sends taskId in both places, which is why in-repo tests pass. The v0.3 Express handler has the same hole.

**Repro**
Create a task, then `POST /tasks//pushNotificationConfigs` with body `{ "url": "https://example.test/hook" }` and no taskId field.

Observed: 400 "Task ID is required".
Expected: 201 and a stored config whose taskId is the path id.

### Relevant log output

n/a.

### Code of Conduct

- [x] I agree to follow this project's Code of Conduct

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Look at the REST handler for creating push notification configs, likely in a file like `src/rest/tasks.ts` or similar. The bug is that `req.params.taskId` is not being used to set the `taskId` on the config object when `TaskPushNotificationConfig.fromJSON(req.body)` is called. Find the `fromJSON` method to see its defaults. Write a test that reproduces the issue by sending a POST request with a taskId in the URL but not in the body, and verify the config is created with the correct taskId. Check the v0.3 Express handler as mentioned.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
express, javascript, node.js, typescript
Lĩnh vực
api, backend
Loại issue
Lỗi
Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức độ hoạt động
Sôi nổi
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
75/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.