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/07/22 15:16:27 UTC

(tooling-trusted-releases) branch sbp updated: Make the RAT overview check result a note in most cases

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 61cd541a Make the RAT overview check result a note in most cases
61cd541a is described below

commit 61cd541a3ba25915a61ed0d4831d30dc02464749
Author: Sean B. Palmer <se...@miscoranda.com>
AuthorDate: Wed Jul 22 16:15:55 2026 +0100

    Make the RAT overview check result a note in most cases
---
 atr/tasks/checks/rat.py       | 5 +++--
 tests/unit/test_checks_rat.py | 7 ++++---
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/atr/tasks/checks/rat.py b/atr/tasks/checks/rat.py
index 90f78971..187e5ade 100644
--- a/atr/tasks/checks/rat.py
+++ b/atr/tasks/checks/rat.py
@@ -68,7 +68,7 @@ _STD_EXCLUSIONS_EXTENDED: 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_rat"]
 INPUT_EXTRA_ARGS: Final[list[str]] = []
-CHECK_VERSION: Final[str] = "3"
+CHECK_VERSION: Final[str] = "4"
 
 
 class RatError(RuntimeError):
@@ -179,9 +179,10 @@ async def _check_core(
     # Convert to dict for storage, excluding the file lists, which are already recorded
     result_data = result.model_dump(exclude={"unapproved_files", "unknown_license_files"})
 
+    members_recorded = bool(result.unknown_license_files) or bool(result.unapproved_files)
     if result.errors:
         await recorder.exception(result.message, result_data)
-    elif not result.valid:
+    elif (not result.valid) and (not members_recorded):
         await recorder.concern(result.message, result_data)
     else:
         await recorder.note(result.message, result_data)
diff --git a/tests/unit/test_checks_rat.py b/tests/unit/test_checks_rat.py
index 0fc92569..01b900e7 100644
--- a/tests/unit/test_checks_rat.py
+++ b/tests/unit/test_checks_rat.py
@@ -103,7 +103,7 @@ async def test_check_routes_errors_to_exception(tmp_path: pathlib.Path) -> None:
 
 
 @pytest.mark.asyncio
-async def test_check_routes_invalid_without_errors_to_concern(tmp_path: pathlib.Path) -> None:
+async def test_check_routes_member_failures_to_concern_and_rollup_to_note(tmp_path: pathlib.Path) -> None:
     recorder, args = await _rat_check_args(tmp_path, "apache-example-1.2.3-source.tar.gz")
     project = types.SimpleNamespace(
         policy_license_check_mode=sql.LicenseCheckMode.BOTH,
@@ -125,10 +125,11 @@ async def test_check_routes_invalid_without_errors_to_concern(tmp_path: pathlib.
 
     statuses = [status for status, _, _ in recorder.messages]
     concerns = [message for status, message, _ in recorder.messages if status == sql.CheckResultStatus.CONCERN.value]
+    notes = [message for status, message, _ in recorder.messages if status == sql.CheckResultStatus.NOTE.value]
 
-    assert statuses == [sql.CheckResultStatus.CONCERN.value, sql.CheckResultStatus.CONCERN.value]
+    assert statuses == [sql.CheckResultStatus.CONCERN.value, sql.CheckResultStatus.NOTE.value]
     assert "Unapproved license" in concerns
-    assert "Found 1 file with unapproved licenses" in concerns
+    assert "Found 1 file with unapproved licenses" in notes
 
 
 def test_excludes_archive_ignores_policy_when_file_exists(rat_available: tuple[bool, bool], tmp_path: pathlib.Path):


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