Skip to content

feat(import): Warn on an unrecognized license instead of refusing - #142

Merged
omesser merged 1 commit into
mainfrom
feat/license-allowlist-130
Aug 31, 2026
Merged

omesser merged 1 commit into
mainfrom
feat/license-allowlist-130

Conversation

@omesser

@omesser omesser commented Aug 31, 2026 •

Copy link
Copy Markdown
Owner

Why

scripts/import-pet.py only checked whether a pack declared a license at all.
Any non-empty string passed, so a pet declaring All Rights Reserved imported
as quietly as one declaring CC0-1.0.

petdex's submit flow now offers CC0 and CC-BY per pet, so the field will
usually be filled in, and what it says starts to matter.

What changed

  • KNOWN_LICENSES: MIT, CC0-1.0, CC0, CC-BY-4.0, Apache-2.0, BSD-3-Clause.
  • An import prints the license. If it is not on that list, or there is none,
    the importer prints a warning to stderr and carries on. Nothing is refused.
  • --accept-license is removed, along with its three README mentions and the
    reference to it in characters/cat/character.manifest.
  • The manifest header records which of the three cases applied, since the
    warning only exists in the terminal.

Comparison flattens case and spacing, then matches exactly. cc by 4.0 is
recognized; MIT License is not, and warns. The upside of being that literal
is that CC BY-NC 4.0 and CC-BY-SA-4.0 cannot be read as CC-BY-4.0. If the
false warnings get annoying, dropping THE and LICENSE as noise words is two
lines.

New pure functions normalize_license, license_warning, and license_header,
all covered by --self-test. emit calls license_header instead of building
the header inline, so the warning and the recorded header cannot disagree.

How to verify

python3 scripts/import-pet.py --self-test, then real imports of synthetic
petscodex pets:

pet.json license Exit Package written Warning
CC0-1.0 0 yes no
CC BY 4.0 0 yes no
All Rights Reserved 0 yes yes
absent, "", or " " 0 yes yes

cargo test (305 + 35), node --test tests/ (22), and validate on all five
shipped Characters.

Notes

This does not do what #130 asked for. The issue wanted an unrecognized license
refused unless --accept-license was passed; the decision was to warn and
continue, and to drop the flag. The allowlist itself is as the issue described.
Recorded in a comment there too.

One bug fixed on the way: a license key holding "" or " " was undeclared
to main and unrecognized to the new functions, which would have put
License: , which the importer does not recognize in a manifest header. Blank
now counts as undeclared everywhere.

Closes #130

@omesser omesser changed the title feat(import): Accept recognized permissive licenses on their own feat(import): Warn on an unrecognized license instead of refusing Aug 31, 2026
@omesser
omesser force-pushed the feat/license-allowlist-130 branch from b6382a6 to 171333b Compare August 31, 2026 19:18
@omesser
omesser force-pushed the feat/license-allowlist-130 branch from 171333b to 9e0d1c3 Compare August 31, 2026 19:20
The check only asked whether a license was declared, so any string passed
unread. It now compares the declared license against an allowlist of permissive
ones and prints a warning when it does not match. It warns rather than refuses,
and `--accept-license` is removed: the person running the import is the one who
decides what to ship. Closes #130.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@omesser
omesser force-pushed the feat/license-allowlist-130 branch from 9e0d1c3 to d2a1cb8 Compare August 31, 2026 19:20
@omesser
omesser merged commit c17d4c6 into main Aug 31, 2026
2 checks passed
@omesser
omesser deleted the feat/license-allowlist-130 branch August 31, 2026 19:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

License allowlist for the pet importer's gate

1 participant