Bundle bindings route repeats full-state parsing and full re-hashing on every request

Đang mở
#262 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
48/100
Loại issue
Tính năng
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
typescript
Lĩnh vực
backend, performance

Hướng nghiên cứu

Start with reference-implementations/dacs-directory/app/api/dacs/bundles/[jobId]/route.ts, then read src/catalog/pagination.ts and test/catalog-binding-pagination.test.ts to understand the current page and cursor behavior. The issue calls for a per-job binding index or cache that avoids loading all scan state and re-hashing and sorting bindings on each page. Update the cost notes in README.md and src/catalog/contracts.ts; done means the existing cursor behavior is preserved and the pagination tests pass.

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

Mô tả

contributors-section minor

Where: reference-implementations/dacs-directory/app/api/dacs/bundles/[jobId]/route.ts:33 (on phase0-completion at the linked commit)

What goes wrong: Every GET /api/dacs/bundles/{jobId} calls loadScanState() (route.ts:33), which reads, parses and normalises the entire stored scan state only to look up one jobId, so the cost grows with the size of the whole state rather than the reply. In addition, every request with limit or cursor (route.ts:37) computes the content hash of every binding stored for the job and sorts them all in keysetPage (src/catalog/pagination.ts), then returns one page, so reading a large job in pages repeats that work on each page. The README (README.md:366-367) and the OpenAPI descriptions (src/catalog/contracts.ts:404-405) already warn that paged reads cost more than a plain read.

Suggested fix: Stop loading the full scan state per request: read only the bundle bindings, for example from a small separately stored or cached index keyed by jobId. Keep each job's bindings in content-hash order in that index (or cache the hash-ordered list per job) so a page is a slice instead of a full re-hash and sort. Keep the existing cursor behaviour (a page starts after the cursor key even if that binding is gone) and its tests in test/catalog-binding-pagination.test.ts. Then update the cost note in README.md:366-367 and src/catalog/contracts.ts:404-405 to match.

Size: Medium

This comes from a code review, not from a failing run, so please confirm it before starting. Send the fix as a pull request to phase0-completion. It merges once tests pass and a maintainer has approved it.

Ngôn ngữ chính
TypeScript
Star
0
Fork
3
Merge trung bình
20 giờ 26 phút
Pull request đã merge (30 ngày)
119

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của DACS-Agent-commerce/Community

Tất cả issue của DACS-Agent-commerce/Community

Issue tương tự

Thêm issue về TypeScript

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.