diff --git a/CHANGELOG.md b/CHANGELOG.md index a593cedbc..a4a3cd60d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,12 @@ answered with a usage error, so the check read an empty report as "nothing failed" and rejected the unit; a commit that only deletes test files now builds no red command. +- A pull request merged into the branch of a unit that had already merged is no longer recorded + as merged, since its work never reached the default branch. The unit is now held with cause + `landed_off_default`, its note names the pull request, the branch and the default branch, and + its dependents keep waiting. A merge into the branch of a still-open unit stays settling, with + a note that it lands when that unit does. + - The rerun of a failed test now collects a test of the `integration` kind that a repository's default settings deselect. Before, the rerun carried no marker expression, so such a test was deselected (pytest exit 5), never ran again, and a flake in it failed the unit; the rerun now diff --git a/docs/architecture.md b/docs/architecture.md index c4f06c015..1660706bb 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -946,8 +946,8 @@ A standing cause names a situation that lasts until a state change passes anothe `base_changed`, `upstream_went_back`, `usage`, `login`, `depth`, `toolchain`, `review_escalated_class`, `review_escalated_disagreement`, `late_failure`, `needs_human`, `reviewer_hold`, `gated`, `restack_conflict`, `restack_deferred`, `restack_handed_back`, `dirty_worktree`, `attached`, `host_unavailable`, -`network_unavailable`, `service_unavailable`, `environment`, `split_held`, `manual_step` and -`too_big_for_tier`. +`network_unavailable`, `service_unavailable`, `environment`, `split_held`, `manual_step`, +`too_big_for_tier` and `landed_off_default` (a pull request merged into a branch that is not the default branch). An event cause names a transition that has happened and is over: `requeued`, `released`, `adopted`, `merged`, `auto_landed`, `closed`, `retired`, `superseded` and `failed`. Recording an event cause ends a standing one explicitly. A state change the store makes on its own account (a replan's demotion and diff --git a/docs/designs/unit-graph.md b/docs/designs/unit-graph.md index 5623611d9..744c5b158 100644 --- a/docs/designs/unit-graph.md +++ b/docs/designs/unit-graph.md @@ -101,7 +101,7 @@ until a state change passes another cause: `rework`, `base_changed`, `upstream_w `depth`, `toolchain`, `review_escalated_class`, `review_escalated_disagreement`, `late_failure`, `needs_human`, `reviewer_hold`, `gated`, `restack_conflict`, `restack_deferred`, `restack_handed_back`, `dirty_worktree`, `attached`, `host_unavailable`, `network_unavailable`, `service_unavailable`, -`environment`, `split_held`, `manual_step` and `too_big_for_tier`. The event causes (`EVENT_CAUSES`) name a transition that is over: +`environment`, `split_held`, `manual_step`, `too_big_for_tier` and `landed_off_default`. The event causes (`EVENT_CAUSES`) name a transition that is over: `requeued`, `released`, `adopted`, `merged`, `auto_landed`, `closed`, `retired`, `superseded` and `failed`. An event cause ends a standing one explicitly. A replan carries a standing cause through the demotion and the promotion (and a vanished change and a join do the same), marking the entry `carried`, and a caller's state diff --git a/src/agent_build_kit/cli/pipeline.py b/src/agent_build_kit/cli/pipeline.py index 22996f7c6..b05a37a4a 100644 --- a/src/agent_build_kit/cli/pipeline.py +++ b/src/agent_build_kit/cli/pipeline.py @@ -7079,6 +7079,7 @@ def dispatch_for( that repo's turn. Also how a merge the poll has not reported yet is recorded.""" return build_dispatch( store, + repos=inst.checkouts, # A lane moves what the handlers hand it, and asks the guard before its resolver. **build_stack_moves( store, diff --git a/src/agent_build_kit/pipeline/events.py b/src/agent_build_kit/pipeline/events.py index bdf6f51b2..15e74c634 100644 --- a/src/agent_build_kit/pipeline/events.py +++ b/src/agent_build_kit/pipeline/events.py @@ -65,6 +65,7 @@ is_fix_change, waiting_note, ) +from agent_build_kit.pipeline.landing_check import Landing, merged_on_branch, merged_on_default from agent_build_kit.pipeline.landing_intent import clear_intent, has_intent from agent_build_kit.pipeline.pr_poller import ( # noqa: F401 — FAILING_CHECKS_REASON re-exported CONFLICT_REASON, @@ -292,6 +293,7 @@ def on_merged( landing_path: Path | None = None, merge_record: MergeRecord | None = None, merge_commit: str | None = None, + landing: Callable[[], Landing | None] | None = None, log: Log = print, ) -> bool: """Record the merge, move what was stacked on it, then clean up after it. @@ -299,7 +301,10 @@ def on_merged( `cause` is why it merged: a person's merge, or the pipeline's own landing. A unit already recorded merged changes nothing and returns True. `merge_commit` is the commit the merge produced when the caller holds it (the merge's own answer, the listing's - snapshot), so the merge record does not ask the forge for it. + snapshot), so the merge record does not ask the forge for it. `landing` says where the + merge went, asked only once a unit that is not yet merged is found: one whose commit is not + on the default branch is held (its base was a merged unit's branch) or left settling with a + note (its base was an open unit's branch). False when the merged unit is itself being built — a rework someone merged over — so the poller reports the merge again once it has finished. @@ -311,6 +316,16 @@ def on_merged( # we don't know moves the wrong branch, so do nothing at all. log(f"merged #{pr}: no unit recorded for it in {repo}, ignoring") return True + note = "" + where = landing() if landing is not None and merged.state != MERGED else None + if where is not None and not where.on_default: + if where.base == where.default_branch: + log(f"merged #{pr}: {merged.id} not yet on {where.default_branch}, will check again") + return False + parent = _unit_on_branch(store, merged.repo, where.base, merged.id) + if parent is None or parent.state == MERGED: + return _hold_landed_off_default(store, merged, pr, where, claim, resume, log) + note = f"merged into {where.base}, which lands when {parent.id} does" if merged.state in (MERGED, SETTLING): # The landing and the poller both report a merge, in either order: the # second finds it recorded and moves, cleans and records nothing again. @@ -345,6 +360,7 @@ def on_merged( resume=resume, merge_record=merge_record, merge_commit=merge_commit, + note=note, log=log, ) if landing_path is not None: @@ -354,6 +370,39 @@ def on_merged( return True +def _hold_landed_off_default( + store: UnitStore, + merged: StoredUnit, + pr: int, + landing: Landing, + claim: Claim, + resume: Resume, + log: Log, +) -> bool: + """Hold a unit whose pull request merged into a branch that is not the default branch: its + work is not on the default branch, so it is not recorded merged.""" + try: + with claim(merged): + _record_landed_off_default(store, merged, pr, landing, resume, log) + except BranchBusy as error: + return _deferred(f"merged #{pr}", merged, error, log) + return True + + +def _record_landed_off_default( + store: UnitStore, unit: StoredUnit, pr: int, landing: Landing, resume: Resume, log: Log +) -> None: + """The hold itself, for a caller that already holds the unit's claim.""" + note = ( + f"#{pr} was merged into {landing.base}, not {landing.default_branch}: " + f"its commit is not on {landing.default_branch}" + ) + # The hold goes to the unit's thread as a person's would: a merged event ends it. + taken = resume(unit, "hold", "", "") + store.set_state(unit.id, HELD, note=note, cause=Cause.LANDED_OFF_DEFAULT) + log(f"merged #{pr}: {unit.id} held{' by its thread' if taken else ''} — {note}") + + def on_settled( pr: int, *, @@ -362,11 +411,16 @@ def on_settled( claim: Claim = _unclaimed, merge_record: MergeRecord | None = None, merge_commit: str | None = None, + landing_of: Callable[[StoredUnit], Landing | None] | None = None, + resume: Resume = _no_thread, log: Log = print, ) -> bool: """Every check of a settling unit's merged pull request has completed clean: the unit becomes merged, with the tick that saw it settle. A unit not settling changes nothing. - `merge_commit` is the commit the listing's snapshot carries, if any.""" + `merge_commit` is the commit the listing's snapshot carries, if any. `landing_of` says + where the unit's work went when it is not on the default branch: a unit behind an open + unit's branch stays settling, with its note, and one behind a unit that has landed + without it is held, so it never waits for a commit that cannot arrive.""" unit = _find(store, repo, pr) if unit is None or unit.state != SETTLING: return True @@ -375,6 +429,17 @@ def on_settled( current = store.get(unit.id) if current.state != SETTLING: return True + off = landing_of(current) if landing_of is not None else None + if off is not None: + parent = _unit_on_branch(store, current.repo, off.base, current.id) + if parent is not None and parent.state != MERGED: + log( + f"settled #{pr}: {current.id} stays settling, its commit is not on " + f"{off.default_branch} until {parent.id} lands" + ) + return True + _record_landed_off_default(store, current, pr, off, resume, log) + return True settle_merged(store, current, merge_record, merge_commit=merge_commit) log(f"settled #{pr}: {current.id} merged, every check complete") except BranchBusy as error: @@ -1071,6 +1136,71 @@ def _commit_in_hand(event: dict[str, Any]) -> str | None: return named or (pull.merge_commit if isinstance(pull, PullRequest) else None) +def _landing( + repos: dict[str, Path] | None, repo: str, event: dict[str, Any] +) -> Callable[[], Landing | None] | None: + """Where the event's merge went, asked for when needed (it fetches), and only when its + commit and the repository's checkout are known. The protection depends on the event + carrying the commit.""" + pull = event.get("pull") + sha = _commit_in_hand(event) + if repos is None or repo not in repos or sha is None or not isinstance(pull, PullRequest): + return None + checkout, base = repos[repo], pull.base + + def where() -> Landing: + default = trunk_of(repo) + return Landing( + base=base, + default_branch=default, + on_default=merged_on_default(checkout, sha, default), + ) + + return where + + +def _unit_on_branch(store: UnitStore, repo: str, branch: str, not_id: str) -> StoredUnit | None: + """The unit, other than `not_id`, whose branch is `branch` in `repo`.""" + return next( + (u for u in store.all() if u.repo == repo and u.branch == branch and u.id != not_id), + None, + ) + + +def _unit_landing( + repos: dict[str, Path] | None, store: UnitStore, event: dict[str, Any] +) -> Callable[[StoredUnit], Landing | None] | None: + """Where a settling unit's merge went, asked of a pull request that merged into another + branch than the default: None when its work is on the default branch, or when the unit + whose branch it merged into has landed with it, and a landing that is not on the default + branch otherwise. A merge into the default branch, a unit with no recorded commit and one + with no checkout give None: the merge handler checks the first, and nothing can say + otherwise for the others.""" + pull = event.get("pull") + if repos is None or not isinstance(pull, PullRequest): + return None + + def landing_of(unit: StoredUnit) -> Landing | None: + default = trunk_of(unit.repo) + if not unit.merge_sha or unit.repo not in repos or pull.base == default: + return None + checkout, sha = repos[unit.repo], unit.merge_sha + if merged_on_default(checkout, sha, default): + return None + parent = _unit_on_branch(store, unit.repo, pull.base, unit.id) + # A parent landed by squash carries the work as a new commit, so the unit's own commit + # is never an ancestor of the default branch: it is carried when the parent's branch has it. + if ( + parent is not None + and parent.state == MERGED + and merged_on_branch(checkout, sha, pull.base) + ): + return None + return Landing(base=pull.base, default_branch=default, on_default=False) + + return landing_of + + def _with_merge(unit: StoredUnit, sha: str | None) -> tuple[Pull, ...]: """The unit's pull requests with the active one marked merged, listed if it was not yet.""" now = spans.clock.now() @@ -1103,6 +1233,7 @@ def _record_merge( merge_record: MergeRecord | None, merge_commit: str | None, log: Log, + note: str = "", ) -> None: # The commit in hand is the merge's own answer or the listing's; the record asks the # forge only when there is none. @@ -1113,7 +1244,7 @@ def _record_merge( store.set_merge_record(merged.id, sha, None) if merged.pr is not None: store.set_pulls(merged.id, _with_merge(merged, sha)) - store.set_state(merged.id, SETTLING, cause=cause) + store.set_state(merged.id, SETTLING, note=note, cause=cause) log(f"merged #{merged.pr}: {merged.id} settling, waiting for its checks") release_children( @@ -2646,6 +2777,7 @@ def build_dispatch( base_passes: Callable[[StoredUnit, str], bool | None] | None = None, base_checks: Callable[[StoredUnit, str, str], CommitChecks] | None = None, late_turn: Claim = _unclaimed, + repos: dict[str, Path] | None = None, log: Log = print, ) -> Callable[..., bool]: """The callable `pr_poller` hands each event to. @@ -2689,6 +2821,7 @@ def dispatch(event: str, number: int, *, repo: str, **kwargs) -> bool: landing_path=landing_path, merge_record=merge_record, merge_commit=_commit_in_hand(kwargs), + landing=_landing(repos, repo, kwargs), log=log, ) if event == "settled": @@ -2699,6 +2832,8 @@ def dispatch(event: str, number: int, *, repo: str, **kwargs) -> bool: claim=claim, merge_record=merge_record, merge_commit=_commit_in_hand(kwargs), + landing_of=_unit_landing(repos, store, kwargs), + resume=resume, log=log, ) if event == "late_check": diff --git a/src/agent_build_kit/pipeline/landing_check.py b/src/agent_build_kit/pipeline/landing_check.py new file mode 100644 index 000000000..98c5dd306 --- /dev/null +++ b/src/agent_build_kit/pipeline/landing_check.py @@ -0,0 +1,37 @@ +"""Whether a merged pull request's commit reached the repository's default branch.""" + +from __future__ import annotations + +from pathlib import Path + +from agent_build_kit.model import Frozen +from agent_build_kit.pipeline.shell import git + + +class Landing(Frozen): + """Where a merged pull request went: its base, the default branch, and whether its commit + is on the default branch.""" + + base: str + default_branch: str + on_default: bool + + +def merged_on_branch(repo: Path, merge_sha: str, branch: str) -> bool: + """True when `merge_sha` is an ancestor of `branch` on the remote, after a fetch. A branch + the remote no longer has is read from the last remote-tracking ref, if there is one.""" + git(repo, "fetch", "-q", "origin", branch, check=False) + found = git( + repo, + "merge-base", + "--is-ancestor", + merge_sha, + f"refs/remotes/origin/{branch}", + check=False, + ) + return found.returncode == 0 + + +def merged_on_default(repo: Path, merge_sha: str, default_branch: str) -> bool: + """True when `merge_sha` is an ancestor of the default branch on the remote, after a fetch.""" + return merged_on_branch(repo, merge_sha, default_branch) diff --git a/src/agent_build_kit/pipeline/unit_store.py b/src/agent_build_kit/pipeline/unit_store.py index 9f21450d0..c3e8652da 100644 --- a/src/agent_build_kit/pipeline/unit_store.py +++ b/src/agent_build_kit/pipeline/unit_store.py @@ -140,6 +140,7 @@ class Cause(StrEnum): MANUAL_STEP = MANUAL_STEP_CAUSE TOO_BIG_FOR_TIER = "too_big_for_tier" SUPERSEDED = "superseded" + LANDED_OFF_DEFAULT = "landed_off_default" class Keep: diff --git a/tests/pipeline/test_merge_landing.py b/tests/pipeline/test_merge_landing.py new file mode 100644 index 000000000..968b8dc91 --- /dev/null +++ b/tests/pipeline/test_merge_landing.py @@ -0,0 +1,271 @@ +"""A merge is recorded only when its commit is on the default branch (spec: merge-landing). + +Real git in temporary repositories: an origin, a clone the dispatch checks against, a parent +branch and a child merged into one or the other. The forge is not asked: the commit comes from +the listing's snapshot.""" + +from __future__ import annotations + +from pathlib import Path + +import pytest + +from agent_build_kit.cli import pipeline as cli +from agent_build_kit.forges.base import PullRequest +from agent_build_kit.pipeline import events +from agent_build_kit.pipeline.landing_check import merged_on_default +from agent_build_kit.pipeline.loaded_code import LoadedCode +from agent_build_kit.pipeline.unit_store import Cause, UnitStore +from agent_build_kit.pipeline.units import HELD, IN_REVIEW, MERGED, SETTLING, waiting_on +from tests.conftest import make_installation +from tests.factories import commit, git, init_repo, stored_unit + +PARENT = "feature/1" +CHILD = "feature/2" +DEPENDENT = "feature/3" +PR = 2 + + +class Repos: + """An origin and a clone with `main`, and a parent branch pushed beside it.""" + + def __init__(self, root: Path, clone: Path | None = None) -> None: + self.origin = root / "origin.git" + self.origin.mkdir(parents=True) + git(self.origin, "init", "-q", "--bare", "-b", "main") + self.clone = init_repo(clone or root / "clone") + git(self.clone, "remote", "add", "origin", str(self.origin)) + commit(self.clone, "base") + git(self.clone, "push", "-q", "origin", "main") + git(self.clone, "checkout", "-q", "-b", f"spec/{PARENT}") + self.parent_tip = commit(self.clone, "parent") + git(self.clone, "push", "-q", "origin", f"spec/{PARENT}") + git(self.clone, "checkout", "-q", "main") + + def land_on_main(self) -> str: + """A commit on the default branch of the origin, as a merge into it leaves.""" + git(self.clone, "checkout", "-q", "main") + sha = commit(self.clone, "merged-into-main") + git(self.clone, "push", "-q", "origin", "main") + return sha + + def land_on_parent(self) -> str: + """A commit on the parent's branch only, as a merge into the parent's branch leaves.""" + git(self.clone, "checkout", "-q", f"spec/{PARENT}") + sha = commit(self.clone, "merged-into-parent") + git(self.clone, "push", "-q", "origin", f"spec/{PARENT}") + git(self.clone, "checkout", "-q", "main") + return sha + + +class World: + def __init__( + self, tmp_path: Path, *, parent_state, resume=None, production: bool = False + ) -> None: + inst = make_installation(tmp_path / "inst") + self.repos = Repos(tmp_path / "git", clone=inst.checkouts["app"]) + self.store = UnitStore(tmp_path / "units.json") + self.store.upsert( + [ + stored_unit(PARENT, change="feature"), + stored_unit(CHILD, change="feature", depends_on=(PARENT,)), + stored_unit(DEPENDENT, change="feature", depends_on=(CHILD,), merge_needs=(CHILD,)), + ] + ) + self.store.set_state(PARENT, parent_state, pr=1, branch=f"spec/{PARENT}") + self.store.set_state(CHILD, IN_REVIEW, pr=PR, branch=f"spec/{CHILD}") + self.log: list[str] = [] + if production: + self.dispatch = cli.dispatch_for(inst, self.store) + else: + self.dispatch = events.build_dispatch( + self.store, + restack=lambda **k: None, + merge_record=lambda unit: (unit.merge_sha, None), + repos={"app": self.repos.clone}, + **({"resume": resume} if resume else {}), + log=self.log.append, + ) + + def merged_into(self, base: str, sha: str | None): + pull = PullRequest( + number=PR, head=f"spec/{CHILD}", base=base, state="merged", merge_commit=sha + ) + self.last_pull = pull + return self.dispatch("merged", PR, repo="app", pull=pull) + + def settled(self): + """The poller's `settled` event for the pull request last reported merged.""" + return self.dispatch("settled", PR, repo="app", pull=self.last_pull) + + def waiting(self) -> list[str]: + loaded = LoadedCode( + number=9, + kit_repo="app", + kit_root=str(self.repos.clone), + kit_head=git(self.repos.clone, "rev-parse", "main"), + ) + units = self.store.all() + dependent = self.store.get(DEPENDENT) + return [u.id for u in waiting_on(dependent, units, loaded)] + + +@pytest.fixture +def merged_parent(tmp_path: Path) -> World: + return World(tmp_path, parent_state=MERGED) + + +@pytest.fixture +def open_parent(tmp_path: Path) -> World: + return World(tmp_path, parent_state=IN_REVIEW) + + +def test_a_commit_on_the_default_branch_is_merged_on_default(tmp_path: Path) -> None: + repos = Repos(tmp_path) + + assert merged_on_default(repos.clone, repos.land_on_main(), "main") + + +def test_a_commit_only_on_another_branch_is_not_merged_on_default(tmp_path: Path) -> None: + repos = Repos(tmp_path) + + assert not merged_on_default(repos.clone, repos.land_on_parent(), "main") + + +def test_a_commit_the_clone_only_fetches_is_merged_on_default(tmp_path: Path) -> None: + """The check fetches: a merge another clone pushed is seen without a manual fetch.""" + repos = Repos(tmp_path) + other = tmp_path / "other" + git(tmp_path, "clone", "-q", str(repos.origin), str(other)) + git(other, "config", "user.email", "t@t.t") + git(other, "config", "user.name", "t") + sha = commit(other, "elsewhere") + git(other, "push", "-q", "origin", "main") + + assert merged_on_default(repos.clone, sha, "main") + + +def test_a_merge_whose_commit_is_not_on_the_default_branch_is_not_recorded_merged( + merged_parent: World, +) -> None: + sha = merged_parent.repos.land_on_parent() + + merged_parent.merged_into("main", sha) + merged_parent.settled() + + unit = merged_parent.store.get(CHILD) + assert unit.state != MERGED + assert unit.merge_sha is None + + +def test_a_merge_into_a_merged_units_branch_holds_the_unit_landed_off_default( + merged_parent: World, +) -> None: + sha = merged_parent.repos.land_on_parent() + + merged_parent.merged_into(f"spec/{PARENT}", sha) + + unit = merged_parent.store.get(CHILD) + assert (unit.state, unit.cause) == (HELD, Cause.LANDED_OFF_DEFAULT) + assert unit.merge_sha is None + for named in (f"#{PR}", f"spec/{PARENT}", "main"): + assert named in unit.note + + +def test_a_held_landed_off_default_unit_is_not_settled_into_merged(merged_parent: World) -> None: + sha = merged_parent.repos.land_on_parent() + merged_parent.merged_into(f"spec/{PARENT}", sha) + + merged_parent.settled() + + unit = merged_parent.store.get(CHILD) + assert (unit.state, unit.merge_sha) == (HELD, None) + + +def test_a_merge_into_an_open_units_branch_leaves_the_unit_settling_with_a_note( + open_parent: World, +) -> None: + sha = open_parent.repos.land_on_parent() + + open_parent.merged_into(f"spec/{PARENT}", sha) + + unit = open_parent.store.get(CHILD) + assert unit.state == SETTLING + assert unit.cause != Cause.LANDED_OFF_DEFAULT + assert "lands when" in unit.note + assert PARENT in unit.note + + +def test_a_unit_whose_listing_has_no_commit_stays_settling_until_a_report_carries_one( + merged_parent: World, +) -> None: + merged_parent.merged_into(f"spec/{PARENT}", None) + unit = merged_parent.store.get(CHILD) + assert (unit.state, unit.merge_sha) == (SETTLING, None) + + merged_parent.merged_into(f"spec/{PARENT}", merged_parent.repos.land_on_parent()) + + assert merged_parent.store.get(CHILD).state == HELD + + +def test_the_dependents_of_a_held_unit_keep_waiting_for_it(merged_parent: World) -> None: + sha = merged_parent.repos.land_on_parent() + merged_parent.merged_into(f"spec/{PARENT}", sha) + + assert merged_parent.store.get(CHILD).state == HELD + assert merged_parent.waiting() == [CHILD] + + +def test_the_production_dispatch_holds_a_merge_into_a_merged_units_branch( + tmp_path: Path, +) -> None: + world = World(tmp_path, parent_state=MERGED, production=True) + + world.merged_into(f"spec/{PARENT}", world.repos.land_on_parent()) + + unit = world.store.get(CHILD) + assert (unit.state, unit.cause) == (HELD, Cause.LANDED_OFF_DEFAULT) + + +def test_a_merge_into_a_merged_units_branch_reaches_the_unit_thread_as_a_hold( + tmp_path: Path, +) -> None: + delivered: list[str] = [] + + def resume(unit, kind, *rest) -> bool: + delivered.append(kind) + return True + + world = World(tmp_path, parent_state=MERGED, resume=resume) + + world.merged_into(f"spec/{PARENT}", world.repos.land_on_parent()) + + assert delivered == ["hold"] + assert world.store.get(CHILD).cause == Cause.LANDED_OFF_DEFAULT + + +def test_a_unit_merged_into_an_open_units_branch_stays_settling_when_its_checks_complete( + open_parent: World, +) -> None: + open_parent.merged_into(f"spec/{PARENT}", open_parent.repos.land_on_parent()) + + open_parent.settled() + + unit = open_parent.store.get(CHILD) + assert unit.state == SETTLING + assert "lands when" in unit.note + assert CHILD in open_parent.waiting() + + +def test_a_unit_settling_behind_a_parent_squash_merged_into_the_default_is_not_left_settling( + open_parent: World, +) -> None: + sha = open_parent.repos.land_on_parent() + open_parent.merged_into(f"spec/{PARENT}", sha) + open_parent.repos.land_on_main() # the parent, squashed: its work as one new commit + open_parent.store.set_state(PARENT, MERGED) + + open_parent.settled() + + unit = open_parent.store.get(CHILD) + assert (unit.state, unit.merge_sha) == (MERGED, sha) diff --git a/tests/pipeline/test_unit_causes.py b/tests/pipeline/test_unit_causes.py index 41e7df539..4d18341bc 100644 --- a/tests/pipeline/test_unit_causes.py +++ b/tests/pipeline/test_unit_causes.py @@ -69,6 +69,7 @@ def test_the_causes_are_the_fixed_set_the_design_names() -> None: "manual_step", "too_big_for_tier", "superseded", + "landed_off_default", } diff --git a/tests/standing_causes.py b/tests/standing_causes.py index 43847bb9c..383e75149 100644 --- a/tests/standing_causes.py +++ b/tests/standing_causes.py @@ -17,6 +17,7 @@ Cause.SPLIT_HELD, Cause.MANUAL_STEP, Cause.TOO_BIG_FOR_TIER, + Cause.LANDED_OFF_DEFAULT, Cause.GATED, Cause.UPSTREAM_WENT_BACK, Cause.BASE_CHANGED,