[BUG] aimdb-mcp: get_buffer_metrics cannot find a record by its key

Đang mở Phù hợp với người mới
#453 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ó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
82/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
rust
Lĩnh vực
api, backend

Hướng nghiên cứu

Bắt đầu với tools/aimdb-mcp/src/tools/buffer_metrics.rs tại bộ lọc gần dòng 41, sau đó so sánh với logic tương ứng trong tools/aimdb-mcp/src/tools/profiling.rs gần dòng 45. Thêm hoặc tìm một bài kiểm tra cho bản ghi có khóa khác với tên kiểu Rust của nó. Hoàn thành khi get_buffer_metrics tìm thấy bản ghi đó khi truy vấn bằng khóa của nó và bài kiểm tra chạy thành công.

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

Mô tả

bug

Describe the bug
get_buffer_metrics takes a record_key, but it only matches that value against the record's Rust type name. When a record's key differs from its type name, querying by the real key returns found: false, even though the record exists.

The filter is in buffer_metrics.rs:41:

.filter(|r| r.name.contains(&params.record_key))

get_stage_profiling takes the same parameter and already matches both fields (profiling.rs:45).

To Reproduce

  1. Run an instance with a record whose key differs from its type name, for example key motion.policy with type contracts::Policy.
  2. Call the MCP tool get_buffer_metrics with {"record_key": "motion.policy"}.
  3. The tool replies:
{
  "found": false,
  "message": "No records matching this key were found in the running instance.",
  "record_key": "motion.policy"
}

Expected behavior
The tool finds the record by its key, as get_stage_profiling does. The fix is to match r.record_key as well as r.name, with a test where the two differ.

Environment

  • OS: macOS 13 (Darwin 22.6)
  • Rust Version: rustc 1.98.0
  • AimDB Version: main at d9c7be0

Additional context
Seen against a host gateway over a Unix socket. The target instance may also be built without the metrics feature, but the lookup fails before that matters.

Ngôn ngữ chính
Rust
Star
101
Fork
20
Merge trung bình
2 giờ 33 phút
Pull request đã merge (30 ngày)
90

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

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

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 aimdb-dev/aimdb

Tất cả issue của aimdb-dev/aimdb

Issue tương tự

Thêm issue về Rust

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.