Skip to content

feat: Implement Structured JSON Findings and Risk Heatmap - #1

Merged
urumb merged 1 commit into
mainfrom
jules-9925590245072584684-24d30b3e
Jun 25, 2026
Merged

urumb merged 1 commit into
mainfrom
jules-9925590245072584684-24d30b3e

Conversation

@urumb

@urumb urumb commented Jun 25, 2026

Copy link
Copy Markdown
Owner

Transitioning the multi-agent code auditor from plain text/markdown reports to a structured JSON findings pipeline. Calculates per-file risk scores and updates the frontend results page to elegantly display actionable, formatted findings without exposing raw LLM outputs.

Summary of Changes:

  • Backend Setup (src/agents/, src/findings.py): Defined and validated strict JSON shapes requested by the LLM prompts. Implemented graceful normalizations for potential LLM structure deviations.
  • Agent Integrations (src/graph.py, src/state.py): Wired in a new QualityAgent as a parallel worker alongside Security and Performance agents.
  • Risk System (src/findings.py, backend/app/main.py): Built compute_risk_score function with a robust weight calculation. Emits SSE risk_update tokens to stream visual cues onto the React client.
  • Frontend Refinement (frontend/): Overhauled result parsing and IssueCard components. Enabled features like suggested code copy utilities, before/after rendering blocks, CWE pills, and top repository risk tables across tabs. Fixed existing linting warnings and typings.

Files Modified:

  • backend/app/main.py, backend/app/schemas/code_file.py, backend/app/services/audit_runner.py
  • frontend/app/results/page.tsx, frontend/components/results/issue-card.tsx, frontend/lib/api.ts, frontend/types/index.ts, frontend/components/dashboard/metric-card.tsx, frontend/components/layout/header.tsx
  • src/agents/manager.py, src/agents/performance.py, src/agents/quality.py, src/agents/reviewer.py, src/agents/security.py, src/graph.py, src/state.py, src/findings.py (added)
  • tests/test_execution_planner.py

Validation Results:

  • Backend tests pass (pytest).
  • Frontend builds and passes lints cleanly (npm run build, npm run lint).
  • Playwright-based frontend visual verifications run cleanly, capturing complete application flows and successful JSON audit results.

Known Limitations:

  • A reliance on strict JSON generation requires competent LLMs (like llama3.2) to follow prompt instructions exactly. Even with normalize_findings fallback wrappers, extensive model hallucinations could omit structured keys.

PR created automatically by Jules for task 9925590245072584684 started by @urumb

This commit transitions the Multi-Agent Code Auditor from generating plain Markdown reports to generating rich, structured JSON-based reports.

Features included:
1. **Agent Prompts**: All analyzer agents (Security, Performance, and the newly added Quality agent) now output specific JSON structures encompassing severity, explanations, suggested fixes, before/after snippets, and CWE identifiers.
2. **Quality Agent Integration**: Introduced a new agent inside the LangGraph pipeline, updating `src/graph.py` and `src/state.py` to route and store its results.
3. **Risk Scoring**: Developed a `compute_risk_score` helper to evaluate aggregated findings. The total risk logic accounts for variable severities and agent weights, emitting a score that surfaces to the user.
4. **Backend Streaming & Normalization**: Extended background tasks to emit file `risk_update` events via SSE to support real-time frontend heatmaps. The Reviewer agent normalizes its aggregated payload safely, falling back gracefully on parse failures without breaking the application logic or exposing raw text chunks to the client.
5. **Frontend Support**: Adapted frontend types (`types/index.ts`) and API interfaces (`lib/api.ts`) for JSON-based structures. Result pages now dynamically construct and visualize individual files, Top Risk Files, CWE, Before/After views, and interactive "Copy Fix" actions across tabs.

All modified and related code paths pass strict static typing, ESLint checks (`npm run lint`), TypeScript build pipelines (`npm run build`), and Python backend unit tests (`pytest`).

Co-authored-by: urumb <[email protected]>
@google-labs-jules

Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@urumb
urumb merged commit 694ea20 into main Jun 25, 2026
@urumb
urumb deleted the jules-9925590245072584684-24d30b3e branch July 23, 2026 06:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant