sbp commented on code in PR #1186:
URL: 
https://github.com/apache/tooling-trusted-releases/pull/1186#discussion_r3183931484


##########
atr/get/vote.py:
##########
@@ -678,14 +678,15 @@ async def _render_vote_authenticated(
 
     potency = binding_word if is_binding else non_binding_word
     _render_binding_status(page, is_binding, binding_committee, vote_round)
-    _render_vote_delivery(page, archive_url, vote_recipient, 
trusted_vote=False)
+    _render_vote_delivery(page, release, archive_url, vote_recipient, 
trusted_vote=False)

Review Comment:
   The code may have changed in the meantime or something, because the actual 
function argument order is now `archive_url, release`.



##########
atr/storage/writers/project.py:
##########
@@ -186,17 +188,59 @@ async def create(self, committee_key: safe.CommitteeKey, 
display_name: str, labe
             else:
                 raise
 
+    async def archive(self, project_key: safe.ProjectKey) -> None:
+        project = await self.__data.project(key=str(project_key), 
status=sql.ProjectStatus.ACTIVE, _releases=True).get()
+
+        if not project:
+            raise storage.AccessError(f"Project '{project_key}' not found.")
+
+        # TODO: once release archival is implemented, relax this further
+        post_draft_phases = {
+            sql.ReleasePhase.RELEASE_CANDIDATE,
+            sql.ReleasePhase.RELEASE_PREVIEW,
+            sql.ReleasePhase.RELEASE,
+        }
+        if any(r.phase in post_draft_phases for r in project.releases):

Review Comment:
   So this means that a project can be archived when it has draft releases? If 
so, it appears that the `delete` function in `atr.storage.writers.release` 
can't be used to later delete those drafts, because it now checks 
`storage.ensure_project_active(release.project)`. Therefore, if a project is 
archived when it has draft releases, those releases will be stranded.



##########
atr/storage/writers/revision.py:
##########
@@ -394,6 +394,10 @@ async def clear_quarantine(
         version_key: safe.VersionKey,
         quarantined_id: int,
     ) -> None:
+        project = await self.__data.project(key=str(project_key)).demand(
+            storage.AccessError(f"Project '{project_key}' not found.")
+        )
+        storage.ensure_project_active(project)

Review Comment:
   The `set_tag` method in this module is missing 
`storage.ensure_project_active`. Ideally we'd make this the default, then opt 
out if we want to allow the action for non-active projects, but I'm not sure 
how to best go about that.
   



##########
atr/storage/writers/project.py:
##########
@@ -186,17 +188,59 @@ async def create(self, committee_key: safe.CommitteeKey, 
display_name: str, labe
             else:
                 raise
 
+    async def archive(self, project_key: safe.ProjectKey) -> None:
+        project = await self.__data.project(key=str(project_key), 
status=sql.ProjectStatus.ACTIVE, _releases=True).get()
+
+        if not project:
+            raise storage.AccessError(f"Project '{project_key}' not found.")
+
+        # TODO: once release archival is implemented, relax this further
+        post_draft_phases = {
+            sql.ReleasePhase.RELEASE_CANDIDATE,
+            sql.ReleasePhase.RELEASE_PREVIEW,
+            sql.ReleasePhase.RELEASE,
+        }
+        if any(r.phase in post_draft_phases for r in project.releases):

Review Comment:
   In general, what was the intent behind allowing a release to be archived if 
it has draft releases? I remember we discussed this, but I don't remember what 
the outcome was.



-- 
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]

Reply via email to