From 018181b35bcffe8a3d20c02a3fa41dc231045169 Mon Sep 17 00:00:00 2001 From: Ben Date: Sun, 15 Nov 2026 14:21:14 -0600 Subject: [PATCH] Test automatic issue input caps and ordinary issue preservation --- .github/issue-investigation/tests/test_run.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/issue-investigation/tests/test_run.py b/.github/issue-investigation/tests/test_run.py index d4c687dee..839863f34 100644 --- a/.github/issue-investigation/tests/test_run.py +++ b/.github/issue-investigation/tests/test_run.py @@ -49,6 +49,22 @@ class RunnerTests(unittest.TestCase): self.assertEqual(payload['environment']['env'], {'JAVA_HOME': '/opt/issue-jdk21'}) self.assertFalse(payload['stream']) + def test_automatic_issue_context_is_bounded_and_labeled(self): + issue = {'url': 'https://github.com/BenCodez/VotingPlugin/issues/1', + 'title': 'X' * 500, 'body': 'B' * 20000, + 'comments': [{'body': 'C' * 4000, 'user': 'u'}] * 9} + trimmed = runner.limit_automatic_context(issue) + self.assertTrue(trimmed['context_truncated']) + self.assertLess(len(trimmed['body']), 15000) + self.assertLess(len(trimmed['title']), 400) + self.assertEqual(len(trimmed['comments']), 5) + self.assertIn('Truncated', trimmed['body']) + self.assertEqual(len(issue['comments']), 9) + + def test_automatic_issue_context_preserves_short_issue(self): + issue = {'title': 'Issue', 'body': 'Description', 'comments': []} + self.assertEqual(runner.limit_automatic_context(issue), issue) + def test_rejects_pr_before_spending_api_usage(self): api = FakeApi(lambda *args: {'pull_request': {}}) with self.assertRaisesRegex(RuntimeError, 'not a pull request'):