claude-dev-env 8.109.6 → 8.109.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -769,3 +769,138 @@ def test_cli_accepts_a_repository(tmp_path: Path) -> None:
769
769
  )
770
770
  assert completed_process.returncode == 0
771
771
  assert completed_process.stderr == ""
772
+
773
+
774
+ def _repository_adding_workflow(tmp_path: Path, workflow_name: str) -> Path:
775
+ git_identity = ["-c", "user.name=t", "-c", "user.email=t@example.com"]
776
+ repository_path = tmp_path / "repository"
777
+ subprocess.run(
778
+ ["git", "init", "-q", "-b", "main", str(repository_path)], check=True
779
+ )
780
+ (repository_path / "readme.md").write_text("base\n", encoding="utf-8")
781
+ subprocess.run(["git", "-C", str(repository_path), "add", "."], check=True)
782
+ subprocess.run(
783
+ [
784
+ "git",
785
+ "-C",
786
+ str(repository_path),
787
+ *git_identity,
788
+ "commit",
789
+ "-q",
790
+ "-m",
791
+ "base",
792
+ ],
793
+ check=True,
794
+ )
795
+ subprocess.run(
796
+ ["git", "-C", str(repository_path), "checkout", "-q", "-b", "feature"],
797
+ check=True,
798
+ )
799
+ subprocess.run(
800
+ ["git", "-C", str(repository_path), "remote", "add", "origin", "https://github.com/o/r.git"],
801
+ check=True,
802
+ )
803
+ workflow_directory = repository_path / ".github" / "workflows"
804
+ workflow_directory.mkdir(parents=True)
805
+ (workflow_directory / workflow_name).write_text("name: added\n", encoding="utf-8")
806
+ subprocess.run(["git", "-C", str(repository_path), "add", "."], check=True)
807
+ subprocess.run(
808
+ [
809
+ "git",
810
+ "-C",
811
+ str(repository_path),
812
+ *git_identity,
813
+ "commit",
814
+ "-q",
815
+ "-m",
816
+ "change",
817
+ ],
818
+ check=True,
819
+ )
820
+ return repository_path
821
+
822
+
823
+ def _unproven_workflow_body(after_merge_section: str) -> str:
824
+ return (
825
+ VALID_PR_BODY.replace(
826
+ "on the new body.",
827
+ "on the new body.\n\nNot proven here: the live GitHub Actions run.",
828
+ )
829
+ + after_merge_section
830
+ )
831
+
832
+
833
+ def should_accept_an_unproven_run_when_the_branch_adds_the_workflow_its_after_merge_section_names(
834
+ tmp_path: Path, monkeypatch: pytest.MonkeyPatch
835
+ ) -> None:
836
+ monkeypatch.chdir(_repository_adding_workflow(tmp_path, "release-hold.yml"))
837
+ after_merge_section = (
838
+ "\n## After merge\n\nThe first owner approval runs `release-hold.yml`."
839
+ " The agent records that run link here.\n"
840
+ )
841
+ all_findings = durable_post_lint.lint_durable_post(
842
+ action="pr-create",
843
+ title="feat: release the hold label",
844
+ body_text=_unproven_workflow_body(after_merge_section),
845
+ head_branch="feature",
846
+ repository="o/r",
847
+ )
848
+ assert all_findings == ()
849
+
850
+
851
+ def should_report_an_unproven_run_when_the_checkout_belongs_to_another_repository(
852
+ tmp_path: Path, monkeypatch: pytest.MonkeyPatch
853
+ ) -> None:
854
+ monkeypatch.chdir(_repository_adding_workflow(tmp_path, "release-hold.yml"))
855
+ after_merge_section = (
856
+ "\n## After merge\n\nThe first owner approval runs `release-hold.yml`."
857
+ " The agent records that run link here.\n"
858
+ )
859
+ all_findings = durable_post_lint.lint_durable_post(
860
+ action="pr-create",
861
+ title="feat: release the hold label",
862
+ body_text=_unproven_workflow_body(after_merge_section),
863
+ head_branch="feature",
864
+ repository="x/y",
865
+ )
866
+ assert [each_finding.code for each_finding in all_findings] == [
867
+ durable_post_lint.PULL_REQUEST_PROOF_FINDING_CODE
868
+ ]
869
+
870
+
871
+ def should_report_an_unproven_run_when_no_head_branch_is_named(
872
+ tmp_path: Path, monkeypatch: pytest.MonkeyPatch
873
+ ) -> None:
874
+ monkeypatch.chdir(_repository_adding_workflow(tmp_path, "release-hold.yml"))
875
+ after_merge_section = (
876
+ "\n## After merge\n\nThe first owner approval runs `release-hold.yml`."
877
+ " The agent records that run link here.\n"
878
+ )
879
+ all_findings = durable_post_lint.lint_durable_post(
880
+ action="pr-create",
881
+ title="feat: release the hold label",
882
+ body_text=_unproven_workflow_body(after_merge_section),
883
+ head_branch=None,
884
+ repository="o/r",
885
+ )
886
+ assert [each_finding.code for each_finding in all_findings] == [
887
+ durable_post_lint.PULL_REQUEST_PROOF_FINDING_CODE
888
+ ]
889
+
890
+
891
+ def should_report_an_unproven_run_when_the_after_merge_section_names_another_workflow(
892
+ tmp_path: Path, monkeypatch: pytest.MonkeyPatch
893
+ ) -> None:
894
+ monkeypatch.chdir(_repository_adding_workflow(tmp_path, "release-hold.yml"))
895
+ after_merge_section = "\n## After merge\n\nThe first owner approval runs `other.yml`. The agent records that run link here.\n"
896
+ all_findings = durable_post_lint.lint_durable_post(
897
+ action="pr-create",
898
+ title="feat: release the hold label",
899
+ body_text=_unproven_workflow_body(after_merge_section),
900
+ head_branch="feature",
901
+ repository="o/r",
902
+ )
903
+ assert [each_finding.code for each_finding in all_findings] == [
904
+ durable_post_lint.PULL_REQUEST_PROOF_FINDING_CODE
905
+ ]
906
+ assert "Not proven here: the live GitHub Actions run." in all_findings[0].message