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 94964c67 Display the ATR classifications of uploaded files
94964c67 is described below

commit 94964c675fbdf20b92273de828d8b27fbae0b719
Author: Sean B. Palmer <[email protected]>
AuthorDate: Fri Feb 13 15:22:04 2026 +0000

    Display the ATR classifications of uploaded files
---
 atr/get/checks.py                            |  3 ++-
 atr/storage/readers/releases.py              |  8 +++++++
 atr/storage/types.py                         |  1 +
 atr/templates/check-selected-path-table.html | 34 ++++++++++++++++++++++------
 tests/e2e/compose/test_get.py                | 29 ++++++++++++++++++++++++
 5 files changed, 67 insertions(+), 8 deletions(-)

diff --git a/atr/get/checks.py b/atr/get/checks.py
index 0d76c738..cc88c1c5 100644
--- a/atr/get/checks.py
+++ b/atr/get/checks.py
@@ -146,7 +146,8 @@ async def selected_revision(
             project_name=project_name,
             version=version_name,
             _committee=True,
-            _project=True,
+            # _project=True is included in _project_release_policy=True
+            _project_release_policy=True,
         ).demand(base.ASFQuartException("Release does not exist", 
errorcode=404))
 
     base_path = util.release_directory(release)
diff --git a/atr/storage/readers/releases.py b/atr/storage/readers/releases.py
index 9395f0c2..f45539f2 100644
--- a/atr/storage/readers/releases.py
+++ b/atr/storage/readers/releases.py
@@ -27,6 +27,7 @@ import atr.db as db
 import atr.models.sql as sql
 import atr.storage as storage
 import atr.storage.types as types
+import atr.util as util
 
 
 @dataclasses.dataclass
@@ -67,6 +68,13 @@ class GeneralPublic:
                     info.artifacts.add(path)
                 elif search.group("metadata"):
                     info.metadata.add(path)
+        source_artifact_paths = release.project.policy_source_artifact_paths
+        if source_artifact_paths and info.artifacts:
+            base_path = util.release_directory(release)
+            source_matcher = util.create_path_matcher(source_artifact_paths, 
base_path / ".ignore", base_path)
+            for path in info.artifacts:
+                if source_matcher(str(base_path / path)):
+                    info.sources.add(path)
         self.__compute_checker_stats(info, paths)
         return info
 
diff --git a/atr/storage/types.py b/atr/storage/types.py
index c61c5a8a..7b957a3b 100644
--- a/atr/storage/types.py
+++ b/atr/storage/types.py
@@ -69,6 +69,7 @@ class PathInfo(schema.Strict):
     ignored_errors: list[sql.CheckResult] = schema.factory(list)
     ignored_warnings: list[sql.CheckResult] = schema.factory(list)
     metadata: set[pathlib.Path] = schema.factory(set)
+    sources: set[pathlib.Path] = schema.factory(set)
     successes: dict[pathlib.Path, list[sql.CheckResult]] = schema.factory(dict)
     warnings: dict[pathlib.Path, list[sql.CheckResult]] = schema.factory(dict)
 
diff --git a/atr/templates/check-selected-path-table.html 
b/atr/templates/check-selected-path-table.html
index 0c8b1013..3b4f6096 100644
--- a/atr/templates/check-selected-path-table.html
+++ b/atr/templates/check-selected-path-table.html
@@ -20,15 +20,16 @@
           {% set path_style_class = "text-warning" %}
         {% endif %}
 
+        {% set icon_class = "text-success" %}
+        {% if has_errors %}
+          {% set icon_class = "text-danger" %}
+        {% elif has_warnings %}
+          {% set icon_class = "text-warning" %}
+        {% endif %}
+
         <tr class="{{ row_bg_class }}">
+          {#
           <td class="text-center px-1 py-2 page-icon-cell">
-            {% set icon_class = "text-success" %}
-            {% if has_errors %}
-              {% set icon_class = "text-danger" %}
-            {% elif has_warnings %}
-              {% set icon_class = "text-warning" %}
-            {% endif %}
-
             {% if info and (path in info.artifacts) %}
               <i class="bi bi-archive {{ icon_class }}"
                  title="Artifact"
@@ -43,6 +44,25 @@
                  aria-label="File"></i>
             {% endif %}
           </td>
+          #}
+          <td class="text-center px-0 py-2 atr-sans {{ icon_class }}">
+            {% if info and (path in info.sources) %}
+              {% set file_type = "source" %}
+            {% elif info and (path in info.metadata) %}
+              {% set file_type = "metadata" %}
+            {% else %}
+              {% set file_type = "binary" %}
+            {% endif %}
+
+            {% if file_type == "source" %}
+              <span title="Source artifact">Ⓢ</span>
+            {% elif file_type == "metadata" %}
+              <span title="Metadata file">Ⓜ</span>
+            {# elif file_type == "binary" #}
+            {% else %}
+              <span title="Binary artifact">Ⓑ</span>
+            {% endif %}
+          </td>
           <td class="py-2">
             <a href="{{ as_url(get.file.selected_path, 
project_name=project_name, version_name=version_name, file_path=path) }}"
                title="View file {{ path }}"
diff --git a/tests/e2e/compose/test_get.py b/tests/e2e/compose/test_get.py
index 8bd87cc6..5942ba88 100644
--- a/tests/e2e/compose/test_get.py
+++ b/tests/e2e/compose/test_get.py
@@ -20,6 +20,35 @@ import re
 from playwright.sync_api import Page, expect
 
 
+def test_file_type_badge_binary_for_artifact(page_compose: Page) -> None:
+    """The tar.gz artifact should have a binary badge."""
+    row = page_compose.locator("tr").filter(
+        has=page_compose.locator("code", 
has_text=re.compile(r"^apache-test-0\.2\.tar\.gz$"))
+    )
+    # All non-metadata files are binary by default
+    badge = row.locator('span[title="Binary artifact"]')
+    expect(badge).to_be_visible()
+    expect(badge).to_have_text("Ⓑ")
+
+
+def test_file_type_badge_metadata_for_asc(page_compose: Page) -> None:
+    """The .asc metadata file should have a metadata badge."""
+    row = page_compose.locator("tr").filter(has=page_compose.locator("code", 
has_text=re.compile(r"\.tar\.gz\.asc$")))
+    badge = row.locator('span[title="Metadata file"]')
+    expect(badge).to_be_visible()
+    expect(badge).to_have_text("Ⓜ")
+
+
+def test_file_type_badge_metadata_for_sha512(page_compose: Page) -> None:
+    """The .sha512 metadata file should have a metadata badge."""
+    row = page_compose.locator("tr").filter(
+        has=page_compose.locator("code", 
has_text=re.compile(r"\.tar\.gz\.sha512$"))
+    )
+    badge = row.locator('span[title="Metadata file"]')
+    expect(badge).to_be_visible()
+    expect(badge).to_have_text("Ⓜ")
+
+
 def test_ongoing_tasks_banner_appears_when_tasks_restart(page_compose: Page) 
-> None:
     """The ongoing tasks banner should appear when tasks are restarted."""
     banner = page_compose.locator("#ongoing-tasks-banner")


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to