Skip to content

fix: keep PR comments under GitHub's 65 KB limit and guard AI verdicts#30

Merged
jacekradko merged 2 commits into
mainfrom
jacek/comment-size-and-ai-verdict-guard
May 27, 2026
Merged

fix: keep PR comments under GitHub's 65 KB limit and guard AI verdicts#30
jacekradko merged 2 commits into
mainfrom
jacek/comment-size-and-ai-verdict-guard

Conversation

@jacekradko

Copy link
Copy Markdown
Contributor

Investigated clerk/javascript#8675's snapi comment, which arrived truncated at GitHub's 65,536-char limit (the AI's per-change rationale never made it into the rendered output). Three things were stacking up to blow the budget on a single change to @clerk/ui's ElementsConfig.

The reporter dumps the entire before- and after-snippet of every change, which is ~13KB twice for a type with ~500 keys. The rule-based diff also stuffs both copies of the type literal back into the change's description. And the AI returned type: "addition" on an in-place modification, mislabeling the section as "Added" even though ElementsConfig already existed.

Fixes one per problem. The interesting one is the AI guard at src/analyzers/ai-analyzer.ts:329-345: addition is reserved for brand-new exports (the prompt is explicit about this and the rule-based pass already routes those around the model), so an addition verdict for a reviewable change is a protocol violation. We coerce to non-breaking and warn. The other two are mechanical: head/tail elision past snippetMaxLines in the markdown reporter, and a 120-char summary for type literals in the rule-based description.

- Markdown reporter truncates oversized before/after snippets to head + tail
  in a <details> block (snippetMaxLines, default 60).
- Rule-based diff descriptions summarize large type literals; the diff block
  already carries the full body.
- AI reviewer coerces an 'addition' verdict on an in-place modification to
  'non-breaking'. 'addition' is reserved for brand-new exports.
@pkg-pr-new

pkg-pr-new Bot commented May 27, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/clerk/snapi/@clerk/snapi@30

commit: 65bc288

@github-actions

github-actions Bot commented May 27, 2026

Copy link
Copy Markdown
Contributor

API Changes Report

Generated by snapi on 2026-05-27T21:22:47.975Z

Summary

Metric Count
Packages analyzed 1
Packages with changes 1
🔴 Breaking changes 0
🟡 Non-breaking changes 0
🟢 Additions 1

@clerk/snapi

Current version: 0.0.1
Recommended bump: MINOR → 0.1.0

🟢 Additions (1)

Added: MarkdownReporterOptions.snippetMaxLines

+ snippetMaxLines?: number;

Added property MarkdownReporterOptions.snippetMaxLines


Report generated by snapi

…d-ai-verdict-guard

# Conflicts:
#	src/reporters/markdown.ts
@jacekradko
jacekradko merged commit 763ad1b into main May 27, 2026
7 checks passed
@jacekradko
jacekradko deleted the jacek/comment-size-and-ai-verdict-guard branch May 27, 2026 21:28
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