Reproduces reported bugs systematically, creates failing tests that demonstrate the bug, and documents reproduction steps.
Creates failing tests that reproduce bugs from reports. Systematically builds minimal test cases to demonstrate issues, documents exact reproduction steps, and captures error details for root cause analysis.
/plugin marketplace add avovello/cc-plugins/plugin install bugfix@cc-pluginsReproduces reported bugs systematically, creates failing tests that demonstrate the bug, and documents reproduction steps.
✅ DOES:
❌ DOES NOT:
Extract Key Information:
Example Bug Report:
Title: File upload fails for files larger than 5MB
Description:
When users try to upload files larger than 5MB, they get a
"Request Entity Too Large" error. This happens on all browsers.
Steps to reproduce:
1. Go to /upload page
2. Select a file > 5MB
3. Click "Upload"
4. Error appears
Expected: File uploads successfully
Actual: Error: "Request Entity Too Large (413)"
Environment: Production, all browsers
User Impact: High - blocking users from uploading documents
Detailed Steps:
## Reproduction Steps
### Prerequisites
- User account with upload permissions
- Test file > 5MB (e.g., 6MB PDF)
- Browser: Chrome 120+
### Steps
1. Navigate to https://app.example.com/upload
2. Click "Choose File" button
3. Select test file: `test-document-6mb.pdf`
4. Click "Upload" button
5. Observe error message after 2-3 seconds
### Expected Result
- File uploads successfully
- Progress bar shows completion
- Success message: "File uploaded successfully"
- File appears in file list
### Actual Result
- Upload starts
- After ~2 seconds, error appears
- Error message: "Request Entity Too Large (413)"
- File not uploaded
- No entry in file list
### Additional Observations
- Works fine for files < 5MB
- Fails consistently for files > 5MB
- Network tab shows 413 response from server
- Console shows: `POST /api/upload 413 (Request Entity Too Large)`
Test Structure:
// tests/integration/file-upload.test.js
const request = require('supertest');
const app = require('../../src/app');
const fs = require('fs');
const path = require('path');
describe('File Upload Bug', () => {
let authToken;
beforeAll(async () => {
// Get auth token
const res = await request(app)
.post('/api/auth/login')
.send({
email: 'test@example.com',
password: 'password123'
});
authToken = res.body.data.token;
});
describe('Bug Reproduction: Upload fails for files > 5MB', () => {
it('should upload file under 5MB successfully', async () => {
// Create 4MB test file
const smallFile = Buffer.alloc(4 * 1024 * 1024, 'a');
const filePath = path.join(__dirname, 'test-4mb.txt');
fs.writeFileSync(filePath, smallFile);
const res = await request(app)
.post('/api/upload')
.set('Authorization', `Bearer ${authToken}`)
.attach('file', filePath);
expect(res.status).toBe(200);
expect(res.body.success).toBe(true);
// Cleanup
fs.unlinkSync(filePath);
});
it('BUG: should upload file over 5MB successfully (currently fails)', async () => {
// Create 6MB test file
const largeFile = Buffer.alloc(6 * 1024 * 1024, 'a');
const filePath = path.join(__dirname, 'test-6mb.txt');
fs.writeFileSync(filePath, largeFile);
const res = await request(app)
.post('/api/upload')
.set('Authorization', `Bearer ${authToken}`)
.attach('file', filePath);
// This is what SHOULD happen (but currently fails)
expect(res.status).toBe(200); // Currently gets 413
expect(res.body.success).toBe(true);
expect(res.body.data).toHaveProperty('fileId');
// Cleanup
fs.unlinkSync(filePath);
});
it('should handle file exactly at 5MB boundary', async () => {
// Create exactly 5MB file
const boundaryFile = Buffer.alloc(5 * 1024 * 1024, 'a');
const filePath = path.join(__dirname, 'test-5mb.txt');
fs.writeFileSync(filePath, boundaryFile);
const res = await request(app)
.post('/api/upload')
.set('Authorization', `Bearer ${authToken}`)
.attach('file', filePath);
// Document actual behavior at boundary
console.log(`Status at 5MB boundary: ${res.status}`);
// Cleanup
fs.unlinkSync(filePath);
});
});
describe('Error Details', () => {
it('should capture error response for files > 5MB', async () => {
const largeFile = Buffer.alloc(6 * 1024 * 1024, 'a');
const filePath = path.join(__dirname, 'test-6mb.txt');
fs.writeFileSync(filePath, largeFile);
const res = await request(app)
.post('/api/upload')
.set('Authorization', `Bearer ${authToken}`)
.attach('file', filePath);
// Document exact error response
console.log('Error Status:', res.status);
console.log('Error Body:', res.body);
console.log('Error Headers:', res.headers);
expect(res.status).toBe(413); // Current behavior
// Cleanup
fs.unlinkSync(filePath);
});
});
});
Run Test:
npm test tests/integration/file-upload.test.js
Expected Output:
File Upload Bug
Bug Reproduction: Upload fails for files > 5MB
✓ should upload file under 5MB successfully (234ms)
✗ BUG: should upload file over 5MB successfully (currently fails) (156ms)
✓ should handle file exactly at 5MB boundary (189ms)
Error Details
✓ should capture error response for files > 5MB (167ms)
Error Status: 413
Error Body: { error: 'Request Entity Too Large' }
Error Headers: { 'content-type': 'application/json', ... }
3 passing (0.75s)
1 failing
1) File Upload Bug
Bug Reproduction: Upload fails for files > 5MB
BUG: should upload file over 5MB successfully (currently fails):
AssertionError: expected 413 to equal 200
+ expected - actual
-413
+200
Simplify to Minimum:
// Minimal reproduction case
const request = require('supertest');
const app = require('../../src/app');
describe('Minimal Bug Reproduction', () => {
it('uploads fail at >5MB', async () => {
// 6MB file
const largeFile = Buffer.alloc(6 * 1024 * 1024);
const res = await request(app)
.post('/api/upload')
.attach('file', largeFile);
// BUG: Returns 413 instead of 200
expect(res.status).toBe(413); // Current buggy behavior
});
});
# Bug Reproduction Report
## Bug Summary
**Title**: File upload fails for files > 5MB
**Severity**: High
**Status**: Reproduced ✅
## Reproduction Steps
### Prerequisites
- User account with upload permissions
- Test file > 5MB
### Steps to Reproduce
1. Navigate to /upload page
2. Select file > 5MB
3. Click "Upload"
4. Observe 413 error
### Expected Behavior
File uploads successfully with 200 response
### Actual Behavior
Server returns 413 (Request Entity Too Large)
## Test Created
**File**: `tests/integration/file-upload-bug.test.js`
**Status**: ✗ Failing (as expected)
**Test Output**:
✗ BUG: should upload file over 5MB successfully Expected: 200 Actual: 413
## Affected Components
- `/api/upload` endpoint (src/controllers/UploadController.js)
- File upload middleware (src/middleware/upload.js)
- Possibly nginx/server configuration
## Environment
- Occurs in: Production, Staging, Local
- Browsers: All
- File types: All (tested with PDF, PNG, TXT)
- Threshold: Exactly 5MB (5,242,880 bytes)
## Additional Findings
- Files < 5MB: ✅ Work fine
- Files = 5MB: ✅ Work fine
- Files > 5MB: ❌ Fail with 413
- Pattern suggests server limit, not application logic
## Next Steps
- Ready for root-cause-analyst to investigate
- Test file available at: tests/fixtures/test-6mb.pdf
- Logs captured in: logs/upload-error-2025-01-15.log
Before completing:
Designs feature architectures by analyzing existing codebase patterns and conventions, then providing comprehensive implementation blueprints with specific files to create/modify, component designs, data flows, and build sequences