feat(telemetry): bug_causality table + reconstruction job (bo-s1kb)#26
Merged
Conversation
Adds the supervised "risky change" signal for the reconcile/predict loop (GH#9). New bug_causality(bug_id, culprit_sha, culprit_bead_id, file, confidence, created_at) table, populated by a new CLI job. - `bobbin bead reconstruct-causality [--bug <id>] [--limit N]`: for each bug bead, gather the files its fix touched, find the most-recent prior commit touching each file (the candidate culprit), and score confidence by how much of the fix's changeset that commit overlaps. Upserts one row per (bug, culprit_sha, file). - Idempotent via UNIQUE(bug_id, culprit_sha, file) — periodic re-runs refresh confidence rather than duplicate. - Store methods: prior_lineage_touching_files (json_each over touched_files), record_bug_causality (upsert), list_bug_causality, distinct_lineage_bead_ids (bug discovery). - Pure reconstruct_culprits heuristic is unit-tested; store path tested end-to-end against sqlite (json_each, upsert idempotency). - Documents the bead command family in a new cli/bead.md page. SCOPE: v1 is the recency+overlap heuristic. Git-blame sharpening of the exact introducing commit and change_events outcome-labeling (time-to-first-bug) are deferred — change_events has no table yet; flagged to dearing as a design call. Neither blocks the supervised signal. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011y4bHA4rPftj9dPSwi7FvH
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
bo-s1kb — bug_causality table + caused_by reconstruction job (telemetry Phase 0)
Adds the supervised signal for "risky change" in the feature↔code↔bug reconcile/predict loop (GH#9): a
bug_causalitytable reconstructing which prior commit most likely introduced the bug a later bead fixed.Changes
bug_causality(bug_id, culprit_sha, culprit_bead_id, file, confidence, created_at)withUNIQUE(bug_id, culprit_sha, file)for idempotent re-runs.bobbin bead reconstruct-causality [--bug <id>] [--limit N]. For each bug bead: gather the files its fix touched, find the most-recent prior commit touching each file (candidate culprit), and score confidence by how much of the fix's changeset that commit overlaps (concentrated blame ⇒ higher confidence). Upserts one row per(bug, culprit_sha, file).prior_lineage_touching_files(json_each overtouched_files),record_bug_causality(upsert),list_bug_causality,distinct_lineage_bead_ids(bug discovery via the lineagebead_typecolumn, falling back tobd show).cli/bead.mdpage documenting the wholebeadcommand family (link / auto-link / reconstruct-causality / history) + SUMMARY entry.Test
cargo test --bin bobbingreen (852 tests).reconstruct_culpritsheuristic unit-tested (most-recent wins, confidence scales with overlap, unrelated files / empty sha ignored).json_eachlookup, upsert idempotency (re-record refreshes confidence, no dup),distinct_lineage_bead_ids.Scope / design call for dearing
v1 is the recency + file-overlap heuristic over
bead_lineage. Two parts of the original AC are deliberately deferred:change_eventsoutcome labeling (introduced_buglabel + time-to-first-bug) —change_eventshas no table anywhere in the codebase yet; this needs a schema decision before it can be built.Neither blocks the supervised signal this table provides. Flagging #2 as a design call.
Depends on bo-xrsy (#23, merged) for the lineage numstat/symbol fields.
🤖 Generated with Claude Code