2727from pathlib import Path
2828import re
2929import shutil
30- import subprocess
3130import tempfile
3231
3332
@@ -433,59 +432,7 @@ def validate_invariants(sdd: str, errors: list[str]) -> int:
433432 return len (ids )
434433
435434
436- def git_changed_paths (root : Path , baseline_ref : str , errors : list [str ]) -> set [str ]:
437- object_check = subprocess .run (
438- ["git" , "-C" , str (root ), "cat-file" , "-e" , f"{ baseline_ref } ^{{commit}}" ],
439- capture_output = True ,
440- text = True ,
441- encoding = "utf-8" ,
442- check = False ,
443- )
444- if object_check .returncode != 0 :
445- errors .append (f"baseline_ref is not available as a Git commit: { baseline_ref } " )
446- return set ()
447-
448- diff = subprocess .run (
449- ["git" , "-C" , str (root ), "diff" , "--name-only" , baseline_ref , "--" ],
450- capture_output = True ,
451- text = True ,
452- encoding = "utf-8" ,
453- check = False ,
454- )
455- whitespace = subprocess .run (
456- ["git" , "-C" , str (root ), "diff" , "--check" , baseline_ref , "--" ],
457- capture_output = True ,
458- text = True ,
459- encoding = "utf-8" ,
460- check = False ,
461- )
462- untracked = subprocess .run (
463- ["git" , "-C" , str (root ), "ls-files" , "--others" , "--exclude-standard" ],
464- capture_output = True ,
465- text = True ,
466- encoding = "utf-8" ,
467- check = False ,
468- )
469- if whitespace .returncode != 0 :
470- details = (whitespace .stdout + whitespace .stderr ).strip ()
471- errors .append (f"WP0 committed/working diff has whitespace errors: { details } " )
472- if diff .returncode != 0 or untracked .returncode != 0 :
473- errors .append ("unable to compute WP0 changed paths from baseline_ref" )
474- return set ()
475- return {
476- path .strip ().replace ("\\ " , "/" )
477- for path in (diff .stdout + "\n " + untracked .stdout ).splitlines ()
478- if path .strip ()
479- }
480-
481-
482- def validate_artifacts (
483- root : Path ,
484- sdd : str ,
485- fields : dict [str , str ],
486- errors : list [str ],
487- check_git_diff : bool ,
488- ) -> None :
435+ def validate_artifacts (root : Path , sdd : str , errors : list [str ]) -> None :
489436 expected = set (EXPECTED_WP0_ARTIFACTS )
490437 wp0 = work_package_blocks (sdd ).get ("WP0" , "" )
491438 scope_match = re .search (
@@ -527,14 +474,6 @@ def validate_artifacts(
527474 if len (text .splitlines ()) > 20 :
528475 errors .append (f"legacy pointer must not maintain an independent state copy: { relative } " )
529476
530- if check_git_diff and fields .get ("current_work_package" ) == "WP0" :
531- changed = git_changed_paths (root , fields .get ("baseline_ref" , "" ), errors )
532- if changed != expected :
533- errors .append (
534- "WP0 changed paths differ from the expected artifact registry: "
535- f"missing={ sorted (expected - changed )} , unexpected={ sorted (changed - expected )} "
536- )
537-
538477
539478def validate_markdown (
540479 root : Path ,
@@ -610,7 +549,6 @@ def validate_governance_terms(root: Path, errors: list[str]) -> None:
610549def validate (
611550 root : Path ,
612551 * ,
613- check_git_diff : bool = True ,
614552 check_markdown : bool = True ,
615553 markdown_paths : tuple [str , ...] | None = None ,
616554) -> tuple [list [str ], dict [str , object ]]:
@@ -629,7 +567,7 @@ def validate(
629567 validate_current_state (sdd , fields , errors )
630568 validate_wp0_gate_contract (sdd , errors )
631569 invariant_count = validate_invariants (sdd , errors )
632- validate_artifacts (root , sdd , fields , errors , check_git_diff )
570+ validate_artifacts (root , sdd , errors )
633571 if check_markdown :
634572 validate_markdown (root , errors , markdown_paths )
635573 validate_governance_terms (root , errors )
@@ -673,7 +611,6 @@ def expect_failure(
673611 mutation (candidate )
674612 errors , _ = validate (
675613 candidate ,
676- check_git_diff = False ,
677614 check_markdown = check_markdown ,
678615 markdown_paths = markdown_paths ,
679616 )
@@ -744,7 +681,6 @@ def add_deprecated_issue_keyword(candidate: Path) -> None:
744681 )
745682 prose_errors , _ = validate (
746683 candidate ,
747- check_git_diff = False ,
748684 check_markdown = False ,
749685 )
750686 deprecated_errors = [
@@ -975,7 +911,7 @@ def remove_live_gate(candidate: Path) -> None:
975911 suffix = suffix .replace ("| Status | in-progress |" , "| Status | implemented |" , 1 )
976912 path .write_text (prefix + suffix , encoding = "utf-8" )
977913 lifecycle_errors , _ = validate (
978- candidate , check_git_diff = False , check_markdown = False
914+ candidate , check_markdown = False
979915 )
980916 if lifecycle_errors :
981917 raise AssertionError (f"implemented lifecycle state must remain valid: { lifecycle_errors } " )
0 commit comments