Harden changelog CI path: scope roots, SecurityException, native gate errors - #3745
Merged
Conversation
… errors - FileSystemFactory.ScopeCurrentWorkingDirectory: filter ancestor extension roots (would produce overlapping scope roots and crash ScopedFileSystem, same class of bug fixed in a96ef86 for Codex nested paths) - FileSystemFactory.RealReadForRunnerTemp: fix docstring that incorrectly claimed the fallback triggers when 'not in CI' - ChangelogCommand: catch SecurityException alongside IOException when reading --prs / --issues from file (ScopedFileSystemException extends SecurityException) - ChangelogPrEvaluationService.EvaluatePr: emit collector.EmitError + return false for NoTitle and NoLabel (type and product) results so docs-builder exits 1 natively, eliminating the need for a separate bash Gate step in CI. GitHub Actions outputs are still written before exit so downstream steps with if:always() can read status/label-table/etc. Tests: - FileSystemFactoryTests: RealReadForRunnerTemp (unset fallback, sibling temp dir), ScopeCurrentWorkingDirectory ancestor root guard - ChangelogPrBodyReaderTests: outside-scope emits Warning, missing file emits Warning (assertions corrected from prior Error draft) - ChangelogPrEvaluationServiceTests: gate TDD (NoTitle/NoLabel/NoProductLabel each emit error and return false, success emits no diagnostics); existing no-label/no-title tests updated from BeTrue to BeFalse Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Mpdreamz
approved these changes
Jul 29, 2026
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.
Summary
Follow-up hardening on top of #3742 (
RealReadForRunnerTemp/ChangelogPrBodyReader), plus the gate-logic change requested by @[colleague] to makeevaluate-prnatively signal failure forno-label/no-titleresults.FileSystemFactory.ScopeCurrentWorkingDirectory: filter ancestor extension roots in addition to descendants. An ancestor would subsume the working root and produce overlapping scope roots, causingScopedFileSystemto throwArgumentException— the same class of crash fixed in a96ef86 / 3c5f970 for Codex nested paths.FileSystemFactory.RealReadForRunnerTemp: fix docstring that incorrectly claimed the fallback triggers when "not in CI" (nothing consultedIsRunningOnCI).ChangelogCommand: catchSecurityExceptionalongsideIOExceptionwhen reading--prs/--issuesfrom a file.ScopedFileSystemExceptionextendsSecurityException, so an out-of-scope path escaped as an unhandled exception.ChangelogPrEvaluationService.EvaluatePr: emitcollector.EmitError(...)+return falseforNoTitleandNoLabel(type and product) results.ServiceInvokeralready translatescollector.Errors > 0→ exit code 1, so docs-builder now fails natively without a separate bash Gate step. GitHub Actions outputs (status,label-table, etc.) are still written before the process exits, so downstream steps withif: always()can still read them.The companion docs-actions PR is elastic/docs-actions#257.
Tests
FileSystemFactoryTests:RealReadForRunnerTemp(unset → falls back toRealRead, sibling RUNNER_TEMP allows staged file read),ScopeCurrentWorkingDirectoryancestor root guard.ChangelogPrBodyReaderTests: outside-scope emitsWarning, missing file emitsWarning.ChangelogPrEvaluationServiceTests: TDD gate tests —NoTitle,NoTypeLabel,NoProductLabeleach emit aSeverity.Errordiagnostic and returnfalse; success emits no diagnostics. All existingno-label/no-titletests updated fromBeTrue()toBeFalse().Test plan
./build.sh unit-testgreenevaluate-pron a PR with no changelog label → exit code 1,::error::annotation visible in Actions UIevaluate-pron a PR with a valid changelog label → exit code 0,::notice::proceed🤖 Generated with Claude Code