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

Aperta Adatta ai principianti
#453 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
82/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
rust
Ambito
api, backend

Direzione di ricerca

Inizia da tools/aimdb-mcp/src/tools/buffer_metrics.rs, nel filtro intorno alla riga 41, quindi confrontalo con la logica corrispondente in tools/aimdb-mcp/src/tools/profiling.rs, intorno alla riga 45. Aggiungi o individua un test per un record la cui chiave è diversa dal nome del suo tipo Rust. Il lavoro è completato quando get_buffer_metrics trova quel record se cercato tramite la sua chiave e il test ha esito positivo.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
Rust
Stelle
101
Fork
20
Merge medio
2h 33m
PR unite (30g)
90

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di aimdb-dev/aimdb

Tutte le issue di aimdb-dev/aimdb

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.