feat: show CODEOWNERS diff when validate detects a stale file#107
Merged
Conversation
`validate` previously reported only "CODEOWNERS out of date" with no indication of what differed, forcing developers to re-run the tool locally to discover the delta. The stale-file error now includes a line-oriented diff between the on-disk CODEOWNERS file and the freshly generated one (git-style `-`/`+` prefixes, changed lines only), so CI output explains what is out of date.
The custom_executable_name and default_executable_name CODEOWNERS fixtures carried an outdated disclaimer header (`generated by "codeowners"`) that no longer matches the generator's output (`generated by "bin/codeownership validate"`). That mismatch showed up as noise in the validate diff. Update the fixture headers to match the generated disclaimer so the diff only reflects real ownership drift, and restore the stricter executable-override assertion now that the diff no longer contains "bin/codeownership".
joemsak
approved these changes
Jun 8, 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
bin/codeownership validatepreviously reported onlyCODEOWNERS out of date. Run ... to update the CODEOWNERS filewhen the committed CODEOWNERS file was stale, with no indication of what differed. In CI this surfaced as an opaque message (wrapped in a RubyRuntimeErrorstack trace by thecode_ownershipgem), forcing developers to re-run the tool locally just to discover the delta.This PR appends a line-oriented diff between the on-disk CODEOWNERS file and the freshly generated one to the stale-file error, so the failure explains what is out of date.
Before
After
Implementation
similarcrate for line-level diffing.Error::CodeownershipFileIsStalenow carries adiffstring, computed by a newcodeowners_diffhelper that emits only changed lines with git-style-/+prefixes (removals = present on disk but no longer expected; additions = expected but missing).messages().Tests
codeowners_diff(added/removed lines, empty file, identical files).custom_executable_nameanddefault_executable_namefixtures. They carriedgenerated by "codeowners", which no longer matches the generator'sgenerated by "bin/codeownership validate"; the mismatch was showing up as noise in the diff. Aligning the fixture header with the generated output keeps the diff focused on real ownership drift.All tests,
clippy --all-targets --all-features -D warnings, andfmt --checkpass (enforced by the pre-commit hook).Note
This improves the message the
code_ownershipRuby gem surfaces, but the gem still wraps it inraise, so the stack trace seen in CI originates there, not in this repo.