Skip to content

fix: reject unclear licenses on new tasks - #5780

Open
its-amann wants to merge 4 commits into
embeddings-benchmark:mainfrom
its-amann:fix/disallow-unclear-licenses
Open

its-amann wants to merge 4 commits into
embeddings-benchmark:mainfrom
its-amann:fix/disallow-unclear-licenses

Conversation

@its-amann

@its-amann its-amann commented Oct 26, 2026 •

Copy link
Copy Markdown

This change does not add a model or a dataset, so the dataset and model checklists do not apply.

New tasks need a concrete license. The license field is already typed as Licenses | StrURL | None, so pydantic rejects anything that is not a known license id or a URL. The only unclear values that get through are None and "not specified", and this PR targets those two.

What changed:

  • TaskMetadata gets has_unclear_license(), which is true when the license is None or "not specified", and _validate_license(), which raises a ValueError in that case.
  • _validate_metadata() does not call _validate_license(). None and "not specified" still pass metadata validation, so existing task files keep loading and nothing new starts failing at runtime.
  • The policy is enforced in the tests instead. test_all_metadata_is_filled_and_valid calls _assert_license_policy(task) for every task after the historic datasets check. A task on the exception list must still have an unclear license (otherwise it should be removed from the list), and any other task must pass _validate_license().
  • test_unclear_licenses_limited_to_existing_tasks runs the same check over all tasks, including superseded, aggregate, beta and private ones, and fails if the exception list names a task that no longer exists.
  • Unit tests in test_task_metadata.py cover None and "not specified" passing _validate_metadata(), the same two values being rejected by _validate_license(), and pydantic rejecting a value like "unknown".

552 existing tasks that use "not specified" are listed in tests/test_tasks/_tasks_with_unclear_license.py. Their license values are unchanged. The file says not to add new tasks and to remove a task once it has a real license.

The dataset contribution guide and the license docstring now say a concrete license is required for new tasks, and the dataset PR checklist has an item for it.

Fixes #5348

@KennethEnevoldsen @isaac-chung this follows what you both suggested on the issue, plus the review feedback from @Samoed and @ayush1298. Happy to change how the existing tasks are handled if you'd prefer something else.

Task metadata validation now fails when a license is missing or is a placeholder such as "not specified". Tasks that already use one stay on an exception list in the metadata tests so the current benchmark keeps passing.
Comment thread mteb/abstasks/task_metadata.py Outdated
Comment thread tests/test_abstasks/test_task_metadata.py Outdated
Comment thread tests/test_tasks/test_metadata.py Outdated
Comment thread mteb/abstasks/task_metadata.py Outdated
Pydantic already rejects a license that is not in the allowed list or a URL.
The check now only fails when the license is missing or "not specified".
@its-amann

Copy link
Copy Markdown
Author

Thanks @ayush1298 and @Samoed, that makes sense. Since pydantic already rejects anything that isn't in Licenses or a URL, I'll drop _UNCLEAR_LICENSES and the normalization and just check license is None or license == "not specified". I'll trim the tests down to None, "not specified" and one value pydantic rejects, and I'll also undo the formatting change in _metadata.py so the diff stays small. For the 552 existing tasks, I'm happy to move the list into its own file (something like tests/test_tasks/tasks_with_unclear_license.py), or handle it another way if @KennethEnevoldsen or @isaac-chung prefer. The failing test job is Test lowest dependencies, which is failing on main right now as well.

@isaac-chung

Copy link
Copy Markdown
Collaborator

This has 552 tasks, which is too much. Maybe we can move it to separate file, but will wait for others opinion here

Yep a separate file sounds good. Thanks.

The list of existing tasks with an unclear license is long, so it now lives in tests/test_tasks/_tasks_with_unclear_license.py and test_metadata.py imports it.
@its-amann

Copy link
Copy Markdown
Author

Thanks @isaac-chung. I moved the list of existing tasks into tests/test_tasks/_tasks_with_unclear_license.py and test_metadata.py now imports it from there, so the test file is back to its normal size. The checks could use a workflow approval when someone has a moment.

@isaac-chung

Copy link
Copy Markdown
Collaborator

Any particular reason it's prefixed with _test ?

@its-amann

Copy link
Copy Markdown
Author

Any particular reason it's prefixed with _test ?

no strong reason, just to mark it as a helper and not a test.

Comment thread tests/test_tasks/test_metadata.py Outdated
Comment on lines +37 to +43
# Grandfathered tasks still need valid languages. Their license is an
# existing exception and is checked by the license policy below.
if task.metadata.name in TASKS_WITH_UNCLEAR_LICENSE:
task.metadata._eval_langs_are_valid(task.metadata.eval_langs)
_assert_license_policy(task)
else:
task.metadata._validate_metadata()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think you can test this after this check, because this would skip a lot of tasks in _HISTORIC_DATASETS

Comment thread mteb/abstasks/task_metadata.py Outdated

def _validate_metadata(self) -> None:
self._eval_langs_are_valid(self.eval_langs)
self._validate_license()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This would create a lot new unvalidating metadata which can be a bit unexpected. I think we can remove _validate_license from _validate_metadata

@its-amann

Copy link
Copy Markdown
Author

@Samoed done in 54587db

This branch has not been deployed

No deployments
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.

Consider not accepting datasets with unclear licenses

4 participants