Repository navigation
fix(license): rune-aware SPDX tokenizer + honest GPL/LGPL classifier mapping - #14
Merged
Merged
Conversation
…mapping Addresses three RoboRev findings on the license/ package (rstudio/package-manager#19135): 1. NBSP tokenizer (jobs 1103 & 1105): tokenizeSPDX iterated byte-by-byte (rune(expr[i])) while classifying with unicode.IsSpace, so multi-byte UTF-8 whitespace separators (e.g. NBSP U+00A0 in "MIT<NBSP>OR<NBSP> Apache-2.0") were misread and the expression was not split. The tokenizer now decodes runes via utf8.DecodeRuneInString. ASCII behavior is unchanged; added NBSP and ideographic-space regressions. 2. LGPLv3 mapping (job 1104): the classifier "GNU Lesser General Public License v3 (LGPLv3)" denotes exactly v3 (a separate LGPLv3+ classifier exists for or-later), but mapped to LGPL-3.0-or-later. Corrected to LGPL-3.0-only. (The analogous GPLv3 entry was already GPL-3.0-only.) 3. Versionless GPL/LGPL (job 1104): "GNU General Public License (GPL)" and "GNU Library or Lesser General Public License (LGPL)" stated no version but mapped to GPL-3.0-only / LGPL-3.0-only, fabricating a version the metadata does not declare. Both are now SPDXIdentifier "" / SPDXNotIncluded true, so they derive to "Unknown". These change license-derivation output: LGPLv3 -> LGPL-3.0-only, and versionless GPL/LGPL -> Unknown. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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
Resolves three RoboRev findings (jobs 1103, 1104, 1105) on the
license/package, originally raised on thepypi-license-derivationbranch (rstudio/package-manager#19135). These files are a faithful port of PPM's PyPI license derivation; the identical fixes are being applied to PPM in sync (rstudio/package-manager PR, linked below) so the cross-parity test there keeps passing.The three fixes
NBSP / Unicode-whitespace tokenizer (jobs 1103 & 1105).
tokenizeSPDXiterated byte-by-byte (rune(expr[i])) while classifying whitespace withunicode.IsSpace, so a multi-byte UTF-8 whitespace separator (e.g. NBSPU+00A0inMIT<NBSP>OR<NBSP>Apache-2.0) was misread and the expression was not split — producing a single malformed token. The tokenizer now decodes runes viautf8.DecodeRuneInString. ASCII behavior is unchanged; added NBSP and ideographic-space (U+3000) regression cases.LGPLv3 mapping (job 1104). The classifier
GNU Lesser General Public License v3 (LGPLv3)denotes exactly v3 (there is a separateLGPLv3+classifier for or-later), but mapped toLGPL-3.0-or-later. Corrected toLGPL-3.0-only. The analogousGPLv3entry was already correct (GPL-3.0-only).Versionless GPL/LGPL (job 1104).
GNU General Public License (GPL)andGNU Library or Lesser General Public License (LGPL)state no version, but mapped toGPL-3.0-only/LGPL-3.0-only, fabricating a version the metadata does not declare. Both are now"SPDXIdentifier": ""/"SPDXNotIncluded": true, so they derive toUnknown(honest, no fabricated version).Behavior change — needs reviewer attention
Fixes 2 and 3 change license-derivation output for affected classifiers:
LGPLv3->LGPL-3.0-only(wasLGPL-3.0-or-later)GPL/LGPL->Unknown(wasGPL-3.0-only/LGPL-3.0-only)These feed PPM block/compliance decisions downstream, so they are not cosmetic.
Testing
gofmt/go vet/go test ./license/all green. Added regression cases for NBSP + ideographic-space tokenization and for all three corrected classifier mappings.Coordination
After merge: cut
v0.1.1so PPM can re-pin from the temporary pseudo-version to the tag.🤖 Generated with Claude Code