feat: surface stale-CODEOWNERS diff as info output instead of inline error#108
Open
dkisselev wants to merge 1 commit into
Open
feat: surface stale-CODEOWNERS diff as info output instead of inline error#108dkisselev wants to merge 1 commit into
dkisselev wants to merge 1 commit into
Conversation
…error The diff added in #107 was rendered inline under the "CODEOWNERS out of date" headline, so a long diff pushed the actionable line up and out of view in CI logs, and the wrapping code_ownership gem raised the entire diff as part of the error. Route the diff through RunResult.info_messages instead. main.rs prints info_messages ahead of validation errors and still exits 1, so the diff prints first as informational output while the terse, actionable headline lands at the bottom of the log where it's seen. Errors::messages() no longer emits the diff; a new Errors::info_messages() extracts it. Co-Authored-By: Claude Opus 4.8 (1M context) <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.
Summary
Follow-up to #107. That PR appended the stale-file diff to the
CODEOWNERS out of datevalidation error itself. Two consequences:Run \…` to update the CODEOWNERS file` (and any other validation categories) far up the CI log.code_ownershipRuby gemraises the returned message, so the entire diff lands inside the stack trace.This PR keeps the diff but moves it out of the error and into
RunResult.info_messages.How it works
main.rs::maybe_print_errorsalready printsinfo_messagesbefore the validation errors and stillprocess::exit(1). So:1).Before (#107)
After
Implementation
Error::messages()no longer emits the diff forCodeownershipFileIsStale(back tovec![]).Errors::info_messages()extracts the diff(s) as informational strings.Runner::validate_allpopulatesRunResult.info_messagesfrom it alongside the (now terse)validation_errors.difffield on the error variant is retained, just sourced differently.Tests
executable_name_config_test.rs,invalid_project_test.rs) for the new ordering — diff block first, headline after.codeowners_diffunit tests are unchanged.All tests,
clippy --all-targets --all-features -D warnings, andfmt --checkpass (enforced by the pre-commit hook).Note
This does not fully shrink what the gem raises: both
info_messagesandvalidation_errorsgo to stdout, so if the gem captures all of stdout the diff is still in the captured text. It does fix log ordering/readability. Genuinely shrinking the raised error would require routing the diff to stderr (a separate channel) — happy to take that direction instead if preferred.🤖 Generated with Claude Code