You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tooling.apache.org by sb...@apache.org on 2026/05/12 19:24:35 UTC

(tooling-trusted-releases) branch sbp updated: Reclassify some license check results

This is an automated email from the ASF dual-hosted git repository.

sbp pushed a commit to branch sbp
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-releases.git


The following commit(s) were added to refs/heads/sbp by this push:
     new 7b403c5c Reclassify some license check results
7b403c5c is described below

commit 7b403c5c1c43503b7d17b2fdf1d181783264ca2f
Author: Sean B. Palmer <se...@miscoranda.com>
AuthorDate: Tue May 12 20:24:00 2026 +0100

    Reclassify some license check results
---
 atr/tasks/checks/license.py       | 32 ++++++++------------------------
 tests/unit/test_checks_license.py | 19 ++++++++++++++++++-
 2 files changed, 26 insertions(+), 25 deletions(-)

diff --git a/atr/tasks/checks/license.py b/atr/tasks/checks/license.py
index 0fed5ad7..664332dd 100644
--- a/atr/tasks/checks/license.py
+++ b/atr/tasks/checks/license.py
@@ -82,8 +82,8 @@ INCLUDED_PATTERNS: Final[list[str]] = [
 # Release policy fields which this check relies on - used for result caching
 INPUT_POLICY_KEYS: Final[list[str]] = ["license_check_mode", "source_excludes_lightweight"]
 INPUT_EXTRA_ARGS: Final[list[str]] = ["is_podling"]
-CHECK_VERSION_FILES: Final[str] = "5"
-CHECK_VERSION_HEADERS: Final[str] = "3"
+CHECK_VERSION_FILES: Final[str] = "6"
+CHECK_VERSION_HEADERS: Final[str] = "4"
 
 _BINARY_LICENSE_FILENAMES: Final[frozenset[str]] = frozenset({"LICENSE", "LICENSE.txt"})
 _BINARY_NOTICE_FILENAMES: Final[frozenset[str]] = frozenset({"NOTICE", "NOTICE.txt"})
@@ -152,7 +152,7 @@ async def files(args: checks.FunctionArguments) -> results.Results | None:
 
     archive_dir = await checks.resolve_archive_dir(args)
     if archive_dir is None:
-        await recorder.concern(
+        await recorder.exception(
             "Extracted archive tree is not available",
             {"rel_path": args.primary_rel_path},
         )
@@ -195,7 +195,7 @@ async def headers(args: checks.FunctionArguments) -> results.Results | None:
 
     archive_dir = await checks.resolve_archive_dir(args)
     if archive_dir is None:
-        await recorder.concern(
+        await recorder.exception(
             "Extracted archive tree is not available",
             {"rel_path": args.primary_rel_path},
         )
@@ -282,7 +282,7 @@ def _files_check_binary_license(paths: list[pathlib.Path], root_path: pathlib.Pa
                 data=None,
             )
     return ArtifactResult(
-        status=sql.CheckResultStatus.CONCERN,
+        status=sql.CheckResultStatus.BLOCKER,
         message="No valid LICENSE or LICENSE.txt file found",
         data=None,
     )
@@ -316,7 +316,7 @@ def _files_check_core_logic(archive_dir: safe.StatePath, is_podling: bool, is_bi
         # Already protected by the caller
         # We add it here again to make unit testing cleaner
         yield ArtifactResult(
-            status=sql.CheckResultStatus.CONCERN,
+            status=sql.CheckResultStatus.EXCEPTION,
             message="Cache directory is not available",
             data=None,
         )
@@ -466,7 +466,7 @@ def _headers_check_core_logic(  # noqa: C901
 
     if not archive_dir.path.is_dir():
         yield ArtifactResult(
-            status=sql.CheckResultStatus.CONCERN,
+            status=sql.CheckResultStatus.EXCEPTION,
             message="Cache directory is not available",
             data=None,
         )
@@ -628,14 +628,6 @@ def _license_results(
         )
         return
 
-    if license_files_size > 1:
-        yield ArtifactResult(
-            status=sql.CheckResultStatus.CONCERN,
-            message="Multiple LICENSE files found",
-            data=None,
-        )
-        return
-
     for filename, license_diff in license_results.items():
         # Unpack the single result by iterating
         if license_diff is None:
@@ -646,7 +638,7 @@ def _license_results(
             )
         else:
             yield ArtifactResult(
-                status=sql.CheckResultStatus.CONCERN,
+                status=sql.CheckResultStatus.BLOCKER,
                 message=f"{filename} is invalid",
                 data={"diff": license_diff},
             )
@@ -678,14 +670,6 @@ def _notice_results(
         )
         return
 
-    if notice_files_size > 1:
-        yield ArtifactResult(
-            status=sql.CheckResultStatus.CONCERN,
-            message="Multiple NOTICE files found",
-            data=None,
-        )
-        return
-
     for filename, (notice_ok, notice_issues, notice_preamble) in notice_results.items():
         # Unpack the single result by iterating
         if notice_ok:
diff --git a/tests/unit/test_checks_license.py b/tests/unit/test_checks_license.py
index 9cfb6899..57a0f533 100644
--- a/tests/unit/test_checks_license.py
+++ b/tests/unit/test_checks_license.py
@@ -113,7 +113,7 @@ def test_files_missing_cache_dir():
         license._files_check_core_logic(safe.StatePath(pathlib.Path("/nonexistent")), is_podling=False, is_binary=False)
     )
     assert len(results) == 1
-    assert results[0].status == sql.CheckResultStatus.CONCERN
+    assert results[0].status == sql.CheckResultStatus.EXCEPTION
     assert "not available" in results[0].message.lower()
 
 
@@ -161,6 +161,23 @@ def test_files_single_root_with_stray_top_level_file(tmp_path):
     assert sql.CheckResultStatus.NOTE in statuses
 
 
+def test_files_source_invalid_license_is_blocker(tmp_path):
+    cache_dir = _cache_with_root(tmp_path)
+    root = cache_dir / "apache-test-0.2"
+    (root / "LICENSE").path.write_text("not the Apache 2.0 license text\n")
+    (root / "NOTICE").path.write_text(NOTICE_VALID)
+    results = list(license._files_check_core_logic(cache_dir, is_podling=False, is_binary=False))
+    license_blockers = [
+        r
+        for r in results
+        if (isinstance(r, license.ArtifactResult))
+        and (r.status == sql.CheckResultStatus.BLOCKER)
+        and ("LICENSE" in r.message)
+        and ("invalid" in r.message)
+    ]
+    assert len(license_blockers) == 1
+
+
 def test_files_source_nested_license_notice_ignored(tmp_path):
     cache_dir = _cache_with_root(tmp_path)
     root = cache_dir / "apache-test-0.2"


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tooling.apache.org
For additional commands, e-mail: commits-help@tooling.apache.org