:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(visual-review): stop a story deletion failing every batched PR (#89479)
Julian Bez55c523e5d5d0
diff --git a/products/visual_review/backend/logic/baselines.py b/products/visual_review/backend/logic/baselines.pyindex d7597d471aaf..d9166906412c 100644--- a/products/visual_review/backend/logic/baselines.py+++ b/products/visual_review/backend/logic/baselines.py@@ -122,7 +122,12 @@ def _resolve_baselines(repo, run_type: str, branch: str) -> dict[str, str]:def _resolve_baselines_with_merge_base(- repo: Repo, run_type: str, branch: str, commit_sha: str | None = None+ repo: Repo,+ run_type: str,+ branch: str,+ *,+ rendered_identifiers: set[str],+ commit_sha: str | None = None,) -> tuple[dict[str, str], int]:"""Fetch branch baseline merged with merge-base baseline.@@ -131,14 +136,29 @@ def _resolve_baselines_with_merge_base(rewrites the full file, and git rebase replays it destructively).Branch entries win on conflict so approvals are preserved.+ On a merge-queue branch, healing is limited to identifiers this run+ rendered. An entry missing from the branch baseline whose story still+ renders is the rebase loss above. An entry missing from both is one the+ branch deleted on purpose, and restoring it only manufactures a REMOVED+ that no one on a queue branch can approve, so it reds the batch and every+ pull request sharing it until the deleting one lands.++ Ordinary branches keep healing everything, because there the REMOVED is+ the review gate: it is how a reviewer is asked to confirm that a story+ should go. The queue signal is the server-verified source PR rather than+ the branch name, which is client-supplied — matching the name alone would+ let any caller skip that gate. When verification fails the filter stays+ off, so a GitHub blip costs a red batch rather than a silent removal.+Identifiers previously approved as REMOVED on this branch aretombstoned — healing would otherwise resurrect them from masterand re-flag them as removed on every subsequent run.- When *commit_sha* is provided and the run is on the default branch,- the baseline is fetched at that exact commit instead of the branch- tip. This prevents a race where a newer commit updates the- baseline file before an older commit's VR run completes.+ When *commit_sha* is provided the baseline is fetched at that exact+ commit rather than the branch tip. The tip moves under a concurrent+ push, and an ephemeral merge-queue branch is deleted once its batch+ resolves — a fetch by branch name then 404s, which is indistinguishable+ from "no baseline file" and reports the whole suite as new.Returns (merged_baseline, healed_count)."""@@ -150,15 +170,17 @@ def _resolve_baselines_with_merge_base(default_branch = github_api._get_default_branch(github, repo.repo_full_name)- # On the default branch, pin the baseline to the exact commit so- # that back-to-back pushes don't race against each other.- baseline_ref = commit_sha if (commit_sha and branch == default_branch) else branch+ # Pin the baseline to the exact commit under test so back-to-back pushes+ # don't race, and so a branch deleted mid-run still resolves.+ baseline_ref = commit_sha or branchbranch_baseline = _resolve_baselines_at_ref(repo, github, run_type, baseline_ref)if branch == default_branch:return branch_baseline, 0- merge_base_sha = github_api._get_merge_base_sha(github, repo.repo_full_name, default_branch, branch)+ # Compare from the same ref the baseline was read at. A deleted branch 404s+ # here, and healing would then switch off exactly when it is needed.+ merge_base_sha = github_api._get_merge_base_sha(github, repo.repo_full_name, default_branch, baseline_ref)if not merge_base_sha:return branch_baseline, 0@@ -175,9 +197,16 @@ def _resolve_baselines_with_merge_base(if not merge_base_baseline:return branch_baseline, 0- source_pr_number = github_api._verified_merge_queue_source_pr(github, repo.repo_full_name, branch)+ source_pr_number = github_api._verified_merge_queue_source_pr(+ github, repo.repo_full_name, branch, head_ref=baseline_ref+ )tombstoned = _tombstoned_identifiers(repo, run_type, branch, source_pr_number=source_pr_number)- healable_merge_base = {k: v for k, v in merge_base_baseline.items() if k not in tombstoned}+ on_merge_queue_branch = source_pr_number is not None+ healable_merge_base = {+ identifier: baseline_hash+ for identifier, baseline_hash in merge_base_baseline.items()+ if identifier not in tombstoned and (not on_merge_queue_branch or identifier in rendered_identifiers)+ }healed = set(healable_merge_base) - set(branch_baseline)merged = {**healable_merge_base, **branch_baseline}diff --git a/products/visual_review/backend/logic/github_api.py b/products/visual_review/backend/logic/github_api.pyindex cadcfc81a58e..05cf7a5bc313 100644--- a/products/visual_review/backend/logic/github_api.py+++ b/products/visual_review/backend/logic/github_api.py@@ -69,7 +69,9 @@ def _get_default_branch(github: GitHubIntegration, repo_full_name: str) -> str:_MERGE_QUEUE_BRANCH_RE = re.compile(r"^trunk-merge/pr-(?P<pr_number>\d+)/")-def _verified_merge_queue_source_pr(github: GitHubIntegration, repo_full_name: str, branch: str) -> int | None:+def _verified_merge_queue_source_pr(+ github: GitHubIntegration, repo_full_name: str, branch: str, head_ref: str | None = None+) -> int | None:"""Source PR number for a merge-queue branch, verified against GitHub.Merge-queue branches (``trunk-merge/pr-<n>/<uuid>``) are freshly@@ -110,7 +112,10 @@ def _verified_merge_queue_source_pr(github: GitHubIntegration, repo_full_name: sif not pr_head_sha:return None- if _get_merge_base_sha(github, repo_full_name, pr_head_sha, branch) != pr_head_sha:+ # Compare against *head_ref* when the caller has the commit: the branch is+ # deleted as soon as its batch resolves, and a 404 here reads as "unverified"+ # and silently drops the inheritance this function exists to grant.+ if _get_merge_base_sha(github, repo_full_name, pr_head_sha, head_ref or branch) != pr_head_sha:logger.warning("visual_review.merge_queue_source_pr_unverified",repo=repo_full_name,diff --git a/products/visual_review/backend/logic/runs.py b/products/visual_review/backend/logic/runs.pyindex d4a6d33e5a85..62d5a921c5bb 100644--- a/products/visual_review/backend/logic/runs.py+++ b/products/visual_review/backend/logic/runs.py@@ -235,14 +235,23 @@ def complete_run(run_id: UUID) -> Run:repo = run.repo+ # What this run rendered. Read before the baseline so healing can be limited+ # to it — an entry missing from both the branch baseline and the build is a+ # deliberate deletion, and healing it back only manufactures a REMOVED.+ run_identifiers = set(run.snapshots.using(WRITER_DB).values_list("identifier", flat=True))+# Fetch baseline merged with merge-base to heal rebase-induced drift.# Branch baseline tracks approvals; merge-base fills entries lost when# git rebase replays a full-file bot commit destructively.- # Pass commit_sha so default-branch runs fetch the baseline at the- # exact commit being tested, avoiding races with concurrent pushes.+ # Pass commit_sha so the baseline is read at the exact commit being tested,+ # not at a branch tip that may have moved or been deleted.try:baseline, healed_count = baselines._resolve_baselines_with_merge_base(- repo, run.run_type, run.branch, commit_sha=run.commit_sha+ repo,+ run.run_type,+ run.branch,+ rendered_identifiers=run_identifiers,+ commit_sha=run.commit_sha,)except GitHubRateLimitError:# Roll back to PENDING so the caller can retry after the limit resets@@ -253,7 +262,6 @@ def complete_run(run_id: UUID) -> Run:run.save(using=WRITER_DB, update_fields=["metadata"])# Pre-load tolerated hashes scoped to this run's identifiers and baseline hashes- run_identifiers = set(run.snapshots.using(WRITER_DB).values_list("identifier", flat=True))baseline_hashes_in_use = set(baseline.values())tolerated_lookup: dict[tuple[str, str, str], ToleratedHash] = {}if run_identifiers and baseline_hashes_in_use:diff --git a/products/visual_review/backend/tests/logic/test_baselines.py b/products/visual_review/backend/tests/logic/test_baselines.pyindex e358dc743ed3..439a77875c6c 100644--- a/products/visual_review/backend/tests/logic/test_baselines.py+++ b/products/visual_review/backend/tests/logic/test_baselines.py@@ -57,6 +57,7 @@ class TestMergeBaseBaselineHealing:branch_baseline,merge_base_baseline=None,merge_base_sha="abc123",+ merge_base_heads=None,default_branch="master",commit_sha_baselines=None,pr_head_sha=None,@@ -93,6 +94,10 @@ class TestMergeBaseBaselineHealing:def fake_merge_base(github, repo_full_name, base, head):if pr_head_sha is not None and base == pr_head_sha:return pr_head_sha if pr_head_is_ancestor else "unrelated-sha"+ # `merge_base_heads` models refs GitHub still knows: a deleted branch+ # 404s on compare, a commit does not.+ if merge_base_heads is not None and head not in merge_base_heads:+ return Nonereturn merge_base_shamocker.patch("products.visual_review.backend.logic.github_api._fetch_baseline_file", side_effect=fake_fetch)@@ -108,7 +113,9 @@ class TestMergeBaseBaselineHealing:baseline = {"A": "h1", "B": "h2"}self._mock_github(mocker, branch_baseline=baseline, merge_base_baseline=baseline)- merged, healed = baselines._resolve_baselines_with_merge_base(repo, "storybook", "my-branch")+ merged, healed = baselines._resolve_baselines_with_merge_base(+ repo, "storybook", "my-branch", rendered_identifiers={"A", "B"}+ )assert merged == baselineassert healed == 0@@ -118,7 +125,9 @@ class TestMergeBaseBaselineHealing:merge_base_baseline = {"A": "h1", "B": "h2", "C": "h3"}self._mock_github(mocker, branch_baseline=branch_baseline, merge_base_baseline=merge_base_baseline)- merged, healed = baselines._resolve_baselines_with_merge_base(repo, "storybook", "my-branch")+ merged, healed = baselines._resolve_baselines_with_merge_base(+ repo, "storybook", "my-branch", rendered_identifiers={"A", "B", "C"}+ )assert merged == {"A": "h1", "B": "h2", "C": "h3"}assert healed == 2@@ -128,7 +137,9 @@ class TestMergeBaseBaselineHealing:merge_base_baseline = {"A": "master_hash", "B": "h2"}self._mock_github(mocker, branch_baseline=branch_baseline, merge_base_baseline=merge_base_baseline)- merged, healed = baselines._resolve_baselines_with_merge_base(repo, "storybook", "my-branch")+ merged, healed = baselines._resolve_baselines_with_merge_base(+ repo, "storybook", "my-branch", rendered_identifiers={"A", "B"}+ )assert merged["A"] == "branch_hash"assert merged["B"] == "h2"@@ -139,7 +150,9 @@ class TestMergeBaseBaselineHealing:merge_base_baseline = {"A": "h1"}self._mock_github(mocker, branch_baseline=branch_baseline, merge_base_baseline=merge_base_baseline)- merged, healed = baselines._resolve_baselines_with_merge_base(repo, "storybook", "my-branch")+ merged, healed = baselines._resolve_baselines_with_merge_base(+ repo, "storybook", "my-branch", rendered_identifiers={"A", "NewStory"}+ )assert "NewStory" in mergedassert merged["NewStory"] == "new_hash"@@ -149,7 +162,9 @@ class TestMergeBaseBaselineHealing:baseline = {"A": "h1"}self._mock_github(mocker, branch_baseline=baseline, default_branch="master")- merged, healed = baselines._resolve_baselines_with_merge_base(repo, "storybook", "master")+ merged, healed = baselines._resolve_baselines_with_merge_base(+ repo, "storybook", "master", rendered_identifiers={"A"}+ )assert merged == baselineassert healed == 0@@ -173,37 +188,157 @@ class TestMergeBaseBaselineHealing:)merged, healed = baselines._resolve_baselines_with_merge_base(- repo, "storybook", "master", commit_sha=commit_sha+ repo, "storybook", "master", rendered_identifiers={"A", "B"}, commit_sha=commit_sha)assert merged == expected_baselineassert healed == 0- def test_non_default_branch_ignores_commit_sha(self, repo, mocker):- """On non-default branches, commit_sha is ignored — branch name is used."""- branch_baseline = {"A": "h1"}+ def test_non_default_branch_pins_to_commit_sha(self, repo, mocker):+ # The tip has moved on; the run is judged against the commit it tested.+ branch_tip_baseline = {"A": "h1", "stale": "h9"}+ commit_baseline = {"A": "h1"}merge_base_baseline = {"A": "h1", "C": "h3"}- commit_baseline = {"X": "hx"} # Should NOT be usedself._mock_github(mocker,- branch_baseline=branch_baseline,+ branch_baseline=branch_tip_baseline,merge_base_baseline=merge_base_baseline,commit_sha_baselines={"deadbeef": commit_baseline},)merged, healed = baselines._resolve_baselines_with_merge_base(- repo, "storybook", "my-branch", commit_sha="deadbeef"+ repo, "storybook", "my-branch", rendered_identifiers={"A", "C"}, commit_sha="deadbeef")- # Should use branch baseline + merge-base healing, NOT the commit baselineassert merged == {"A": "h1", "C": "h3"}assert healed == 1+ def test_queue_branch_does_not_heal_what_the_run_did_not_render(self, repo, mocker):+ # A story the batch deleted stays deleted. Healing it back invents a removal+ # that nobody on a queue branch can approve away.+ self._mock_github(+ mocker,+ branch_baseline={"kept": "h1"},+ merge_base_baseline={"kept": "h1", "deleted-story": "h2"},+ pr_head_sha="source-pr-head",+ commit_sha_baselines={"batch-sha": {"kept": "h1"}},+ )++ merged, healed = baselines._resolve_baselines_with_merge_base(+ repo,+ "storybook",+ "trunk-merge/pr-4242/0c2f75d8",+ rendered_identifiers={"kept"},+ commit_sha="batch-sha",+ )++ assert merged == {"kept": "h1"}+ assert healed == 0++ def test_ordinary_branch_still_heals_a_deleted_story(self, repo, mocker):+ # Outside the queue the REMOVED is the review gate: it is how a reviewer is+ # asked to confirm the story should go. Healing has to keep raising it.+ self._mock_github(+ mocker,+ branch_baseline={"kept": "h1"},+ merge_base_baseline={"kept": "h1", "deleted-story": "h2"},+ )++ merged, healed = baselines._resolve_baselines_with_merge_base(+ repo, "storybook", "my-branch", rendered_identifiers={"kept"}+ )++ assert merged == {"kept": "h1", "deleted-story": "h2"}+ assert healed == 1++ def test_unverified_queue_branch_keeps_the_removal_gate(self, repo, mocker):+ # The branch name is client-supplied. Without GitHub confirming the source+ # PR is an ancestor, the filter stays off rather than granting a bypass.+ self._mock_github(+ mocker,+ branch_baseline={"kept": "h1"},+ merge_base_baseline={"kept": "h1", "deleted-story": "h2"},+ pr_head_sha="source-pr-head",+ pr_head_is_ancestor=False,+ commit_sha_baselines={"batch-sha": {"kept": "h1"}},+ )++ merged, healed = baselines._resolve_baselines_with_merge_base(+ repo,+ "storybook",+ "trunk-merge/pr-4242/0c2f75d8",+ rendered_identifiers={"kept"},+ commit_sha="batch-sha",+ )++ assert merged == {"kept": "h1", "deleted-story": "h2"}+ assert healed == 1++ def test_heals_what_the_run_still_renders(self, repo, mocker):+ # Same missing entry, but the story renders: the rebase loss healing exists for.+ branch_baseline = {"kept": "h1"}+ merge_base_baseline = {"kept": "h1", "lost-to-rebase": "h2"}+ self._mock_github(mocker, branch_baseline=branch_baseline, merge_base_baseline=merge_base_baseline)++ merged, healed = baselines._resolve_baselines_with_merge_base(+ repo, "storybook", "my-branch", rendered_identifiers={"kept", "lost-to-rebase"}+ )++ assert merged == {"kept": "h1", "lost-to-rebase": "h2"}+ assert healed == 1++ def test_deleted_branch_still_resolves_via_commit_sha(self, repo, mocker):+ # A merge-queue branch is deleted once its batch resolves. Fetching by name+ # then 404s, which reads as "no baseline file yet" and reports the whole+ # suite as new. The commit outlives the ref.+ self._mock_github(+ mocker,+ branch_baseline={},+ merge_base_sha=None,+ commit_sha_baselines={"batch-sha": {"A": "h1", "B": "h2"}},+ )++ merged, healed = baselines._resolve_baselines_with_merge_base(+ repo,+ "storybook",+ "trunk-merge/pr-4242/0c2f75d8",+ rendered_identifiers={"A", "B"},+ commit_sha="batch-sha",+ )++ assert merged == {"A": "h1", "B": "h2"}+ assert healed == 0++ def test_deleted_branch_still_heals_because_compare_uses_the_commit(self, repo, mocker):+ # The compare API is asked from the same ref the baseline was read at.+ # Asking by branch name 404s once the batch resolves, and healing would+ # then switch off exactly on the branches that need it.+ self._mock_github(+ mocker,+ branch_baseline={},+ merge_base_baseline={"kept": "h1", "lost-to-rebase": "h2"},+ merge_base_heads={"batch-sha"},+ commit_sha_baselines={"batch-sha": {"kept": "h1"}},+ )++ merged, healed = baselines._resolve_baselines_with_merge_base(+ repo,+ "storybook",+ "trunk-merge/pr-4242/0c2f75d8",+ rendered_identifiers={"kept", "lost-to-rebase"},+ commit_sha="batch-sha",+ )++ assert merged == {"kept": "h1", "lost-to-rebase": "h2"}+ assert healed == 1+def test_falls_back_on_merge_base_failure(self, repo, mocker):branch_baseline = {"A": "h1"}self._mock_github(mocker, branch_baseline=branch_baseline, merge_base_sha=None)- merged, healed = baselines._resolve_baselines_with_merge_base(repo, "storybook", "my-branch")+ merged, healed = baselines._resolve_baselines_with_merge_base(+ repo, "storybook", "my-branch", rendered_identifiers={"A"}+ )assert merged == branch_baselineassert healed == 0@@ -216,7 +351,9 @@ class TestMergeBaseBaselineHealing:side_effect=[branch_baseline, Exception("GitHub 500")],)- merged, healed = baselines._resolve_baselines_with_merge_base(repo, "storybook", "my-branch")+ merged, healed = baselines._resolve_baselines_with_merge_base(+ repo, "storybook", "my-branch", rendered_identifiers={"A", "B"}+ )assert merged == branch_baselineassert healed == 0@@ -224,7 +361,9 @@ class TestMergeBaseBaselineHealing:def test_first_run_both_baselines_empty(self, repo, mocker):self._mock_github(mocker, branch_baseline={}, merge_base_baseline={})- merged, healed = baselines._resolve_baselines_with_merge_base(repo, "storybook", "my-branch")+ merged, healed = baselines._resolve_baselines_with_merge_base(+ repo, "storybook", "my-branch", rendered_identifiers=set()+ )assert merged == {}assert healed == 0@@ -246,7 +385,9 @@ class TestMergeBaseBaselineHealing:}self._mock_github(mocker, branch_baseline=branch_baseline, merge_base_baseline=merge_base_baseline)- merged, healed = baselines._resolve_baselines_with_merge_base(repo, "storybook", "my-branch")+ merged, healed = baselines._resolve_baselines_with_merge_base(+ repo, "storybook", "my-branch", rendered_identifiers=set(merge_base_baseline)+ )assert len(merged) == 10assert healed == 8@@ -256,7 +397,12 @@ class TestMergeBaseBaselineHealing:"""Healed entries classify as unchanged when hashes match."""branch_baseline = {"existing": "h1"}merge_base_baseline = {"existing": "h1", "healed": "h2"}- self._mock_github(mocker, branch_baseline=branch_baseline, merge_base_baseline=merge_base_baseline)+ self._mock_github(+ mocker,+ branch_baseline=branch_baseline,+ merge_base_baseline=merge_base_baseline,+ commit_sha_baselines={"abc": branch_baseline},+ )artifact_store.get_or_create_artifact(repo_id=repo.id, content_hash="h1", storage_path="p/h1")artifact_store.get_or_create_artifact(repo_id=repo.id, content_hash="h2", storage_path="p/h2")@@ -341,6 +487,44 @@ class TestMergeBaseBaselineHealing:assert run.new_count == 0assert run.changed_count == 0+ def test_merge_queue_batch_deleting_a_story_reports_no_removals(self, repo, mocker):+ # The batch tree has the story and its entry gone; the merge base still has+ # both. Healing used to restore the entry, and a queue run has no reviewer to+ # approve the removal, so every co-batched PR failed until the deleter merged.+ batch_branch = "trunk-merge/pr-4242/0c2f75d8-0c2f-4c2f-8c2f-0c2f75d80c2f"+ master_baseline = {"kept": "h1", "doomed": "h2"}+ batch_baseline = {"kept": "h1"}+ self._mock_github(+ mocker,+ branch_baseline=batch_baseline,+ merge_base_baseline=master_baseline,+ commit_sha_baselines={"batch-sha": batch_baseline},+ pr_head_sha="source-pr-head",+ )++ artifact_store.get_or_create_artifact(repo_id=repo.id, content_hash="h1", storage_path="p/h1")++ # The batch renders everything except the story it deleted.+ run, _ = runs.create_run(+ CreateRunInput(+ repo_id=repo.id,+ run_type=RunType.STORYBOOK,+ commit_sha="batch-sha",+ branch=batch_branch,+ pr_number=None,+ snapshots=[SnapshotManifestItem(identifier="kept", content_hash="h1")],+ ),+ team_id=repo.team_id,+ )+ mocker.patch("products.visual_review.backend.tasks.tasks.process_run_diffs.delay")++ runs.complete_run(run.id)++ run.refresh_from_db()+ assert run.removed_count == 0+ assert run.new_count == 0+ assert run.changed_count == 0+def test_healing_detects_changed_when_hash_differs(self, repo, mocker):"""Healed entry with different hash shows as changed, not new."""branch_baseline: dict[str, str] = {}@@ -477,7 +661,9 @@ class TestMergeBaseBaselineHealing:review_state=prior_review_state,)- merged, healed = baselines._resolve_baselines_with_merge_base(repo, RunType.STORYBOOK, run_branch)+ merged, healed = baselines._resolve_baselines_with_merge_base(+ repo, RunType.STORYBOOK, run_branch, rendered_identifiers={"candidate"}+ )if expect_tombstoned:assert merged == {}@@ -538,7 +724,9 @@ class TestMergeBaseBaselineHealing:review_state=ReviewState.APPROVED,)- merged, healed = baselines._resolve_baselines_with_merge_base(repo, RunType.STORYBOOK, "my-branch")+ merged, healed = baselines._resolve_baselines_with_merge_base(+ repo, RunType.STORYBOOK, "my-branch", rendered_identifiers={"story-x"}+ )# Latest approved outcome is NEW, not REMOVED — tombstone cleared, healing worksassert "story-x" in merged@@ -569,7 +757,9 @@ class TestMergeBaseBaselineHealing:review_state=ReviewState.APPROVED,)- merged, healed = baselines._resolve_baselines_with_merge_base(repo, RunType.STORYBOOK, "my-branch")+ merged, healed = baselines._resolve_baselines_with_merge_base(+ repo, RunType.STORYBOOK, "my-branch", rendered_identifiers={"story-x"}+ )assert "story-x" not in mergedassert healed == 0diff --git a/products/visual_review/backend/tests/logic/test_runs.py b/products/visual_review/backend/tests/logic/test_runs.pyindex c0268006af15..2e2fe29dab1d 100644--- a/products/visual_review/backend/tests/logic/test_runs.py+++ b/products/visual_review/backend/tests/logic/test_runs.py@@ -317,7 +317,7 @@ class TestRunOperations:assert completed.is_partial is Falsedef test_complete_run_passes_commit_sha_to_baseline_resolution(self, repo, mocker):- """complete_run passes run.commit_sha so default-branch baselines are pinned."""+ # Pins the baseline to the commit, and limits healing to what rendered.run, _ = runs.create_run(CreateRunInput(repo_id=repo.id,@@ -337,7 +337,13 @@ class TestRunOperations:runs.complete_run(run.id)- mock_resolve.assert_called_once_with(repo, RunType.STORYBOOK, "master", commit_sha="deadbeef123")+ mock_resolve.assert_called_once_with(+ repo,+ RunType.STORYBOOK,+ "master",+ rendered_identifiers={"A"},+ commit_sha="deadbeef123",+ )def test_create_run_with_purpose(self, repo):run, _ = runs.create_run(