Stream drift issue body to gh via stdin and overflow into comments#305
Open
sdairs wants to merge 3 commits into
Open
Stream drift issue body to gh via stdin and overflow into comments#305sdairs wants to merge 3 commits into
sdairs wants to merge 3 commits into
Conversation
The scheduled drift check crashed with OSError Errno 7 (Argument list too long) when 155 findings produced an issue body larger than Linux's per-argument exec limit, so no drift issue was filed. Pass the body to `gh issue create` through stdin with `--body-file -`, and truncate oversized bodies at a line boundary (re-closing any open code fence or <details> block) to fit GitHub's 65,536-character issue body cap, with a notice pointing at the --dry-run command for the full report. Fixes #304 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ting Truncating at 65,536 characters silently dropped the tail of large drift reports. Split the body into GitHub-sized chunks instead, posting the first as the issue body and the rest as comments so nothing is lost. Chunk boundaries prefer the last line outside any code fence or <details> block so a block never straddles the issue/comment boundary; a single block larger than the limit is still cut mid-block and re-closed as a fallback. Fixes #304 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 3 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit dafd712. Configure here.
…ments - split_issue_body now hard-truncates a single line that alone exceeds the chunk budget (visible "… [line truncated]" marker), so every chunk is guaranteed <= MAX_ISSUE_BODY_CHARS for any input. - The continuation notice is only appended when lines actually remain, fixing a false "report continues" footer when the forced branch consumes the final line. - create_issue retries a failed gh issue comment once; on double failure it posts a best-effort "report incomplete" comment on the issue, logs the error, and re-raises so CI still fails loudly instead of leaving a silently partial drift report that blocks future runs. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Fixes #304
Today's scheduled drift run (https://github.com/ClickHouse/clickhousectl/actions/runs/29905793331) found 155 actionable findings, but crashed filing the issue:
create_issue()passed the rendered body togh issue createas an argv argument, and with embedded spec JSON fragments the body exceeded Linux's ~128 KiB per-argument limit (OSError: [Errno 7] Argument list too long). No drift issue was filed despite real drift.Changes to
scripts/check-openapi-drift.py:create_issue()now streams the body over stdin withgh issue create --body-file -, removing the argv size ceiling entirely.split_issue_body()splits bodies exceeding GitHub's 65,536-character limit (which today's body did, so--body-filealone would still have been rejected by the API) into GitHub-sized chunks: the first becomes the issue body, the rest are posted as comments withgh issue comment, so no findings are ever dropped. Chunk boundaries land at the last line outside any```fence or<details>block, so a block never straddles the issue/comment boundary. As a fallback, a single block larger than the limit is cut at a line boundary and re-closed to keep the markdown well-formed. Each chunk ends with a "report continues" notice and continuation chunks open with a header linking back to the report above.--dry-runoutput remains a single untouched document.Tests added in
scripts/tests/test_check_openapi_drift.py: short bodies pass through as a single chunk; multi-section bodies split only between blocks with every fence/<details>balanced per chunk and no line lost; an oversized single block is cut and re-closed;create_issuesends the first chunk via stdin togh issue createand the remainder togh issue commentagainst the created issue's URL, with all content preserved across the calls.python3 -m unittest discover -s scripts/tests -p 'test_*.py'— 7 tests, all passing.Note: this only fixes reporting. The 155-finding drift itself still needs remediation once this merges and the next scheduled run files the issue.
🤖 Generated with Claude Code