Skip to content

feat: add fix confidence indication #198

Open
tejashwanii wants to merge 1 commit into
ionfwsrijan:mainfrom
tejashwanii:feat/fix-confidence-indicator
Open

feat: add fix confidence indication #198
tejashwanii wants to merge 1 commit into
ionfwsrijan:mainfrom
tejashwanii:feat/fix-confidence-indicator

Conversation

@tejashwanii

@tejashwanii tejashwanii commented Jun 25, 2026

Copy link
Copy Markdown

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 #182

What this PR does

Surfaces fix confidence scores in the UI so users know which fixes to apply first. Adds a reusable confidence indicator component that displays:

  • A colored progress bar (green ≥70%, orange 40–69%, red <40%)
  • A percentage value
  • A tooltip: "Model predicts X% chance this fix passes verification"
  • A placeholder bar when confidence is null/unavailable

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

  • Added fix_confidence: Optional[float] = None field to Fix model in backend/app/models.py
  • Populated demo fix_confidence values in backend/app/remediation/engine.py:
    • osv fixes: 0.65 (orange)
    • semgrep fixes: 0.82 (green)
    • gitleaks fixes: null (placeholder)
    • unsupported fixes: 0.25 (red)

Frontend

  • Created new reusable FixConfidence component in frontend/src/app/components/fix-confidence.tsx:
    • Accepts confidence (number | null | undefined)
    • Renders colored bar with percentage and tooltip
    • Shows placeholder bar for null confidence
  • Updated Fix page (frontend/src/app/pages/fix.tsx):
    • Imported FixConfidence component
    • Added demo fix_confidence values to all 4 demo fixes (covering all color states)
    • Renders confidence indicator next to action buttons

New dependencies

  • None

Database / schema changes

  • None

Testing

How did you test this?

  • Built frontend with npm run build → no errors
  • Verified component renders all four states locally:
    • Green bar (92%)
    • Orange bar (56%)
    • Red bar (30%)
    • Placeholder bar (N/A)
  • Tested tooltip on hover
  • Backend server running on http://127.0.0.1:8000
  • Frontend dev server running (port 5174)

Checklist

  • Tested locally end-to-end (Fix page displays confidence bars for demo fixes)
  • No new console.error or unhandled Python exceptions introduced
  • Added reusable component with fallback for null confidence
  • Added or updated tests where applicable (demo-based for now)
  • requirements.txt / package.json updated if new dependencies added (none added)
  • No new model files committed

Anything reviewers should focus on

  • The FixConfidence component is reusable and can be displayed in other parts of the UI (e.g., Findings detail view) by calling fix() API on-demand
  • Backend populates fix_confidence for all proposed fixes; production should replace demo heuristics with real model outputs
  • Confidence thresholds (70% green, 40% orange, <40% red) can be adjusted in the component's color logic

Screenshots (if UI changed)

Proposed Fixes page with confidence indicators:

  • Green bar (92%): "Fix SQL Injection in user query"
  • Orange bar (56%): "Update Express to 4.19.2"
  • Red bar (30%): "Rotate leaked secret"
  • Placeholder (N/A): "Manual review required"

Each row shows the confidence bar to the right of the action buttons. Hovering over the bar displays the tooltip.

@github-actions

Copy link
Copy Markdown

🎉 Thank you @tejashwanii for submitting a Pull Request!

We're excited to review your contribution.

Before Review

✅ Ensure all CI checks pass
✅ Complete the PR template
✅ Link the related issue

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! 🚀

@github-actions

Copy link
Copy Markdown

⚠️ Automated Check: This PR does not strictly follow the required template. Please ensure you have not deleted any checkboxes or mandatory headings, and that you have written explanations under What this PR does and How did you test this?.

Correct PR Template

Please 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)

@tejashwanii tejashwanii changed the title feat: add fix confidence indication #182 feat: add fix confidence indication Jun 25, 2026
@tejashwanii tejashwanii changed the title #182 feat: add fix confidence indication #182 feat: add fix confidence indication #182 Jun 25, 2026
@tejashwanii tejashwanii changed the title #182 feat: add fix confidence indication #182 feat: add fix confidence indication Jun 25, 2026
@arpit2006

Copy link
Copy Markdown
Collaborator

@tejashwanii , Do Fix Template issue then only it will go under mentor review!

@arpit2006 arpit2006 added the Medium Medium difficulty label Jun 25, 2026
@github-actions github-actions Bot added backend Backend issues feature New feature frontend Frontend issues labels Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Show fix confidence in the frontend

2 participants