Skip to content

Make PR_BODY_FILE work in CI by scoping reads to RUNNER_TEMP - #3742

Merged
Mpdreamz merged 2 commits into
mainfrom
feature/changelog-validate
Jul 29, 2026
Merged

Make PR_BODY_FILE work in CI by scoping reads to RUNNER_TEMP#3742
Mpdreamz merged 2 commits into
mainfrom
feature/changelog-validate

Conversation

@Mpdreamz

@Mpdreamz Mpdreamz commented Jul 29, 2026

Copy link
Copy Markdown
Member

Why

evaluate-pr read PR_BODY_FILE through FileSystemFactory.RealRead, which is scoped to the working directory and app data. RUNNER_TEMP is under neither, so in GitHub Actions the path failed the scope check, emitted "points to a missing file", and the PR body was silently dropped.

PR_BODY_FILE exists precisely because PR_BODY can hit GitHub's 65,536-char limit and blow the runner's env-var budget. Since the scoped read rejected every path it was ever given, that workaround never took effect — callers staging the body in RUNNER_TEMP got an empty body and no error.

What

Adds FileSystemFactory.RealReadForCI, which extends the standard RealRead scope with RUNNER_TEMP when that variable is set, and uses it in evaluate-pr. It falls back to RealRead when the variable is absent, so local runs are unchanged.

Containment stays with the scoped filesystem rather than a hand-rolled path comparison in the caller: a path outside the allowed roots still fails the existence check and surfaces a warning, so the previous behaviour for genuinely out-of-scope paths is preserved.

The remaining body-reading logic — the 256 KiB cap and pooled-buffer truncation path — moves into ChangelogPrBodyReader so it can be tested without standing up a command harness.

@Mpdreamz
Mpdreamz requested a review from a team as a code owner July 29, 2026 15:33
@Mpdreamz Mpdreamz added the chore label Jul 29, 2026
@Mpdreamz
Mpdreamz requested a review from cotti July 29, 2026 15:33
@Mpdreamz
Mpdreamz force-pushed the feature/changelog-validate branch 2 times, most recently from 9c9aa97 to a829834 Compare July 29, 2026 15:52
evaluate-pr read PR_BODY_FILE through FileSystemFactory.RealRead, which is
scoped to the working directory and app data. RUNNER_TEMP is under neither,
so in GitHub Actions the path failed the scope check, emitted "points to a
missing file", and the PR body was silently dropped -- the env-var-overflow
workaround PR_BODY_FILE exists for never took effect.

Adds FileSystemFactory.RealReadForCI, which extends the RealRead scope with
RUNNER_TEMP when that variable is set, and uses it in evaluate-pr. Paths
outside the scope still fail the existence check and warn, so containment
stays with the scoped filesystem rather than a hand-rolled path comparison.

Extracts the body-reading logic (size cap, buffer pooling) into
ChangelogPrBodyReader so it can be tested without a command harness.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@Mpdreamz
Mpdreamz force-pushed the feature/changelog-validate branch from a829834 to be81e01 Compare July 29, 2026 15:53
@Mpdreamz Mpdreamz added the bug label Jul 29, 2026
@Mpdreamz Mpdreamz changed the title Extract changelog PR evaluation utilities into separate modules Make PR_BODY_FILE work in CI by scoping reads to RUNNER_TEMP Jul 29, 2026
@Mpdreamz Mpdreamz removed the chore label Jul 29, 2026
@Mpdreamz
Mpdreamz enabled auto-merge (squash) July 29, 2026 16:03
@Mpdreamz
Mpdreamz merged commit 416cd56 into main Jul 29, 2026
24 checks passed
@Mpdreamz
Mpdreamz deleted the feature/changelog-validate branch July 29, 2026 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants