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

未关闭 适合新手
#453 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
82/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
rust
领域
api, backend

调研方向

先查看 tools/aimdb-mcp/src/tools/buffer_metrics.rs 中第 41 行附近的筛选逻辑,再将其与 tools/aimdb-mcp/src/tools/profiling.rs 中第 45 行附近对应的逻辑进行比较。为键名与其 Rust 类型名不同的记录添加或查找一个测试。完成标准是:按键查询时,get_buffer_metrics 能找到该记录,且测试通过。

由索引模型根据 Issue 内容生成。

描述

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.

主要语言
Rust
星标
101
派生
20
平均合并
2 小时 33 分钟
30 天内合并 PR
90

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

aimdb-dev/aimdb 的其他 Issue

查看 aimdb-dev/aimdb 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。