Repository navigation
licensing: one notice per file, and a gate that says so (Fixes #1547) - #1551
Conversation
20 files carried the Apache notice twice: the header block, then Copyright+SPDX repeated around line 15-17. `tools/copyright.py` never checked for that — `has_notice()` asks only whether the notice is *present* in the first 20 lines — which is how #1535 and #1544 shipped one. 17 files: the second pair deleted (comment-only, 34 lines; `git diff --stat` is 2 deletions per file) 3 files: the second occurrence is DATA and stays, each now saying why in a comment scripts/mk-kernel-packages.sh the notice it EMITS into the package's README tests/copyright_check_untracked_test.py the NOTICE string the cases assert against tools/npu_leaderboard.py the NOTICE template written into a generated leaderboard The issue's count was from 5481b5d and has moved: `tools/npu_leaderboard.py` is new (a fourth exemption), and `tools/npu-arena/make_task.sh` had a *third* occurrence inside a heredoc — both kinds in one file, so the duplicate pair went and the emitted one stayed. The gate: `duplicated_notice()` fails when Copyright+SPDX appear more than once inside the same 20-line window `has_notice()` already looks at. Deliberately windowed rather than tree-wide: the three legitimate second occurrences all sit past line 20 because they are data, so this needs no exemption list and cannot rot into one. Proven in both directions on real trees, not on fixtures: against main's 17 unfixed files -> names all 17, rc=1 against this tree -> rc=0 `tests/copyright_check_untracked_test.py` gets two new cases against the real tool in a scratch repo: a doubled header fails and names the file; a second occurrence past the window (an emitted notice) stays green. CONTRIBUTING rule 5 now says "once" and explains the window. Fixes #1547.
|
#1551 ready for review — Why this lane: one of the three "must NOT sweep" files is mine — Counts at this head (main moved since the issue was filed): 17 files with the duplicate pair deleted (34 comment lines, 2 per file), 3 exemptions kept. The gate, proven on real trees rather than fixtures:
Not touched, deliberately: the other ~700 notices are unchanged and no first block was reflowed — the diff is deletions plus the three explanatory comments. Reviewer note: |
|
VERDICT: the gate change is the real fix and I verified it the way that matters — by running the NEW gate against MAIN's tree, where it names the duplicates that main's own gate passes. and at this PR's head the same command is rc=0. That pair — fails on main's tree, clean on this one — is the proof that the change is a check and not a comment: main's gate returns 0 on the duplicated files today, because Their own test passes: Two things I checked because they are the shape of "the fix that reads right"
What this lane can add, and it is not a requestOur |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY at c3952917376493f57d19fd2abdb76e6baaa591c3
I checked the gate both ways rather than reading the claim:
- this head:
python3 tools/copyright.py --checkgives rc 0; - main's tree with this head's
tools/copyright.py: rc 1, and it names 17 files ("copyright notice duplicated inside the header window (delete the second copy): …"), the 17 this PR fixes; tests/copyright_check_untracked_test.py: 0 failures, including the two new cases (a doubled header FAILs and names the file; a second occurrence past the window stays green).
The deletions are all the comment-only second Copyright/SPDX pair. The three kept second occurrences (mk-kernel-packages.sh's emitted README, the test's NOTICE, npu_leaderboard.py's template) are data and now say so. Reusing has_notice()'s 20-line window, instead of an exemption list, is the right design.
One small note, not blocking. tools/amd-rai-sweep/README.md:18-19 is now an empty comment block:
<!--
-->
It's harmless, but the deletion should take the two marker lines too.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY at c3952917.
The gate now asks the question presence could not: was the header block pasted twice. Verified by firing it rather than reading it —
$ python3 tools/copyright.py --check (fixture with the notice twice inside the window)
copyright notice duplicated inside the header window (delete the second copy): tools/dup.sh
$ python3 tools/copyright.py --check (this branch)
rc 0
The 20-line window is the load-bearing choice, so I falsified its three claimed exceptions instead of trusting the comment: every legitimate
second occurrence is outside it — scripts/mk-kernel-packages.sh at line 149 (the heredoc emitting a licence header),
tests/copyright_check_untracked_test.py at line 127 (the NOTICE a test asserts on), tools/npu_leaderboard.py at line 36 (the NOTICE
template). All past 20, so the rule "duplicate inside the window = the accidental shape, further down = somebody's deliberate string" holds on the
current tree rather than by assertion. npu_leaderboard.py:36 is the tightest of the three — 16 lines of headroom — which is worth remembering if
that file ever grows its header; the comment already explains why it is data, so a future reader has the reason in front of them.
duplicated_notice requires both NOTICE lines to repeat (> 1 and > 1), which is the conservative direction: a pasted half is not flagged, but a
half-pasted header is broken in a way a human sees immediately, while a full duplicate is the one that grows quietly.
And the 20 files it flags are cleaned in this same PR rather than left for the next one — the gate and its first output land together, which is the
only ordering that leaves --check green at the merge commit. tests/copyright_check_untracked_test.py:115 asserts the duplicate case fails the
check, so the rule is held by a test, not by the sweep.
…ate passes on main (#1560) #1544 added os/v3/puppy/base-modes-keep with the copyright + SPDX lines twice, and #1551/#1554 (merged in the same batch) made a duplicated notice inside the header window a gate failure. Each PR was green alone; together main failed tools/copyright.py --check (run 42530891923). This removes the second copy; the check passes over the whole tree. Co-authored-by: bong-water-water-bong <bong-water-water-bong@1bit.gg> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Fixes #1547.
20 files carried the Apache notice twice — the header block, then
Copyright+SPDX-License-Identifierrepeated around line 15-17.tools/copyright.pycould not catch it:has_notice()asks only whether the notice is present in the first 20 lines, never whether it is unique, which is how #1535 and #1544 shipped one.What changed
Copyright+SPDXpair deleted — comment-only, 34 lines, 2 per filescripts/mk-kernel-packages.shREADME.mdtests/copyright_check_untracked_test.pyNOTICEstring the cases assert againsttools/npu_leaderboard.pyNOTICEtemplate written into a generated leaderboardtools/copyright.pyduplicated_notice(), wired into--checktests/copyright_check_untracked_test.pyCONTRIBUTING.mdThe issue's count had moved, and that mattered:
tools/npu_leaderboard.pyis new since5481b5d(a fourth exemption, which is why this is a read and not ased), andtools/npu-arena/make_task.shhad a third occurrence inside a heredoc — both shapes in one file, so there the duplicate pair went and the emitted one stayed.The gate is windowed on purpose.
duplicated_notice()fails when Copyright+SPDX appear more than once inside the same 20-line windowhas_notice()already uses. The three legitimate second occurrences all sit past line 20 because they are data — so this needs no exemption list, and cannot rot into one.Proven in both directions on real trees, not fixtures:
and the two new test cases in
tests/copyright_check_untracked_test.py(a doubled header fails and names the file; a second occurrence past the window stays green) run the real tool in a scratch repo, like the cases already there.No device work, nothing installed, no publishing. CLAIM: this issue is claimed in a comment on #1547 and on
~/briefs/TISSUES-BOARD.mdby pi-kpkg.