Overview
When validation detects issues in generated code, Synapse’s self-correction system automatically attempts to fix them without manual intervention.The Self-Correction Loop
Success Rates
| Attempt | Success Rate | Avg Score |
|---|---|---|
| Initial | 13% | 87/100 |
| Attempt 1 | 87% | 93/100 |
| Attempt 2 | 97% | 96/100 |
| Attempt 3 | 99% | 98/100 |
Common Corrections
Import Path Fixes
- Before
- After
GraphQL Query Corrections
- Before
- After
Hook Usage Fixes
- Before
- After
How It Works
1. Issue Analysis
When validation fails, Synapse extracts specific issues:2. Correction Prompt
Synapse creates a targeted correction prompt:3. Intelligent Fixing
The AI understands context and makes precise fixes:Pattern Recognition
Pattern Recognition
Recognizes common Shopify patterns and applies standard fixes
- Import paths: Adds
/checkout,/admin,/posas appropriate - GraphQL: Uses Shopify’s schema to find correct field paths
- Hooks: Moves to top level and restructures conditionals
- Props: Matches TypeScript definitions
Context Preservation
Context Preservation
Maintains the original intent and structure
- Keeps variable names
- Preserves logic flow
- Maintains comments
- Retains error handling
Multi-Issue Handling
Multi-Issue Handling
Fixes multiple issues simultaneously
- Prioritizes critical errors
- Groups related fixes
- Avoids creating new issues
- Validates dependencies between fixes
Example Self-Correction Session
Original Generation
- Import path missing
/checkout cart.totalPricedoesn’t existstatusprop should betone
After Attempt 1
When Self-Correction Fails
If self-correction doesn’t reach a score of 90 after 3 attempts:- User Notification: You’re informed of the persistent issues
- Partial Deployment: Code can still be deployed if score ≥ 75
- Manual Review: Recommended for scores < 75
- Support Escalation: Complex issues are flagged for team review
Manual Intervention
You can always view and edit the generated code:Configuration
You can adjust self-correction behavior:Best Practices
Write Clear Prompts
Specific prompts lead to better initial code and fewer corrections
Review Corrections
Check what was changed to learn and improve future prompts
Report Patterns
If the same issue repeats, let us know to improve the system
Use Validation
Always validate before deploying, even with high scores