alitheg commented on code in PR #746:
URL:
https://github.com/apache/tooling-trusted-releases/pull/746#discussion_r2834198551
##########
atr/api/__init__.py:
##########
@@ -75,24 +76,24 @@ async def checks_list(project: str, version: str) ->
DictResponse:
# TODO: Add phase in the response, and the revision too
_simple_check(project, version)
# TODO: Merge with checks_list_project_version_revision
+
async with db.session() as data:
release_name = sql.release_name(project, version)
release = await
data.release(name=release_name).demand(exceptions.NotFound(f"Release
{release_name} not found"))
- check_results = await
data.check_result(release_name=release_name).all()
-
- revision = None
- for check_result in check_results:
- if revision is None:
- revision = check_result.revision_number
- elif revision != check_result.revision_number:
- raise exceptions.InternalServerError("Revision mismatch")
- if revision is None:
- raise exceptions.InternalServerError("No revision found")
+ if not release.latest_revision_number:
+ raise exceptions.InternalServerError("No latest revision found")
+ file_path_checks = await attestable.load_checks(project, version,
release.latest_revision_number)
+ if file_path_checks:
+ check_results = await data.check_result(
+ inputs_hash_in=[h for inner in file_path_checks.values() for h
in inner.values()]
+ ).all()
+ else:
+ check_results = []
Review Comment:
With check data coming from revision attestable data - we must have a
revision on the release object to return any checks, so this revision by check
logic isn't required I don't think
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]