test : add unit tests for _build_triage_prompt helper in triage_engine

オープン
#2,258 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

  • #2263 @tmdeveloper007 による — マージされずにクローズ

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
fastapi, python
領域
ai, security, testing

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Python
スター
36
フォーク
234
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

utksh1/SecuScan のほかの issue

utksh1/SecuScan の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。