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

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


The following commit(s) were added to refs/heads/main by this push:
     new dc72970  Copy the most recent cached check only
dc72970 is described below

commit dc729709d4958f67914a739dacc2a85db9282f0e
Author: Sean B. Palmer <[email protected]>
AuthorDate: Mon Dec 22 16:01:24 2025 +0000

    Copy the most recent cached check only
---
 atr/tasks/checks/__init__.py | 11 +++++++++--
 tests/e2e/sbom/conftest.py   |  1 +
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/atr/tasks/checks/__init__.py b/atr/tasks/checks/__init__.py
index 97b7c29..09a15d3 100644
--- a/atr/tasks/checks/__init__.py
+++ b/atr/tasks/checks/__init__.py
@@ -207,12 +207,19 @@ class Recorder:
         self.__input_hash = await _compute_file_hash(path)
 
         async with db.session() as data:
-            stmt = (
-                sqlmodel.select(sql.CheckResult)
+            via = sql.validate_instrumented_attribute
+            subquery = (
+                sqlmodel.select(
+                    sql.CheckResult.member_rel_path,
+                    sqlmodel.func.max(via(sql.CheckResult.id)).label("max_id"),
+                )
                 .where(sql.CheckResult.checker == self.checker)
                 .where(sql.CheckResult.input_hash == self.__input_hash)
                 .where(sql.CheckResult.primary_rel_path == 
self.primary_rel_path)
+                .group_by(sql.CheckResult.member_rel_path)
+                .subquery()
             )
+            stmt = sqlmodel.select(sql.CheckResult).join(subquery, 
via(sql.CheckResult.id) == subquery.c.max_id)
             results = await data.execute(stmt)
             cached_results = results.scalars().all()
 
diff --git a/tests/e2e/sbom/conftest.py b/tests/e2e/sbom/conftest.py
index 6e8e003..0801444 100644
--- a/tests/e2e/sbom/conftest.py
+++ b/tests/e2e/sbom/conftest.py
@@ -46,6 +46,7 @@ def page_release_with_file(page: Page) -> Generator[Page]:
     helpers.visit(page, f"/upload/{PROJECT_NAME}/{VERSION_NAME}")
     
page.locator('input[name="file_data"]').set_input_files(f"{CURRENT_DIR}/../test_files/{FILE_NAME}")
     page.get_by_role("button", name="Add files").click()
+    page.wait_for_url(f"**/compose/{PROJECT_NAME}/{VERSION_NAME}")
     helpers.visit(page, f"/compose/{PROJECT_NAME}/{VERSION_NAME}")
     page.wait_for_selector("#ongoing-tasks-banner", state="hidden")
     yield page


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

Reply via email to