mirror of
https://github.com/rennf93/roboco.git
synced 2026-08-03 07:23:24 +02:00
fix(orchestrator): harden external-PR supersede close-on-land
Scope close_pull_request repo resolution by project_id and thread the umbrella's project into close-on-land, so a contributor PR is never resolved (or closed) against a same-numbered PR in another project's repo. Skip the comment + close PATCH when the PR is already closed, so a retried sweep never re-posts the 'superseded' comment. Require a non-cancelled descendant that actually landed a PR before retiring the contributor PR, so an umbrella force-completed over a cancelled code subtask leaves the contributor's still-valid PR open. Run close-on-land from the always-on sweeper rather than the default-off poll loop, so a supersede that lands after the feature is toggled off is still reconciled. Serialize concurrent supersede triggers under a lock so a double-click can't cut two branches / spawn two umbrellas. Anchor the supersede marker checks to the marker line so appended CEO notes can't be mistaken for the closed/dedup tokens. Make the fork-head branch cut idempotent (forced refspec) so a commit-fail retry converges. Also drop an importlib.reload(roboco.config) in a unit test that rebound the settings singleton and leaked into the PM decision-window test.
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
"""Unit tests: commit-trailer links use ROBOCO_PUBLIC_BASE_URL."""
|
||||
|
||||
import importlib
|
||||
|
||||
import pytest
|
||||
import roboco.config as config_module
|
||||
from roboco.templates.git.commit import (
|
||||
@@ -41,17 +39,18 @@ def test_build_commit_message_strips_trailing_slash() -> None:
|
||||
|
||||
def test_links_use_public_base_url(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
"""settings.public_base_url drives the api_base passed to build_commit_message."""
|
||||
# Construct a fresh Settings() to read the patched env — do NOT
|
||||
# importlib.reload(roboco.config), which would rebind the module-level
|
||||
# ``settings`` singleton to a new object and leak that divergence into any
|
||||
# other test that captured the original reference via ``from roboco.config
|
||||
# import settings`` (e.g. the PM decision-window gate).
|
||||
monkeypatch.setenv("ROBOCO_PUBLIC_BASE_URL", "https://roboco.example.com")
|
||||
importlib.reload(config_module)
|
||||
try:
|
||||
settings = config_module.Settings()
|
||||
api_base = settings.public_base_url.rstrip("/") + "/api"
|
||||
ctx = _make_ctx()
|
||||
out = build_commit_message(ctx, api_base)
|
||||
assert "https://roboco.example.com" in out
|
||||
assert "127.0.0.1" not in out
|
||||
finally:
|
||||
importlib.reload(config_module)
|
||||
settings = config_module.Settings()
|
||||
api_base = settings.public_base_url.rstrip("/") + "/api"
|
||||
ctx = _make_ctx()
|
||||
out = build_commit_message(ctx, api_base)
|
||||
assert "https://roboco.example.com" in out
|
||||
assert "127.0.0.1" not in out
|
||||
|
||||
|
||||
def test_commit_context_invalid_type_raises() -> None:
|
||||
|
||||
Reference in New Issue
Block a user