@@ -686,7 +686,6 @@ def make_msi(self) -> None:
686686
687687
688688class ReleaseValidation :
689- SOURCE_TREE = "src/subsearch"
690689 MARKER = "release-validation"
691690 RESULT_PASSED = "passed"
692691 RESULT_FAILED = "failed"
@@ -696,10 +695,8 @@ class ReleaseValidation:
696695 BODY_BLOCK_START = "<!-- release-validation:start -->"
697696 BODY_BLOCK_END = "<!-- release-validation:end -->"
698697
699- # Matches the marker HTML comment: <!-- release-validation:result=passed;src=<hash>;run=<id> -->
700- _STATE_PATTERN = re .compile (
701- r"<!--\s*release-validation:result=(?P<result>\w+);src=(?P<src>[0-9a-f]+);run=(?P<run>\d+)\s*-->"
702- )
698+ # Matches the marker HTML comment: <!-- release-validation:result=passed;run=<id> -->
699+ _STATE_PATTERN = re .compile (r"<!--\s*release-validation:result=(?P<result>\w+);run=(?P<run>\d+)\s*-->" )
703700
704701 def open_release_pr (self ) -> str | None :
705702 completed = subprocess .run (
@@ -727,25 +724,7 @@ def open_release_pr(self) -> str | None:
727724 number = completed .stdout .strip ()
728725 return number or None
729726
730- def src_tree_hash (self , commit : str = "HEAD" ) -> str :
731- completed = subprocess .run (
732- ["git" , "rev-parse" , f"{ commit } :{ self .SOURCE_TREE } " ],
733- check = True ,
734- capture_output = True ,
735- text = True ,
736- )
737- return completed .stdout .strip ()
738-
739- def pr_head_sha (self , number : str ) -> str :
740- completed = subprocess .run (
741- ["gh" , "pr" , "view" , number , "--json" , "headRefOid" , "--jq" , ".headRefOid" ],
742- check = True ,
743- capture_output = True ,
744- text = True ,
745- )
746- return completed .stdout .strip ()
747-
748- def last_validation (self , number : str ) -> tuple [str , str , str ] | None :
727+ def last_validation (self , number : str ) -> tuple [str , str ] | None :
749728 completed = subprocess .run (
750729 ["gh" , "pr" , "view" , number , "--json" , "comments" , "--jq" , ".comments[].body" ],
751730 check = True ,
@@ -759,23 +738,21 @@ def last_validation(self, number: str) -> tuple[str, str, str] | None:
759738 match = found
760739 if match is None :
761740 return None
762- return match .group ("src" ), match . group ( " result" ), match .group ("run" )
741+ return match .group ("result" ), match .group ("run" )
763742
764743 def should_validate (self , number : str ) -> bool :
765744 previous = self .last_validation (number )
766745 if previous is None :
767746 return True
768- validated_src , result , _ = previous
769- if result != self .RESULT_PASSED :
770- return True
771- return validated_src != self .src_tree_hash (self .pr_head_sha (number ))
747+ result , _ = previous
748+ return result != self .RESULT_PASSED
772749
773- def _marker_body (self , src_tree_hash : str , result : str , run_id : str ) -> str :
774- comment = f"<!-- { self .MARKER } :result={ result } ;src= { src_tree_hash } ; run={ run_id } -->"
750+ def _marker_body (self , result : str , run_id : str ) -> str :
751+ comment = f"<!-- { self .MARKER } :result={ result } ;run={ run_id } -->"
775752 passed = result == self .RESULT_PASSED
776753 validation_outcome = "passed" if passed else "failed"
777754 status = f"Release validation { validation_outcome } "
778- return f"{ comment } \n **{ status } ** — src tree ` { src_tree_hash } ` (run { run_id } )"
755+ return f"{ comment } \n **{ status } ** (run { run_id } )"
779756
780757 def _has_marker_comment (self , number : str ) -> bool :
781758 completed = subprocess .run (
@@ -787,9 +764,9 @@ def _has_marker_comment(self, number: str) -> bool:
787764 comments = json .loads (completed .stdout )["comments" ]
788765 return any (f"<!-- { self .MARKER } :" in comment ["body" ] for comment in comments )
789766
790- def _body_block (self , src_tree_hash : str , result : str , run_id : str ) -> str :
767+ def _body_block (self , result : str , run_id : str ) -> str :
791768 outcome = "passed" if result == self .RESULT_PASSED else "failed"
792- line = f"###### Release validation { outcome } — src tree ` { src_tree_hash } ` (run { run_id } )"
769+ line = f"###### Release validation { outcome } (run { run_id } )"
793770 return "\n " .join ([self .BODY_BLOCK_START , line , self .BODY_BLOCK_END ])
794771
795772 def _replace_body_block (self , body : str , block : str ) -> str :
@@ -801,22 +778,22 @@ def _replace_body_block(self, body: str, block: str) -> str:
801778 return f"{ block } \n \n { body } "
802779 return body [:start ] + block + body [end + len (self .BODY_BLOCK_END ) :]
803780
804- def _update_body (self , number : str , src_tree_hash : str , result : str , run_id : str ) -> None :
781+ def _update_body (self , number : str , result : str , run_id : str ) -> None :
805782 completed = subprocess .run (
806783 ["gh" , "pr" , "view" , number , "--json" , "body" , "--jq" , ".body" ],
807784 check = True ,
808785 capture_output = True ,
809786 text = True ,
810787 )
811788 existing_body = completed .stdout .rstrip ("\n " )
812- block = self ._body_block (src_tree_hash , result , run_id )
789+ block = self ._body_block (result , run_id )
813790 new_body = self ._replace_body_block (existing_body , block )
814791 subprocess .run (["gh" , "pr" , "edit" , number , "--body" , new_body ], check = True )
815792
816- def record_validation (self , number : str , src_tree_hash : str , result : str , run_id : str ) -> None :
817- body = self ._marker_body (src_tree_hash , result , run_id )
793+ def record_validation (self , number : str , result : str , run_id : str ) -> None :
794+ body = self ._marker_body (result , run_id )
818795 command = ["gh" , "pr" , "comment" , number , "--body" , body ]
819796 if self ._has_marker_comment (number ):
820797 command .append ("--edit-last" )
821798 subprocess .run (command , check = True )
822- self ._update_body (number , src_tree_hash , result , run_id )
799+ self ._update_body (number , result , run_id )
0 commit comments