feat(tb-bug): add error mutation commands (fix, ignore, discard, snooze)#27
Merged
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds CLI support in tb-bug for mutating Bugsnag error state (fix/ignore/discard/snooze) and wires it to a new PATCH-based API helper that supports single and bulk updates, clearing cached error data after mutations.
Changes:
- Introduces
tb-bug error fix|ignore|discard|snoozesubcommands (includingdiscard --yesconfirmation and snooze rules via duration or event-count). - Adds
BugsnagClient::update_errors+ internalpatch_errorsto call Bugsnag’s PATCH errors endpoint and invalidate cache after successful mutation. - Updates
SKILL.mdto document the new mutation capability.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/tb-bug/src/main.rs | Adds error command routing and argument parsing for fix/ignore/discard/snooze. |
| crates/tb-bug/src/commands/mod.rs | Exposes new error_action command module. |
| crates/tb-bug/src/commands/error_action.rs | Implements mutation command handlers, duration parsing, and discard confirmation. |
| crates/tb-bug/src/api.rs | Adds PATCH-based errors mutation API and cache invalidation on mutation. |
| crates/tb-bug/SKILL.md | Documents new mutation commands in capabilities list. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+514
to
+518
| if error_ids.len() == 1 { | ||
| body.insert("id".into(), serde_json::json!(error_ids[0])); | ||
| } else { | ||
| body.insert("error_ids".into(), serde_json::json!(error_ids)); | ||
| } |
Comment on lines
+513
to
+523
| body.insert("operation".into(), serde_json::json!(operation)); | ||
| if error_ids.len() == 1 { | ||
| body.insert("id".into(), serde_json::json!(error_ids[0])); | ||
| } else { | ||
| body.insert("error_ids".into(), serde_json::json!(error_ids)); | ||
| } | ||
| if let Some(serde_json::Value::Object(extra_map)) = extra { | ||
| for (k, v) in extra_map { | ||
| body.insert(k, v); | ||
| } | ||
| } |
| 'd' | 'D' => 86_400, | ||
| other => return Err(format!("unknown duration unit '{other}' in {input}")), | ||
| }; | ||
| Ok(n * mult) |
| format!("{}s", s) | ||
| } | ||
| } | ||
| SnoozeRule::Events(n) => format!("{} more events", n), |
| } | ||
|
|
||
| /// PATCH a project's error(s). `body` is the raw JSON op payload. | ||
| /// Bugsnag accepts the same endpoint for single (`error_id`) and bulk (`error_ids`). |
- Guard empty error_ids at API level (update_errors) - Merge extra fields before reserved keys so callers can't override operation/id/error_ids - Use checked_mul in parse_duration to prevent silent overflow - Fix singular/plural for event-count snooze description - Fix doc comment: single-error key is 'id', not 'error_id' Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
trogulja
approved these changes
May 2, 2026
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.
Summary
tb-bug error fix|ignore|discard|snoozesubcommands for mutating Bugsnag error statepatch_errorsAPI method handles both single and bulk error updates via Bugsnag's PATCH endpointdiscardrequires--yesconfirmation (or prompts interactively in a TTY) since it permanently drops future eventssnoozeaccepts--for <duration>(e.g.7d,24h,30m) or--events <n>for event-count-based snoozingTest plan
tb-bug error fix --project <name> <error-id>— marks error as fixedtb-bug error ignore --project <name> <error-id>— marks error as ignoredtb-bug error discard --project <name> <error-id>— prompts for confirmation;--yesskips prompttb-bug error snooze --project <name> --for 7d <error-id>— snoozes for 7 daystb-bug error snooze --project <name> --events 10 <error-id>— snoozes until 10 more events🤖 Generated with Claude Code