Repository navigation
Keep an existing COPYRIGHT.md instead of rewriting it from the clock [patch] - #233
Merged
Merged
Conversation
…[patch] LicenseGenerator rebuilt the copyright line from DateTime.UtcNow on every run, so the first ci run of 2027 would write "2023-2027" into COPYRIGHT.md and commit it. ktsu.Sdk derives every source file's required header from COPYRIGHT.md, so every repository would then fail IDE0073 on every file. An existing, non-empty COPYRIGHT.md is now kept as it is, and LICENSE.md carries its text. A repository without one still gets one generated. The year comes in through an internal overload so tests can freeze it. Fixes #222 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01T4yQx7YuowTGorXJRkhe8x
|
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.



Fixes #222
What changed
LicenseGeneratorrebuiltCopyright (c) 2023-{DateTime.UtcNow.Year} …on every run. The firstcirun of 2027 would commit2023-2027, and since ktsu.Sdk derivesfile_header_templatefromCOPYRIGHT.md, every repository would fail IDE0073 on every source file.COPYRIGHT.mdis now kept verbatim, andLICENSE.mdcarries the same line, so the two can't drift.COPYRIGHT.mdis still generated, in the same2023-{year}format as before.GenerateAsyncsignature is unchanged. It forwards to a newinternaloverload that takescurrentYear, so tests can freeze the clock. Both callers (MetadataServiceand thelicenseCLI command) pick up the new behaviour without changes.Not in scope (worth a separate decision):
COPYRIGHT.md. The kept text wins, which matches "advance it deliberately, not as a side effect ofci".Tests
New
LicenseGeneratorTests:GenerateAsync_NewYear_KeepsExistingCopyright: an existing2023-2026file, run with the clock frozen at 2027, stays byte-identical, andLICENSE.mdcarries it with no2027. It fails when the old clock-derived line is restored and passes with the fix.GenerateAsync_NoCopyrightFile_GeneratesOneForTheCurrentYearandGenerateAsync_EmptyCopyrightFile_IsRegeneratedcheck that generation still works when there's nothing to keep.The existing
GenerateAsync_IncludesYearRangestill passes, since it runs with no existing file. The full suite passes (786/786), andKtsuBuild.csprojbuilds across all its target frameworks.Each consuming repository needs to pick up the new KtsuBuild release before 2027-01-01.
🤖 Generated with Claude Code
https://claude.ai/code/session_01T4yQx7YuowTGorXJRkhe8x
Generated by Claude Code