feat(python/robomp): implemented has_authorized_impl_event in the
- Implement `has_authorized_impl_event` in the database to retrieve historical authorization state. - Update `_enforce_impl_authorization` to permit actions if prior events on the issue provided implementation authorization. - Normalize maintainer logins by stripping `[bot]` suffixes and allow match-regex to ignore them.
This commit is contained in:
@@ -607,6 +607,26 @@ class Database:
|
||||
last_error=row["last_error"],
|
||||
)
|
||||
|
||||
def has_authorized_impl_event(self, issue_key: str) -> bool:
|
||||
"""Return whether a non-skipped event on this issue carried implementation authorization."""
|
||||
with self._lock:
|
||||
rows = self._conn.execute(
|
||||
"""
|
||||
SELECT payload_json
|
||||
FROM events
|
||||
WHERE issue_key = ?
|
||||
AND state <> 'skipped'
|
||||
ORDER BY received_at DESC
|
||||
""",
|
||||
(issue_key,),
|
||||
).fetchall()
|
||||
for row in rows:
|
||||
payload = json.loads(row["payload_json"])
|
||||
directive = payload.get("_robomp_directive")
|
||||
if isinstance(directive, dict) and directive.get("authorizes_impl") is True:
|
||||
return True
|
||||
return False
|
||||
|
||||
def requeue_event(
|
||||
self,
|
||||
delivery_id: str,
|
||||
|
||||
Reference in New Issue
Block a user