Skip to content

test: add PromptAssembler tests for 100% coverage#61

Open
jordanpartridge wants to merge 1 commit intomasterfrom
test/prompt-assembler-coverage
Open

test: add PromptAssembler tests for 100% coverage#61
jordanpartridge wants to merge 1 commit intomasterfrom
test/prompt-assembler-coverage

Conversation

@jordanpartridge
Copy link
Contributor

Summary

  • Adds tests/Unit/Services/PromptAssemblerTest.php with 25 tests covering all code paths in PromptAssembler
  • Tests assemble(), transform(), buildCombinedPrompt(), and truncate() methods
  • Covers transformer routing (PHPStan, test failures, default fallback), singular/plural formatting, truncation boundaries, and end-to-end flows with real PHPStan JSON and JUnit XML inputs

Test plan

  • All 25 new tests pass
  • Full suite (228 tests) passes with no regressions
  • Pint formatting verified
  • Uses describe()/it() blocks per project conventions

Closes #47

Add comprehensive tests covering all PromptAssembler code paths:
- assemble() with passing, failing, and mixed check results
- transform() routing to PHPStan, test failure, and default transformers
- buildCombinedPrompt() singular/plural formatting and quick reference
- truncate() boundary conditions (under, at, and over 2000 chars)
- End-to-end tests with real PHPStan JSON and JUnit XML inputs

Closes #47
@coderabbitai
Copy link

coderabbitai bot commented Mar 5, 2026

Warning

Rate limit exceeded

@jordanpartridge has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 16 minutes and 31 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0a8f6786-8dc7-4272-8e46-dbe43387d5ee

📥 Commits

Reviewing files that changed from the base of the PR and between 5691a60 and 40b78c7.

📒 Files selected for processing (1)
  • tests/Unit/Services/PromptAssemblerTest.php
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch test/prompt-assembler-coverage

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link

github-actions bot commented Mar 5, 2026

📊 Coverage Report

Metric Coverage Threshold Status
Lines 81.2% 100%

Files Below Threshold

File Coverage Uncovered Lines
app/Commands/AnalyzeCommand.php 0% 22, 23, 25, 26, 28... (+51 more)
app/Commands/CheckCommand.php 0% 30, 31, 33, 34, 37... (+91 more)
app/Transformers/TestFailurePromptTransformer.php 77.5% 72, 86, 87, 88, 89... (+22 more)
app/Transformers/PhpStanPromptTransformer.php 79.8% 94, 95, 170, 171, 172... (+12 more)
app/Commands/CertifyCommand.php 91.2% 143, 144, 145, 146, 148... (+5 more)
app/GitHub/ChecksClient.php 95.8% 215, 219, 234, 236, 237

🏆 Synapse Sentinel Gate

@github-actions
Copy link

github-actions bot commented Mar 5, 2026

🔧 Synapse Sentinel: 2 checks need attention

The following issues must be resolved before this PR can be merged:


Test Failures (1 total)

Fix these failing tests:

1. CertifyCommand → handle → it returns failure when any check fails 0.13s

FAIL at Unknown file:?

✓ CertifyCommand → handle → it accepts coverage option                 0.03s  
  ⨯ CertifyCommand → handle → it outputs compact format when --compact…  0.02s  
  ⨯ CertifyCommand → handle → it handles multiple failed checks          0.04s  
  ⨯ CertifyCommand → handle → it displays failure table when checks fai… 0.03s  
  ✓ CertifyCommand → handle → it uses token from option                  0.03s  
  ✓ CertifyCommand → handle → it shortens check names in ... (truncated)

Fix: Review the test expectation vs actual behavior. Check the tested code logic.


Security Audit


Review the output and fix any issues.

Quick Reference:

  • PHPStan errors → Fix type mismatches first, then missing types
  • Test failures → Read the assertion message, trace expected vs actual
  • Style issues → Run composer format to auto-fix

🤖 Generated by Synapse Sentinel - View Run

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.

Write PromptAssembler tests (coverage: 88.9% → 100%)

1 participant