Preserve third-party copyright attribution when re-stamping headers#39
Merged
Merged
Conversation
The copyright tool regenerated the whole header from the IntelliJ profile, which names a single holder (TeamDev). On files derived from an Apache-2.0 upstream (e.g. Flogger) whose header credits the upstream ahead of TeamDev — `Copyright 2023, The Flogger Authors; 2025, TeamDev. All rights reserved.` — this dropped the upstream notice on every re-stamp, violating Apache-2.0 §4(c), which requires retaining such attribution. `update_copyright.py` now preserves any holder listed ahead of the profile's own (segments separated by `;`) and refreshes only the trailing profile-holder year. The logic anchors on the profile's own first line, so it is not tied to any specific project; single-holder headers are stamped exactly as before. Add regression tests (attribution retained, idempotent, multiple holders) and document the behavior in `SKILL.md`. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a licensing-compliance bug in the update-copyright tool by preserving third-party (upstream) attribution in existing copyright headers while still updating the local/profile holder’s year.
Changes:
- Preserve any pre-existing upstream attribution segments (separated by
;) when re-stamping a header, updating only the trailing profile-holder year. - Extend unit coverage with regression tests for single upstream attribution, idempotency, and multi-holder chains.
- Document the third-party attribution behavior in the skill’s README (
SKILL.md).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| skills/update-copyright/scripts/update_copyright.py | Captures the original header and preserves foreign attribution while refreshing only the profile-holder year during restamping. |
| skills/update-copyright/tests/test_update_copyright.py | Adds regression tests ensuring upstream attribution is retained, updates are idempotent, and multiple holders are supported. |
| skills/update-copyright/SKILL.md | Documents the new third-party attribution preservation behavior and rationale. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
armiol
approved these changes
Jul 24, 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.
Problem
The
update-copyrighttool regenerates a file's whole copyright header from theIntelliJ profile, which names a single holder (TeamDev). Files derived from an
Apache-2.0 upstream — Spine Logging is derived from Google's Flogger — carry
a dual-attribution first line:
On every re-stamp (e.g. the copyright PostToolUse hook firing after any edit),
the tool collapsed this to
Copyright <year>, TeamDev. All rights reserved.,dropping the upstream credit. Apache-2.0 §4(c) requires retaining such
attribution notices, so this was a licensing-compliance bug affecting ~100
Flogger-derived files in the
loggingrepo.Fix
preserve_foreign_attribution()keeps any holder listed ahead of the profile'sown (segments separated by
;) verbatim and refreshes only the trailingprofile-holder year:
The logic anchors on the profile's own first line (
head/tailaround the yeartoken), so nothing is hard-coded to "Flogger" or "TeamDev" — it generalizes to
any upstream, including multi-holder chains (e.g.
Google Inc.; … Flogger Authors; … TeamDev). Single-holder headers hit an early return and are stampedexactly as before, so existing behavior is unchanged.
Tests
python3 -m unittest tests.test_update_copyright— 13/13 pass (10 existing +3 new: attribution retained, idempotent, multiple holders). Also verified
end-to-end through the real PostToolUse hook on a Flogger-header file: the header
was preserved and only TeamDev's year bumped.
🤖 Generated with Claude Code