feat: persist patch outcomes across generation and verification stages#238
feat: persist patch outcomes across generation and verification stages#238mithaliphadtare wants to merge 1 commit into
Conversation
|
🎉 Thank you @mithaliphadtare for submitting a Pull Request! We're excited to review your contribution. Before Review✅ Ensure all CI checks pass ⚡ Want faster reviews and contributor support? Join our Discord community: 🔗 https://discord.gg/FcXuyw2Rs Maintainers and mentors are active there and can help resolve blockers quickly. Happy Contributing! 🚀 |
|
Correct PR TemplatePlease copy and paste the raw template below into your PR description and fill it out: > **Before opening:** make sure there is an issue tracking this work, and link it below. PRs without a linked issue may be closed without review.
## Linked issue
Closes #
## What this PR does
## Type of change
- [ ] Bug fix
- [ ] New feature
- [ ] ML model / training pipeline
- [ ] Refactor (no behaviour change)
- [ ] Documentation
- [ ] Tests only
## ML tier (if applicable)
- [ ] Tier 1 — Triage
- [ ] Tier 2 — Predictive
- [ ] Tier 3 — Autonomous
- [ ] Not ML-related
## Stack affected
- [ ] Backend
- [ ] Frontend
- [ ] Both
---
## Changes
### Backend
-
### Frontend
-
### New dependencies
-
### Database / schema changes
-
---
## Testing
**How did you test this?**
**Checklist**
- [ ] Tested locally end-to-end (upload ZIP or GitHub URL → scan → findings returned correctly)
- [ ] New ML model falls back gracefully when model file is absent
- [ ] No new `console.error` or unhandled Python exceptions introduced
- [ ] Added or updated tests where applicable
- [ ] `requirements.txt` / `package.json` updated if new dependencies added
- [ ] New model files (`.pkl`, `.pt`, etc.) are gitignored, not committed
---
## Anything reviewers should focus on
## Screenshots (if UI changed)
|
|
@mithaliphadtare , Do fix template and CI fails. |
Linked issue
Closes #192
What this PR does
This pull request introduces the patch_outcomes database table and hooks it directly into the /fix and /verify endpoints to accurately track the performance of generated patches. As highlighted in the issue, the pipeline previously lacked a persistent mechanism to link an AI-generated fix with its subsequent validation results. By logging the model details, job metadata, and pass/fail outcomes across both lifecycle stages, this change enables data-driven evaluation of patch reliability and model effectiveness.
Type of change
ML tier (if applicable)
Stack affected
Changes
Backend
Meaningful Backend Changes
Database Schema Extension: Added the patch_outcomes table to the SQLite initialization script to store unique patch IDs, associated job and finding IDs, the LLM model name, prompt token usage, validation statuses, and timestamps.
Database Utility Functions (backend/app/db.py):
Implemented insert_patch_outcome to asynchronously record metadata whenever an LLM generates a fix.
Implemented update_patch_verification to asynchronously update the validation success status (passed) and verification timestamp of an existing patch record.
3.API Integration (backend/app/main.py):
Updated the /fix endpoint to generate unique tracking UUIDs and asynchronously invoke insert_patch_outcome for each requested fix.
Updated the /verify endpoint to dynamically invoke update_patch_verification, persisting whether the specific patch passed or failed validation.
Database & Schema Changes
This change introduces a new database schema definition to persistently track the lifecycle of AI-generated fixes. Since the application handles schema generation on startup, the initialization setup was updated without needing a separate migration script.
New Table: patch_outcomes
Testing
How did you test this?
The changes were verified using an end-to-end integration test running the backend locally against an SQLite database instance.
1. Test Setup
2. Execution & Observations
Checklist
console.erroror unhandled Python exceptions introducedrequirements.txt/package.jsonupdated if new dependencies added.pkl,.pt, etc.) are gitignored, not committed