Skip to content

Bug Dedup Engine

Links duplicate bug reports and similar stack traces.

Industry Level Difficulty Recommended mode
Software engineering 3 of 5 Advanced flat
  • Duplicate bugs waste triage time.
  • Stack traces vary slightly.
  • Flaky tests hide patterns.
  1. Bug texts and traces are embedded.
  2. New bugs retrieve likely duplicates.
  3. Flaky failures cluster.
  4. Batch processing for CI runs.
Today With Bug Dedup Engine on SrvDB
Manual dedup Suggested duplicates
Scattered traces Grouped traces
Flaky noise Clustered flakes
  1. Embed bugs and traces.
  2. Match new ones.
  3. Suggest duplicates.
  4. Cluster flakes.
  5. Close duplicates.
  • True cosine scores: scores in [-1, 1] mean the same in every mode, so thresholds are stable.
  • search_batch: runs many queries at once, in parallel inside Rust.
  • upsert: inserts new items and replaces changed ones, so the knowledge base stays current.
  • Crash-safe persist(): after it returns, data survives a crash or power loss and reopens exactly as committed.
  • Duplicate bugs
  • Crash grouping
  • Flaky tests
  • Log anomalies
  • Support escalations
  • Release triage

embed() is your embedding model (for example sentence-transformers, or a function that turns your records into feature vectors).

import json
import srvdb
db = srvdb.Database("./bug-dedup-engine-db", dimension=384)
def ingest(items):
"""items: list of (id, text, metadata dict)"""
db.upsert(
ids=[i for i, _, _ in items],
embeddings=[embed(t) for _, t, _ in items],
metadatas=[json.dumps(m) for _, _, m in items],
)
db.persist() # crash-safe checkpoint
def likely_duplicates(bug_report, k=5):
hits = db.search(embed(bug_report), k)
return [(json.loads(db.get(i)), round(score, 3)) for i, score in hits]
  • Triage leads confirm duplicates.
  1. Prototype: load a sample of real data with flat mode and check that searches return what an expert expects.
  2. Measure: if you move to an approximate mode, compare its results with flat on the same queries (recall).
  3. Pipeline: add continuous upsert and decide when to call persist().
  4. Harden: test restarts and crashes, add logging, review every output path with domain experts.
  5. Deploy: ship the database directory with the application or service.
Level Project What it does
1 · Beginner Code Search Find code by what it does.
2 · Intermediate Codebase Q&A Ask how the system works and get answers citing files.
3 · Advanced Bug Dedup Engine (this page) Links duplicate bug reports and similar stack traces.
4 · Expert Coding Agent Memory Long-term, crash-safe memory for autonomous coding agents.
5 · Frontier Air-gapped Dev Copilot A self-hosted developer assistant for isolated environments.

See also: Use cases · Live examples (coming soon)