These tests validate the PR review workflow logic without using mock data. The intent is to exercise every potential outcome of the verdict parser and the diff truncation logic.
Test each of the following Approve? values and verify label behavior:
- -1: Empty review content (should fail workflow before labeling).
- 0:
Approve?not present (labels unchanged, no error). - 1:
Approve? APPROVE(addsai:approve, removesai:request-changes). - 2:
Approve? REQUEST_CHANGES(addsai:request-changes, removesai:approve). - 3:
Approve? COMMENT_ONLY(addsai:comment-only). - 4: Lowercase variants (e.g.,
approve,request_changes) should still parse. - 5: Bolded variants (e.g.,
Approve? **APPROVE**) should parse. - 6: Multiple occurrences (first match should be used).
- 7: Unknown token (e.g.,
Approve? MAYBE) should lead to no labels. - 8: Very large review body with valid verdict should still label.
- 9: Valid verdict with missing labels should auto-create labels.
- 10: Valid verdict when labels already exist should reuse labels.
- 11: Valid verdict with no permissions to create labels should fail at label creation (expected failure mode).
- 12: Valid verdict with permission but no issue write should fail at label add (expected failure mode).
- Diff size < MAX (150000 bytes):
Diff truncated: falseappears in prompt. - Diff size == MAX:
Diff truncated: falseappears in prompt. - Diff size > MAX:
Diff truncated: trueappears in prompt and diff file is exactly MAX bytes.
- Create a PR with a small diff to confirm
Diff truncated: false. - Create a PR with a large diff (>150KB) to confirm trimming and
Diff truncated: true. - Ensure the review comment is updated rather than duplicated on subsequent pushes.
- Confirm that labels are created on first run and updated on verdict changes.
These are structural checks, not mocks:
yamllint .github/workflows/openrouter-pr-review.ymlrg -n "openrouter-pr-review" .github/workflows/openrouter-pr-review.yml
review.mdpopulated with the model response.- Single PR comment with marker
<!-- openrouter-pr-review -->. - Labels applied according to verdict.
This change is documentation-only and does not affect runtime behavior. The verification approach focuses on file integrity and formatting consistency.
- None. Documentation-only update.
- Ensured headings and bullet text remain unchanged aside from whitespace normalization.
- Confirmed the file renders correctly with standard Markdown list formatting.
Each test uses real logic paths without mock data. Run the generation/analysis methods with the inputs below.
- -1: Empty string input to
analyze('')should returnsyllables: 1, empty phoneme string, and stress pattern[]. - 0: Single vowel word
analyze('a')should return one syllable and a vowel-only phoneme string. - 1: Silent-e word
analyze('cake')should map to a long vowel and keep syllable count at 1. - 2: Vowel-team word
analyze('rain')should resolve theaiteam to a long vowel symbol. - 3: Digraph word
analyze('shadow')should mapshtoSwithout re-processing theh. - 4: Terminal
ywordanalyze('fly')should end withY. - 5: Mixed prefixes/suffixes
analyze('replaying')should preserve token order and not double-count vowels. - 6: Intransitive verb generation should not force a direct object (generate multiple
VPoutputs). - 7: Transitive verb generation should prefer
V NPwhile still allowingVorV PPat low probability. - 8: Grammar flattening should include
Advfrom the lexicon (no hardcoded adverbs). - 9: Corpus loader should return lines from
/lyrics/*.txtwhen files exist. - 10: Corpus loader should deduplicate identical lines across embedded and file-based sources.
- 11: Corpus loader should skip empty lines and whitespace-only lines from lyric files.
- 12: Corpus loader should fall back to embedded corpus when no lyric files resolve.
- Use the existing UI controls to trigger sentence generation and analysis for cases 1–8.
- For corpus validation (cases 9–12), temporarily log the returned array length and sample entries after invoking
loadLyricsCorpus.
Run generation with ?seed= in the URL and confirm reproducible output across reloads.
- -1:
?seed=empty string should fall back to default entropy (non-deterministic across reloads). - 0:
?seed=0yields a stable poem across reloads. - 1:
?seed=1yields a stable poem across reloads. - 2:
?seed=2yields a stable poem across reloads. - 3:
?seed=3yields a stable poem across reloads. - 4:
?seed=-42yields a stable poem across reloads. - 5:
?seed=3.14is floored to3and yields stable output. - 6:
?seed=00012resolves to12and yields stable output. - 7:
?seed=alphahashes to a deterministic 32-bit seed and yields stable output. - 8:
?seed=alphamatches identical output across browsers (same seed string). - 9:
?seed=alpha-betayields a different but stable output fromalpha. - 10:
?seed=9999999999yields stable output without overflow errors. - 11: Remove
?seed=after using a deterministic seed to confirm non-deterministic default again. - 12: Load a checkpoint after setting
?seed=and confirm continued deterministic generation.