Summary
At line 123 in GitHubIssueReporter.cs, the issue title is constructed as "[AI Suggestion] {record.Category}: {shortDesc}" where shortDesc is truncated to 60 chars (line 120-122). However, GitHub's REST API enforces a maximum title length (typically 255 chars per API docs), and the category name + prefix + scrubbed description could exceed this. No validation checks the final title length before POSTing, risking API 422 (Unprocessable Entity) errors that fail silently with generic error handling at line 179.
Where
src/CodeIndex/Cli/GitHubIssueReporter.cs:119-123
src/CodeIndex/Cli/GitHubIssueReporter.cs:176-180 (generic error handling)
Suggested approach
- Research GitHub API's exact title length limit and document it with a constant in GitHubIssueReporter
- Add validation after line 123 to assert that title.Length <= MaxTitleLength; truncate or return error if exceeded
- Test title construction with edge cases: max-length category names (if categories can be dynamically added), very long scrubbed descriptions
- Improve error handling at line 179 to detect 422 status and provide specific guidance: "Issue title may be too long or body is invalid"
- Add unit test for title validation edge cases
- Consider moving title construction logic into a separate, testable method with clear pre/post conditions
Summary
At line 123 in GitHubIssueReporter.cs, the issue title is constructed as
"[AI Suggestion] {record.Category}: {shortDesc}"where shortDesc is truncated to 60 chars (line 120-122). However, GitHub's REST API enforces a maximum title length (typically 255 chars per API docs), and the category name + prefix + scrubbed description could exceed this. No validation checks the final title length before POSTing, risking API 422 (Unprocessable Entity) errors that fail silently with generic error handling at line 179.Where
src/CodeIndex/Cli/GitHubIssueReporter.cs:119-123src/CodeIndex/Cli/GitHubIssueReporter.cs:176-180(generic error handling)Suggested approach