test : add unit tests for _build_triage_prompt helper in triage_engine

Aperta
#2,258 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

  • #2263 di @tmdeveloper007 — chiusa senza merge

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
fastapi, python
Ambito
ai, security, testing

Direzione di ricerca

Read backend/secuscan/triage_engine.py and locate _build_triage_prompt, then review existing triage_finding tests for test conventions. Add testing/backend/unit/test_triage_engine_prompt.py with the listed field, special-character, normal-input, and variable-format cases. Run the new unit test file; done when it directly covers these cases and passes.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Summary of What Needs to be Done:
Write direct unit tests for the _build_triage_prompt function in backend/secuscan/triage_engine.py. This pure function builds the LLM prompt for SAST finding triage. It is currently only exercised indirectly through triage_finding integration tests but has no dedicated unit tests covering its output format and edge cases.

Changes that Need to be Made:
Create a new file: testing/backend/unit/test_triage_engine_prompt.py

Import _build_triage_prompt from backend.secuscan.triage_engine and test:

  • Empty and None fields in the finding dict (title, category, severity, description)
  • Empty and None fields in the context dict (snippet, variables, file, line)
  • Mixed content with special characters
  • Normal finding with all fields populated
  • Variables list formatting

Impact that it would Provide:
Direct unit tests catch regressions in prompt format. Testing edge cases (missing fields) ensures the LLM always receives a well-formed prompt even with malformed finding data. Improves reliability of the AI-assisted triage feature.

Note: This task is being handled by tmdeveloper007 — please assign to that account when picking it up.

Lingua principale
Python
Stelle
36
Fork
234
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di utksh1/SecuScan

Tutte le issue di utksh1/SecuScan

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.