@@ -834,53 +834,6 @@ def write_results(endpoint_counts, operation_samples, stats, swagger_mapper=None
834
834
for endpoint , count in sorted_endpoints :
835
835
output .append (f"{ endpoint } | { count } " )
836
836
837
- # Find and display missing endpoints from Swagger spec
838
- if swagger_mapper and swagger_mapper .path_to_operation :
839
- all_swagger_operations = set (swagger_mapper .path_to_operation .values ())
840
- found_operations = set (endpoint_counts .keys ())
841
-
842
- # Only count operations that are actually from Swagger (not fallback)
843
- swagger_found = found_operations & all_swagger_operations
844
- missing_operations = all_swagger_operations - swagger_found
845
-
846
- # Filter out alpha and beta versions from missing operations
847
- stable_missing_operations = {
848
- op for op in missing_operations
849
- if not any (version in op for version in
850
- ['V1alpha' , 'V1beta' , 'V2alpha' , 'V2beta' , 'V3alpha' , 'V3beta' , 'alpha' , 'beta' ])
851
- }
852
-
853
- # Filter out ineligible endpoints from missing operations
854
- if ineligible_endpoints :
855
- stable_missing_operations = stable_missing_operations - ineligible_endpoints
856
-
857
- # Filter out pending eligible endpoints from missing operations
858
- if pending_eligible_endpoints :
859
- stable_missing_operations = stable_missing_operations - pending_eligible_endpoints
860
-
861
- # Filter out deprecated operations from missing operations
862
- if deprecated_operations :
863
- stable_missing_operations = stable_missing_operations - deprecated_operations
864
-
865
- if stable_missing_operations :
866
- filtered_count = len (missing_operations ) - len (stable_missing_operations )
867
-
868
- output .append ("" )
869
- output .append ("=" * 70 )
870
- output .append ("STABLE ENDPOINTS NOT FOUND IN AUDIT LOG" )
871
- output .append ("=" * 70 )
872
- output .append (f"Total missing stable endpoints: { len (stable_missing_operations )} " )
873
- if filtered_count > 0 :
874
- output .append (
875
- f"(Filtered out { filtered_count } alpha/beta/deprecated/ineligible/pending eligible endpoints)" )
876
- output .append (
877
- f"These are stable, non-deprecated API endpoints defined in the Swagger spec but not exercised in this audit log:" )
878
- output .append ("" )
879
-
880
- # Sort missing operations alphabetically
881
- for operation in sorted (stable_missing_operations ):
882
- output .append (f"{ operation } | NOT FOUND" )
883
-
884
837
result_text = "\n " .join (output )
885
838
886
839
if output_file :
@@ -900,6 +853,61 @@ def write_results(endpoint_counts, operation_samples, stats, swagger_mapper=None
900
853
_write_audit_operations_json (filtered_endpoint_counts , operation_samples , ineligible_endpoints ,
901
854
pending_eligible_endpoints , deprecated_operations , audit_operations_json )
902
855
856
+ # Find and display missing endpoints from Swagger spec
857
+ if swagger_mapper and swagger_mapper .path_to_operation :
858
+ warn_on_missing_stable_endpoints (deprecated_operations , endpoint_counts , ineligible_endpoints ,
859
+ pending_eligible_endpoints , swagger_mapper )
860
+
861
+
862
+ def warn_on_missing_stable_endpoints (deprecated_operations , endpoint_counts , ineligible_endpoints ,
863
+ pending_eligible_endpoints , swagger_mapper ):
864
+ all_swagger_operations = set (swagger_mapper .path_to_operation .values ())
865
+ found_operations = set (endpoint_counts .keys ())
866
+ # Only count operations that are actually from Swagger (not fallback)
867
+ swagger_found = found_operations & all_swagger_operations
868
+ missing_operations = all_swagger_operations - swagger_found
869
+ # Filter out alpha and beta versions from missing operations
870
+ stable_missing_operations = {
871
+ op for op in missing_operations
872
+ if not any (version in op for version in
873
+ ['V1alpha' , 'V1beta' , 'V2alpha' , 'V2beta' , 'V3alpha' , 'V3beta' , 'alpha' , 'beta' ])
874
+ }
875
+ # Filter out ineligible endpoints from missing operations
876
+ if ineligible_endpoints :
877
+ stable_missing_operations = stable_missing_operations - ineligible_endpoints
878
+ # Filter out pending eligible endpoints from missing operations
879
+ if pending_eligible_endpoints :
880
+ stable_missing_operations = stable_missing_operations - pending_eligible_endpoints
881
+ # Filter out deprecated operations from missing operations
882
+ if deprecated_operations :
883
+ stable_missing_operations = stable_missing_operations - deprecated_operations
884
+ if stable_missing_operations :
885
+ filtered_count = len (missing_operations ) - len (stable_missing_operations )
886
+
887
+ # Log stable missing operations directly to stdout (not to output file)
888
+ print ("" )
889
+ print ("=" * 70 )
890
+ print ("STABLE ENDPOINTS NOT FOUND IN AUDIT LOG" )
891
+ print ("=" * 70 )
892
+ print (f"Total missing stable endpoints: { len (stable_missing_operations )} " )
893
+ if filtered_count > 0 :
894
+ print (f"(Filtered out { filtered_count } alpha/beta/deprecated/ineligible/pending eligible endpoints)" )
895
+ print (
896
+ "These are stable, non-deprecated API endpoints defined in the Swagger spec but not exercised in this audit log:" )
897
+ print ()
898
+
899
+ # Sort missing operations alphabetically
900
+ for operation in sorted (stable_missing_operations ):
901
+ print (f"{ operation } | NOT FOUND" )
902
+
903
+ print ()
904
+ print ("ACTION REQUIRED:" )
905
+ print ("For each missing stable endpoint, please either:" )
906
+ print ("1. Add conformance tests to exercise these API operations, OR" )
907
+ print ("2. Add them to pending_eligible_endpoints.yaml if they should be excluded from conformance testing" )
908
+ print ()
909
+ sys .exit (1 )
910
+
903
911
904
912
def _write_audit_operations_json (filtered_endpoint_counts , operation_samples , ineligible_endpoints ,
905
913
pending_eligible_endpoints , deprecated_operations ,
0 commit comments