Skip to content

test: cover the grounding guardrail branches - #16

Merged
devops-thiago merged 1 commit into
mainfrom
test/guardrail-coverage
Jul 23, 2026
Merged

test: cover the grounding guardrail branches#16
devops-thiago merged 1 commit into
mainfrom
test/guardrail-coverage

Conversation

@devops-thiago

Copy link
Copy Markdown
Owner

Follow-up to #15: SonarCloud flagged uncovered branch conditions on the out-of-scope check in QueryService.

Adds QueryServiceGuardrailTest:

  • grounded answer keeps its source references
  • the fixed out-of-scope refusal suppresses them
  • PromptBuilder assertion that the grounding instructions and retrieved context reach the prompt

Pure unit tests (Mockito, no Spring context). All 3 pass locally.

SonarCloud flagged uncovered conditions on the out-of-scope check in
QueryService. Add unit tests for both sides (grounded answer keeps its
sources; the fixed refusal suppresses them) plus a PromptBuilder
assertion that the grounding instructions and context reach the prompt.
@thrillhousebot

Copy link
Copy Markdown

🤖 ThrillhouseBot PR Summary

What this PR does

Adds unit tests for the QueryService grounding guardrail, covering grounded answer (sources retained) and out-of-scope reply (sources suppressed), plus a PromptBuilder assertion that grounding instructions and context reach the prompt.

Changes Overview

  • Files changed: 1
  • Lines added: +99
  • Lines removed: 0

Changed Files

File Change Summary
src/test/java/br/com/arquivolivre/myjavagenie/service/QueryServiceGuardrailTest.java Added New test class with 3 tests: grounded answer keeps sources, out-of-scope reply suppresses sources, and PromptBuilder includes grounding instructions and context.

Risk Assessment

Risk Count
🔴 Critical 0
🟠 High 0
🟡 Medium 0
🔵 Low 0

Everything's coming up Thrillhouse! 🎉

No issues found in this PR.


Automated review by ThrillhouseBot. Reply with /review to re-run.

@sonarqubecloud

Copy link
Copy Markdown

@devops-thiago
devops-thiago merged commit a8322cb into main Jul 23, 2026
6 checks passed
@devops-thiago
devops-thiago deleted the test/guardrail-coverage branch July 23, 2026 17:10
@devops-thiago

Copy link
Copy Markdown
Owner Author

@thrillhousebot, tem alguma breaking change nesse PR

@thrillhousebot

Copy link
Copy Markdown

Não. O PR apenas adiciona um novo arquivo de teste (QueryServiceGuardrailTest) e não altera nenhum código de produção, APIs públicas ou comportamentos existentes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant