developer-ravi-03 commented on code in PR #456:
URL: 
https://github.com/apache/tooling-trusted-releases/pull/456#discussion_r2664678906


##########
atr/datasources/apache.py:
##########
@@ -365,35 +365,52 @@ async def _update_committees(
     added_count = 0
     updated_count = 0
 
-    # First create PMC committees
+    added_committees: list[str] = []
+    updated_committees: list[str] = []
+
+    
     for project in ldap_projects.projects:
         name = project.name
-        # Skip non-PMC committees
+
+        
         if project.pmc is not True:
             continue
 
-        # Get or create PMC
         committee = await data.committee(name=name).get()
         if not committee:
             committee = sql.Committee(name=name)
             data.add(committee)
             added_count += 1
+            added_committees.append(name)
         else:
-            updated_count += 1
+            updated_committees.append(name)

Review Comment:
   If the committee already exists, it is treated as an update.
   The committee name is recorded in updated_committees to track changes made 
during synchronization.



##########
atr/datasources/apache.py:
##########
@@ -365,35 +365,52 @@ async def _update_committees(
     added_count = 0
     updated_count = 0
 
-    # First create PMC committees
+    added_committees: list[str] = []

Review Comment:
   Introduced lists to track committee names that are newly added or updated 
during automatic synchronization.
   These are later used to provide structured details in the audit log.



##########
atr/datasources/apache.py:
##########
@@ -365,35 +365,52 @@ async def _update_committees(
     added_count = 0
     updated_count = 0
 
-    # First create PMC committees
+    added_committees: list[str] = []
+    updated_committees: list[str] = []
+
+    
     for project in ldap_projects.projects:
         name = project.name
-        # Skip non-PMC committees
+
+        
         if project.pmc is not True:
             continue
 
-        # Get or create PMC
         committee = await data.committee(name=name).get()
         if not committee:
             committee = sql.Committee(name=name)
             data.add(committee)
             added_count += 1
+            added_committees.append(name)

Review Comment:
   When a committee does not already exist in the database, it is created here.
   The committee name is recorded in added_committees so the audit log can 
capture which committees were newly added during this sync.



##########
atr/datasources/apache.py:
##########
@@ -365,35 +365,52 @@ async def _update_committees(
     added_count = 0
     updated_count = 0
 
-    # First create PMC committees
+    added_committees: list[str] = []
+    updated_committees: list[str] = []
+
+    
     for project in ldap_projects.projects:
         name = project.name
-        # Skip non-PMC committees
+
+        
         if project.pmc is not True:
             continue
 
-        # Get or create PMC
         committee = await data.committee(name=name).get()
         if not committee:
             committee = sql.Committee(name=name)
             data.add(committee)
             added_count += 1
+            added_committees.append(name)
         else:
-            updated_count += 1
+            updated_committees.append(name)
 
         committee.committee_members = project.owners
         committee.committers = project.members
-        # We create PMCs for now
         committee.is_podling = False
+
         committee_info = committees_by_name.get(name)
         if committee_info:
             committee.full_name = committee_info.display_name
 
+        
         updated_count += 1
 
+    
+    if added_committees or updated_committees:
+        log.audit(
+            action="committee_sync",
+            source="apache_whimsy",
+            details={
+                "added": sorted(added_committees),

Review Comment:
   The lists are sorted before logging to ensure deterministic and readable 
audit log output, which helps with debugging and future comparisons.



##########
atr/datasources/apache.py:
##########
@@ -365,35 +365,52 @@ async def _update_committees(
     added_count = 0
     updated_count = 0
 
-    # First create PMC committees
+    added_committees: list[str] = []
+    updated_committees: list[str] = []
+
+    
     for project in ldap_projects.projects:
         name = project.name
-        # Skip non-PMC committees
+
+        
         if project.pmc is not True:
             continue
 
-        # Get or create PMC
         committee = await data.committee(name=name).get()
         if not committee:
             committee = sql.Committee(name=name)
             data.add(committee)
             added_count += 1
+            added_committees.append(name)
         else:
-            updated_count += 1
+            updated_committees.append(name)
 
         committee.committee_members = project.owners
         committee.committers = project.members
-        # We create PMCs for now
         committee.is_podling = False
+
         committee_info = committees_by_name.get(name)
         if committee_info:
             committee.full_name = committee_info.display_name
 
+        
         updated_count += 1
 
+    
+    if added_committees or updated_committees:
+        log.audit(

Review Comment:
   This audit log entry records the result of the automatic committee 
synchronization.
   It captures both added and updated committees in a structured format, making 
it easier to trace what changed, when, and from which source (Apache Whimsy).



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