test : add unit tests for _build_triage_prompt helper in triage_engine

Abierto
#2,258 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

  • #2263 de @tmdeveloper007 — cerrado sin fusionar

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
35/100
Tipo de issue
Nueva funcionalidad
Claridad
Bien especificado
Estado de actividad
Estancado
Stack tecnológico
fastapi, python
Área
ai, security, testing

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
Python
Estrellas
36
Forks
234
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de utksh1/SecuScan

Todos los issues de utksh1/SecuScan

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.