Skip to content

feat: surface stale-CODEOWNERS diff as info output instead of inline error#108

Open
dkisselev wants to merge 1 commit into
mainfrom
feat/codeowners-diff-as-info-message
Open

feat: surface stale-CODEOWNERS diff as info output instead of inline error#108
dkisselev wants to merge 1 commit into
mainfrom
feat/codeowners-diff-as-info-message

Conversation

@dkisselev

Copy link
Copy Markdown

Summary

Follow-up to #107. That PR appended the stale-file diff to the CODEOWNERS out of date validation error itself. Two consequences:

  1. The actionable line gets buried. A long diff renders directly under the headline, pushing Run \…` to update the CODEOWNERS file` (and any other validation categories) far up the CI log.
  2. The wrapping gem raises the whole diff. The code_ownership Ruby gem raises 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_errors already prints info_messages before the validation errors and still process::exit(1). So:

  • the diff prints first, as informational stdout;
  • the terse, actionable headline prints last, at the bottom of the log where people look;
  • exit code is unchanged (still 1).

Before (#107)

CODEOWNERS out of date. Run `bin/codeownership validate` to update the CODEOWNERS file
The following changes are required (- current, + expected):
-# Outdated content to trigger validation error
... <potentially hundreds of diff lines> ...

After

The following changes are required (- current, + expected):
-# Outdated content to trigger validation error
... <diff> ...

CODEOWNERS out of date. Run `bin/codeownership validate` to update the CODEOWNERS file

Implementation

  • Error::messages() no longer emits the diff for CodeownershipFileIsStale (back to vec![]).
  • New Errors::info_messages() extracts the diff(s) as informational strings.
  • Runner::validate_all populates RunResult.info_messages from it alongside the (now terse) validation_errors.
  • The diff field on the error variant is retained, just sourced differently.

Tests

  • Updated the three exact-match integration tests (executable_name_config_test.rs, invalid_project_test.rs) for the new ordering — diff block first, headline after.
  • Existing codeowners_diff unit tests are unchanged.

All tests, clippy --all-targets --all-features -D warnings, and fmt --check pass (enforced by the pre-commit hook).

Note

This does not fully shrink what the gem raises: both info_messages and validation_errors go 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

…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>
@github-project-automation github-project-automation Bot moved this to Triage in Modularity Jun 8, 2026
@dkisselev dkisselev requested a review from dduugg June 8, 2026 23:58
@dkisselev dkisselev marked this pull request as ready for review June 8, 2026 23:58
@dkisselev dkisselev requested a review from a team as a code owner June 8, 2026 23:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

1 participant