Summary of What Needs to be Done:
Add unit tests for the _build_triage_prompt() helper function in backend/secuscan/triage_engine.py. This private function constructs the prompt string passed to the LLM when triaging a SAST finding. It formats the finding title, category, severity, description, code context, and variables into a structured prompt.
The existing test file testing/backend/unit/test_triage_engine.py tests extract_code_context, is_eligible_for_triage, triage_finding, and triage_findings, but _build_triage_prompt is not directly imported or tested.
Changes that Need to be Made:
In testing/backend/unit/test_triage_engine.py:
- Import
_build_triage_prompt from backend.secuscan.triage_engine
- Test that the prompt includes the finding title
- Test that the prompt includes the finding category
- Test that the prompt includes the severity
- Test that the prompt includes the description
- Test that the prompt includes the code snippet from context
- Test that the prompt includes variable hints
- Test that missing/None values fall back to defaults like "Untitled finding", "(no source snippet available)", "(none identified)"
- Test that the prompt ends with the response format instructions (JSON object requirements)
- Test that the prompt is a pure function (same inputs always produce same output)
Impact that it would Provide:
- Directly tests the prompt construction logic without needing a mock LLM
- Ensures the LLM receives well-formed prompts with all required fields
- Catches regressions if the prompt template changes
Note: This task is being handled by tmdeveloper007 — please assign to that account when picking it up.
Summary of What Needs to be Done:
Add unit tests for the
_build_triage_prompt()helper function inbackend/secuscan/triage_engine.py. This private function constructs the prompt string passed to the LLM when triaging a SAST finding. It formats the finding title, category, severity, description, code context, and variables into a structured prompt.The existing test file
testing/backend/unit/test_triage_engine.pytestsextract_code_context,is_eligible_for_triage,triage_finding, andtriage_findings, but_build_triage_promptis not directly imported or tested.Changes that Need to be Made:
In
testing/backend/unit/test_triage_engine.py:_build_triage_promptfrombackend.secuscan.triage_engineImpact that it would Provide:
Note: This task is being handled by tmdeveloper007 — please assign to that account when picking it up.