Skip to content
This repository was archived by the owner on Nov 9, 2026. It is now read-only.

fix(baseline): Split release_post.py's gh api output on newlines only - #298

Merged
mpaulosky merged 4 commits into
mainfrom
fix/297-release-post-line-split
Oct 26, 2026
Merged

mpaulosky merged 4 commits into
mainfrom
fix/297-release-post-line-split

Conversation

@mpaulosky

@mpaulosky mpaulosky commented Oct 26, 2026 •

Copy link
Copy Markdown
Owner

release_post.py's GitHub._list read gh api --jq '.[] | @json' output with str.splitlines(). jq leaves U+2028 and U+2029 unescaped and splitlines() splits on both, so a record whose text held one was cut in two and json.loads raised JSONDecodeError. That crashed the Release workflow's docs job on mpaulosky/IssueManager#328, so it got no release-blog PR.

  • _list now splits on "\n" only. The new test puts both separators in a record and fails against the old code.
  • update_blog_index reads docs/blogs/README.md back by CRLF, CR and LF only, so a row whose title holds U+2028 or U+2029 is kept.
  • commit_subject now cuts a commit message at Markdown's line endings (CRLF, CR, LF) only, so a U+2028 or U+2029 stays in the subject instead of truncating it. A lone CR still ends the subject, because Markdown reads it as a line ending. Tests cover that and the rendered list item.

Closes #297

🤖 Generated with Claude Code

Closes #297

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@mpaulosky mpaulosky added the review:claude Review with Claude label Oct 26, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Review

PR #298 changes GitHub._list in the release_post.py template to split gh api output on "\n" instead of splitlines(), and adds a regression test. I found nothing to hold the merge.

jq's @JSON leaves U+2028 and U+2029 unescaped, so a PR file patch containing either character was cut into two non-JSON halves by splitlines(). Splitting on "\n" fixes that.

  • Line endings: subprocess.run(text=True) already normalises \r and \r\n to \n, and @JSON escapes any \r and \n inside a record, so one record per line still holds.
  • Other callers: commits(), files() and releases() all go through _list, so every record type is covered. Blank lines are still skipped by the line.strip() check.
  • Test: it writes the separators raw with ensure_ascii=False, and the stub lambda path, jq=None matches how _list calls _api(path, jq). Under the old code splitlines() would split the first record at U+2028 and U+2029, and json.loads would raise. I did not check that json and REPO are defined in the test module; they are used by other tests in that file.

Not reviewed: none. I read the one diff piece and the release_post.py context pieces 001 to 003. I did not read context pieces 004 to 007 or the test file's own context.

Advisory

  • commit_subject (release_post.py:103) and first_paragraph (around line 1458) still use splitlines() on untrusted text. A U+2028 or U+0085 in a commit subject would truncate the subject at that character. This only shortens text and loses or mis-parses nothing. You may want it to match the new "newlines only" rule.
  • This is the template copy under "Support For New Projects/". If the repo also keeps a deployed copy (for example .github/scripts/release_post.py), it needs the same change.

No findings.

mpaulosky and others added 2 commits October 26, 2026 08:23
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Review

PR #298 makes GitHub._list split on "\n" only and makes commit_subject cut only at CRLF, CR or LF, so a U+2028 or U+2029 no longer splits a JSON record or a commit subject. The new tests are correct and would fail on the old code. The two edits themselves are sound. The same splitting bug still exists in update_blog_index, which the PR leaves unchanged; I report it as one finding. Advisory: first_paragraph also uses .splitlines() on post text, but it re-joins the lines with spaces, so the effect is cosmetic. All diff and context pieces were read, so nothing is left unreviewed. I did not check whether other copies of release_post.py in the repo need the same edit.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Review

The PR replaces str.splitlines() with splits on CRLF/CR/LF only in three places in release_post.py (GitHub._list, commit_subject, update_blog_index), so U+2028 and U+2029 no longer cut records, commit subjects or blog index rows. A lone CR now ends a commit subject, as Markdown treats it as a line break. Tests were added for each change. I traced the empty, whitespace-only, leading-newline, CRLF and trailing-CR cases and found no bug, so the verdict is no blockers. Not reviewed: I read only the first 767 lines of release_post.py (the rest, including the body of update_blog_index beyond the changed hunk, was not read) and not the test file's imports and fixtures (json, pytest, REPO, make_repo), which I assume exist. Both diff pieces were read in full. Advisory: other splitlines() calls may remain elsewhere in release_post.py (sanitizer, README/docs table handling) with the same U+2028/U+2029 exposure; I could not check.

No findings.

@github-actions github-actions Bot removed the review:claude Review with Claude label Oct 26, 2026
@mpaulosky
mpaulosky merged commit f4a129b into main Oct 26, 2026
8 checks passed
@mpaulosky
mpaulosky deleted the fix/297-release-post-line-split branch October 26, 2026 15:42
mpaulosky added a commit to mpaulosky/TicketManager that referenced this pull request Oct 26, 2026
## Why

Re-Apply the repo-ci-baseline Template so this repo carries the Template
changes from mpaulosky/dotfiles#298 and mpaulosky/dotfiles#300.

## What changed

- `c3b2cab` Apply commit, `apply.sh` output alone: brings
mpaulosky/dotfiles#298 and mpaulosky/dotfiles#300.
  - `.github/scripts/post_claude_review.py`
  - `.github/scripts/release_post.py`
  - `.github/scripts/tests/test_post_claude_review.py`
  - `.github/scripts/tests/test_release_post.py`
  - `.github/workflows/claude-review.yml`
  - `.sandcastle/lib/branches.mts`
  - `.sandcastle/lib/branches.test.mts`
  - `.sandcastle/lib/build.mts`
  - `.sandcastle/lib/build.test.mts`

## Verification

- The Apply commit is exactly `apply.sh`'s output on a branch up to date
with `main`.
- The pre-push gate (`scripts/gate.sh`) passed on `c3b2cab`.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
mpaulosky added a commit to mpaulosky/IssueTracker that referenced this pull request Oct 26, 2026
## Why

Re-Apply the repo-ci-baseline Template so this repo carries the Template
changes from mpaulosky/dotfiles#298 and mpaulosky/dotfiles#300.

## What changed

- `726ce26` Apply commit, `apply.sh` output alone: brings
mpaulosky/dotfiles#298 and mpaulosky/dotfiles#300.
  - `.github/scripts/post_claude_review.py`
  - `.github/scripts/release_post.py`
  - `.github/scripts/tests/test_post_claude_review.py`
  - `.github/scripts/tests/test_release_post.py`
  - `.github/workflows/claude-review.yml`
  - `.sandcastle/lib/branches.mts`
  - `.sandcastle/lib/branches.test.mts`
  - `.sandcastle/lib/build.mts`
  - `.sandcastle/lib/build.test.mts`

## Verification

- The Apply commit is exactly `apply.sh`'s output on a branch up to date
with `main`.
- The pre-push gate (`scripts/gate.sh`) passed on `726ce26`.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
mpaulosky added a commit to mpaulosky/IssueManager that referenced this pull request Oct 26, 2026
## Why

Re-Apply the repo-ci-baseline Template so this repo carries the Template
changes from mpaulosky/dotfiles#298 and mpaulosky/dotfiles#300.

## What changed

- `dd366da` Apply commit, `apply.sh` output alone: brings
mpaulosky/dotfiles#298 and mpaulosky/dotfiles#300.
  - `.github/scripts/post_claude_review.py`
  - `.github/scripts/release_post.py`
  - `.github/scripts/tests/test_post_claude_review.py`
  - `.github/scripts/tests/test_release_post.py`
  - `.github/workflows/claude-review.yml`

## Verification

- The Apply commit is exactly `apply.sh`'s output on a branch up to date
with `main`.
- The pre-push gate (`scripts/gate.sh`) passed on `dd366da`.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
mpaulosky added a commit to mpaulosky/Articles that referenced this pull request Oct 26, 2026
## Why

Re-Apply the repo-ci-baseline Template so this repo carries the Template
changes from mpaulosky/dotfiles#298 and mpaulosky/dotfiles#300.

## What changed

- `aa7ef05` Apply commit, `apply.sh` output alone: brings
mpaulosky/dotfiles#298 and mpaulosky/dotfiles#300.
  - `.github/scripts/post_claude_review.py`
  - `.github/scripts/release_post.py`
  - `.github/scripts/tests/test_post_claude_review.py`
  - `.github/scripts/tests/test_release_post.py`
  - `.github/workflows/claude-review.yml`
  - `.sandcastle/lib/branches.mts`
  - `.sandcastle/lib/branches.test.mts`
  - `.sandcastle/lib/build.mts`
  - `.sandcastle/lib/build.test.mts`

## Verification

- The Apply commit is exactly `apply.sh`'s output on a branch up to date
with `main`.
- The pre-push gate (`scripts/gate.sh`) passed on `aa7ef05`.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Teqslamer <teqslamer@gmail.com>
Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

release_post.py splits gh api output on U+2028 and U+2029 and crashes

1 participant