Skip to content

Commit 84062b8

Browse files
committed
fix(flow): tolerate missing fullrepo overlay on PR merge refs
1 parent 35622a0 commit 84062b8

2 files changed

Lines changed: 42 additions & 2 deletions

File tree

plugins/rldyour-flow/scripts/fullrepo_sync.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -746,8 +746,14 @@ def bootstrap_init(
746746
actions.append("migrate-main")
747747
migrate_main(dry_run=dry_run, ignore_project_policy=ignore_project_policy)
748748
elif remote_exists:
749-
actions.append("restore")
750-
restore(remote, branch, dry_run=dry_run, ignore_project_policy=ignore_project_policy)
749+
try:
750+
restore(remote, branch, dry_run=dry_run, ignore_project_policy=ignore_project_policy)
751+
actions.append("restore")
752+
except FullrepoError as exc:
753+
if "no compatible fullrepo overlay found" not in str(exc):
754+
raise
755+
actions.append("restore-skipped-no-compatible-overlay")
756+
print(f"{exc}; restore skipped for source-only checkout")
751757
elif local_agent_paths:
752758
may_create = create_missing or _policy_value(policy, "create_if_missing", False) or ignore_project_policy
753759
if may_create:

tests/unit/test_fullrepo_sync.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,40 @@ def test_status_reports_missing_remote_without_treating_local_ref_as_network(tmp
207207
assert payload["remote_fullrepo_exists"] is False
208208

209209

210+
def test_bootstrap_init_skips_missing_compatible_overlay(monkeypatch) -> None:
211+
printed: list[dict[str, object]] = []
212+
213+
monkeypatch.setattr(
214+
mod,
215+
"_project_policy",
216+
lambda: {"effective": {"fullrepo": {"mode": "auto", "install_exclude": False}}},
217+
)
218+
monkeypatch.setattr(mod, "enforce_fullrepo_policy", lambda *_args, **_kwargs: None)
219+
monkeypatch.setattr(mod, "repo_root", lambda: Path("/repo"))
220+
monkeypatch.setattr(mod, "iter_worktree_agent_files", lambda _root: [])
221+
monkeypatch.setattr(mod, "fetch_fullrepo", lambda _remote, _branch: True)
222+
monkeypatch.setattr(mod, "tracked_agent_paths_in_index", lambda: [])
223+
monkeypatch.setattr(mod, "status", lambda _remote, _branch: {"ok": True})
224+
monkeypatch.setattr(mod, "print_status", lambda payload, as_json=False: printed.append(payload))
225+
226+
def fail_restore(*_args, **_kwargs):
227+
raise mod.FullrepoError(
228+
"no compatible fullrepo overlay found in refs/remotes/origin/fullrepo "
229+
"for source abc (tree def)"
230+
)
231+
232+
monkeypatch.setattr(mod, "restore", fail_restore)
233+
234+
mod.bootstrap_init("origin", "fullrepo")
235+
236+
assert printed == [
237+
{
238+
"ok": True,
239+
"bootstrap_actions": ["restore-skipped-no-compatible-overlay"],
240+
}
241+
]
242+
243+
210244
def test_publish_uses_identity_env_fallback(tmp_path: Path, monkeypatch) -> None:
211245
_, work = init_repo(tmp_path)
212246
monkeypatch.chdir(work)

0 commit comments

Comments
 (0)