@@ -63,7 +63,10 @@ def create_mock_response(
6363def parse_auth_policy_entity (request : httpx .Request ) -> Optional [tuple [str , str , str ]]:
6464 """
6565 Parse the request body and return (policy_name, persona_guid, temp_guid)
66- if the request is a bulk POST containing an AuthPolicy, else None.
66+ if the request is a bulk POST containing a NEW AuthPolicy creation, else None.
67+
68+ Only matches policy CREATES (temp GUIDs starting with "-"), not UPDATES
69+ (real GUIDs), to prevent suppressing legitimate policy modifications.
6770 """
6871 if request .method != "POST" or BULK_UPDATE .path not in str (request .url ):
6972 return None
@@ -81,13 +84,24 @@ def parse_auth_policy_entity(request: httpx.Request) -> Optional[tuple[str, str,
8184 for entity in body .get ("entities" , []):
8285 if entity .get ("typeName" ) != "AuthPolicy" :
8386 continue
87+
88+ entity_guid = entity .get ("guid" , "-1" )
89+ # Only match policy CREATES (temp GUIDs like "-1", "-2", etc.)
90+ # Skip policy UPDATES (real GUIDs) to avoid suppressing modifications
91+ if not isinstance (entity_guid , str ) or not entity_guid .startswith ("-" ):
92+ logger .debug (
93+ "parse_auth_policy_entity: skipping duplicate check for policy with GUID %s (likely an update or invalid type)" ,
94+ entity_guid ,
95+ )
96+ continue
97+
8498 policy_name = entity .get ("attributes" , {}).get ("name" )
8599 access_control = entity .get ("attributes" , {}).get ("accessControl" )
86100 persona_guid = (
87101 access_control .get ("guid" ) if isinstance (access_control , dict ) else None
88102 )
89103 if policy_name and persona_guid :
90- return policy_name , persona_guid , entity . get ( "guid" , "-1" )
104+ return policy_name , persona_guid , entity_guid
91105 return None
92106
93107
0 commit comments