The validation feature allows users to validate whether they have successfully fixed security issues or implemented monitoring recommendations after copying the Claude Code prompts. This feature uses OpenAI GPT-4o mini to intelligently analyze the updated code and provide validation results.
- Validate Security Fixes: Check if security vulnerabilities have been properly resolved
- Validate Monitoring Implementations: Verify that monitoring/tracking code has been correctly implemented
- Credits-based System: Each validation costs 1 credit
- Credit Management: Same credit flow as analysis (check, consume, refund on error)
- Real-time Status: Live validation status indicators on findings
- Detailed Results: Comprehensive validation reports with pass/fail status and recommendations
- User analyzes a repository (costs 5 credits)
- Receives security issues and/or monitoring recommendations
- Each finding shows a "Validate Fix" button
- User copies the Claude Code prompt from a finding
- Goes to their development environment
- Uses the prompt to fix the security issue or implement monitoring
- Returns to VibeCheck to validate the fix
- User clicks "Validate Fix" button (costs 1 credit)
- System checks if user has enough credits
- If insufficient credits: Shows dialog to purchase more
- If sufficient credits: Proceeds with validation
- Fetches updated code from the repository
- Sends code to OpenAI for AI-powered validation
- Displays validation result with detailed feedback
- ✅ Passed: Fix is complete and properly implemented
- ❌ Failed: Issue persists or implementation is incomplete
- Shows list of remaining issues
- Provides recommendations for next steps
⚠️ Error: Validation encountered an error- Credit is automatically refunded
enum ValidationStatus {
notStarted, // Default state
validating, // Currently validating
passed, // Validation successful
failed, // Validation failed
error, // Validation error occurred
}class ValidationResult {
String id;
ValidationStatus status;
DateTime timestamp;
String? summary; // Brief result summary
String? details; // Detailed explanation
List<String>? remainingIssues; // If failed
String? recommendation; // Next steps if failed
}Both SecurityIssue and MonitoringRecommendation now include:
ValidationStatus validationStatus; // Current validation state
ValidationResult? validationResult; // Last validation resultOrchestrates the validation process:
- Credit checking and consumption
- Repository code fetching
- OpenAI API integration
- Error handling and credit refunds
Key methods:
validateSecurityFix()- Validates security issue fixesvalidateMonitoringImplementation()- Validates monitoring implementationscanValidate()- Checks if user has enough credits
New validation methods:
validateSecurityFix()- AI-powered security fix validationvalidateMonitoringImplementation()- AI-powered monitoring validation
Validation prompts include:
- Original issue/recommendation details
- Updated code from repository
- Specific validation checklist
- Request for structured JSON response
Manages validation state and operations:
- Handles validation requests
- Updates analysis results with validation data
- Shows appropriate UI feedback (snackbars, dialogs)
- Manages insufficient credits flow
Displays validation status with color coding:
- Grey: Not validated
- Blue: Validating...
- Green: Passed
- Red: Failed
- Orange: Error
Shows detailed validation results:
- Status icon and title
- Validation timestamp
- Summary and details
- Remaining issues (if failed)
- Recommendations (if failed)
IssueCard- Added "Validate Fix" button and result displayRecommendationCard- Added "Validate Implementation" button and result display
- 1 credit per validation
- Same as the user journey: check → consume → validate → refund on error
- User clicks "Validate Fix"
- System detects insufficient credits
- Shows dialog:
- "You need 1 credit to validate..."
- "Cancel" button
- "Buy Credits" button (navigates to /credits)
If validation fails due to system error:
- 1 credit is automatically refunded
- Error message is displayed
- User can retry
System Prompt:
- Acts as security expert
- Analyzes updated code for security improvements
- Returns structured JSON with pass/fail status
Validation Checklist:
- Vulnerable code pattern removed/fixed
- Fix addresses root cause (not just symptoms)
- No new security issues introduced
- Follows security best practices
Response Format:
{
"status": "passed" | "failed",
"summary": "Brief validation summary",
"details": "Detailed explanation",
"remainingIssues": ["Issue 1", "Issue 2"], // If failed
"recommendation": "What to do next" // If failed
}System Prompt:
- Acts as observability expert
- Verifies monitoring code is properly implemented
- Returns structured JSON with validation result
Validation Checklist:
- Monitoring/tracking code added
- Captures recommended metrics/events
- Proper instrumentation for business value
- Follows monitoring best practices
Response Format: Same as security validation
User clicks "Validate Fix"
↓
Check credits (1 required)
↓
Consume 1 credit
↓
Update finding status to "validating"
↓
Fetch updated repository code
↓
Send to OpenAI for validation
↓
Parse validation result
↓
Update finding with validation result
↓
Save to storage (persists across sessions)
↓
Display validation result to user
Validation error occurs
↓
Refund 1 credit to user
↓
Update finding status to "error"
↓
Create error ValidationResult
↓
Show error message to user
Validation results are stored with the analysis result:
- Encrypted using the same encryption as analysis data
- Persisted in local storage (SharedPreferences)
- Survives app restarts
- Synced across devices for authenticated users
- Status Badges: Color-coded badges show validation status at a glance
- Progress Indicators: Circular progress during validation
- Result Cards: Detailed, color-coded result displays
- Snackbars: Success/error notifications
- Not Validated: "Validate Fix (1 credit)"
- Previously Validated: "Re-validate Fix (1 credit)"
- Validating: "Validating Fix..." (disabled, shows spinner)
All validation UI components are fully responsive:
- Desktop: Optimal layout with full details
- Tablet: Adjusted spacing and sizing
- Mobile: Stacked layout, touch-friendly buttons
The implementation maximizes code reuse:
- Single ValidationService: Handles both security and monitoring validation
- Shared UI Components: Same badge and result display for both types
- Consistent Credit Flow: Reuses existing credits_service.dart
- Unified State Management: Single validation_provider.dart
- Common OpenAI Integration: Extends existing openai_service.dart
Potential improvements for future versions:
- Batch Validation: Validate multiple findings at once
- Validation History: Track validation attempts over time
- Comparison View: Show before/after code diff
- Custom Validation Rules: Allow users to define validation criteria
- Validation Reports: Export validation results as PDF
- AI Suggestions: Get AI-powered fix suggestions if validation fails
- Integration Tests: Run automated tests as part of validation
- Validation Metrics: Track validation success rates
- ValidationService credit checking logic
- OpenAI prompt construction
- ValidationResult parsing
- Credit refund scenarios
- Complete validation flow (end-to-end)
- Insufficient credits dialog
- Storage persistence
- Error handling and refunds
- Validation button states
- Status badge rendering
- Result display formatting
- Responsive layout
- API Key Protection: OpenAI API key securely configured
- Input Validation: Repository URLs validated before fetching
- Rate Limiting: Prevent abuse through credit system
- Data Encryption: Validation results encrypted in storage
- No Code Execution: Analyzed code is never executed
- Streaming: Large code files streamed to avoid memory issues
- Caching: Repository code cached during analysis
- Async Operations: All I/O operations use async/await
- Timeout Handling: 60s timeout for OpenAI requests
- Retry Logic: Exponential backoff for transient failures
The validation feature provides a complete end-to-end solution for users to validate their code fixes and implementations. It seamlessly integrates with the existing credit system, provides intelligent AI-powered validation, and maintains the high-quality user experience of the VibeCheck app.
Key Benefits:
- ✅ Validates fixes work correctly before deployment
- ✅ Saves development time with AI-powered feedback
- ✅ Provides confidence in security improvements
- ✅ Ensures monitoring is properly implemented
- ✅ Cost-effective at 1 credit per validation
- ✅ Fully integrated with existing app architecture