Skip to content

Preserve third-party copyright attribution when re-stamping headers#39

Merged
alexander-yevsyukov merged 1 commit into
masterfrom
preserve-third-party-copyright
Jul 24, 2026
Merged

Preserve third-party copyright attribution when re-stamping headers#39
alexander-yevsyukov merged 1 commit into
masterfrom
preserve-third-party-copyright

Conversation

@alexander-yevsyukov

Copy link
Copy Markdown
Contributor

Problem

The update-copyright tool regenerates a file's whole copyright header from the
IntelliJ 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:

Copyright 2023, The Flogger Authors; 2025, TeamDev. All rights reserved.

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 logging repo.

Fix

preserve_foreign_attribution() keeps any holder listed ahead of the profile's
own (segments separated by ;) verbatim and refreshes only the trailing
profile-holder year:

Copyright 2023, The Flogger Authors; 2026, TeamDev. All rights reserved.

The logic anchors on the profile's own first line (head/tail around the year
token), 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 stamped
exactly as before, so existing behavior is unchanged.

Tests

python3 -m unittest tests.test_update_copyright13/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

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>
Copilot AI review requested due to automatic review settings July 23, 2026 19:18
@alexander-yevsyukov alexander-yevsyukov self-assigned this Jul 23, 2026
@alexander-yevsyukov alexander-yevsyukov moved this to 🏗 In progress in v2.0 Jul 23, 2026
@alexander-yevsyukov alexander-yevsyukov moved this from 🏗 In progress to In Review in v2.0 Jul 23, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@alexander-yevsyukov
alexander-yevsyukov merged commit 57241e9 into master Jul 24, 2026
1 check passed
@alexander-yevsyukov
alexander-yevsyukov deleted the preserve-third-party-copyright branch July 24, 2026 12:52
@github-project-automation github-project-automation Bot moved this from In Review to ✅ Done in v2.0 Jul 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

3 participants