Repository navigation
feat: Implement Structured JSON Findings and Risk Heatmap - #1
Conversation
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]>
|
👋 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 New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
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:
src/agents/,src/findings.py): Defined and validated strict JSON shapes requested by the LLM prompts. Implemented graceful normalizations for potential LLM structure deviations.src/graph.py,src/state.py): Wired in a new QualityAgent as a parallel worker alongside Security and Performance agents.src/findings.py,backend/app/main.py): Builtcompute_risk_scorefunction with a robust weight calculation. Emits SSErisk_updatetokens to stream visual cues onto the React client.frontend/): Overhauled result parsing andIssueCardcomponents. 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.pyfrontend/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.tsxsrc/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.pyValidation Results:
pytest).npm run build,npm run lint).Known Limitations:
llama3.2) to follow prompt instructions exactly. Even withnormalize_findingsfallback wrappers, extensive model hallucinations could omit structured keys.PR created automatically by Jules for task 9925590245072584684 started by @urumb