| name | fix-integration-bug |
| description | Workflow for fixing bugs in Ruby SDK integrations. Covers reproducing the bug, using appraisals, adding test cases, and TDD-based fixes. |
Fixing Integration Bugs
This skill is for fixing bugs in existing integrations. Follow this workflow to reproduce, test, and fix integration issues.
1. Reproduce the Bug
First, understand and reproduce the issue:
BRAINTRUST_ENABLE_TRACE_CONSOLE_LOG=true bundle exec appraisal provider ruby examples/provider.rb
BRAINTRUST_ENABLE_TRACE_CONSOLE_LOG=true bundle exec appraisal provider ruby -e '
require "braintrust"
# minimal reproduction code
'
2. Appraisal Commands
Test against specific gem versions:
bundle exec appraisal install
bundle exec appraisal provider rake test
bundle exec appraisal provider rake test TEST=test/braintrust/trace/provider_test.rb
bundle exec appraisal provider rake test[12345]
bundle exec appraisal rake test
VCR_MODE=all bundle exec appraisal provider rake test
3. Add Failing Test Case
Write a test that reproduces the bug:
def test_bug_description
end
4. Add Example Case (if applicable)
Add a case to the internal example that exercises the buggy code path:
- Location:
examples/internal/provider.rb
- Purpose: Demonstrates the fix works end-to-end
- Follow existing example patterns (nest under root span, print output)
5. TDD Fix Cycle
- Run failing test:
bundle exec appraisal provider rake test
- Implement minimal fix in
lib/braintrust/trace/contrib/provider.rb
- Run tests again (should pass)
- Lint:
bundle exec rake lint:fix
- Run all appraisals:
bundle exec appraisal rake test
6. Verify with MCP
Query traces to confirm the fix:
mcp__braintrust__btql_query(query: "SELECT input, output, metrics FROM project_logs LIMIT 5")
Reference Files
- Integrations:
lib/braintrust/trace/contrib/{openai,anthropic,ruby_llm}.rb
- Tests:
test/braintrust/trace/{openai,anthropic,ruby_llm}_test.rb
- Examples:
examples/internal/{openai,anthropic,ruby_llm}.rb
- VCR cassettes:
test/fixtures/vcr_cassettes/provider/