mirror of
https://github.com/Sea-Haven-Industries/open-swe.git
synced 2026-09-30 11:33:14 +00:00
Applies the plan's C5 step: git mv every test per the domain-reorg
move-map (movemap-m50.txt) into tests/{agent,analyzer,auth,dashboard,
github,middleware,models,reviewer,sandbox,slack,tools,webhooks}/, plus
the 13 fork-only placements from the scoping report §2c (Atlassian
webhook tests -> tests/webhooks/, test_atlassian_connect.py and
test_auth_error_leak.py -> tests/auth/, jira/confluence util tests ->
tests/tools/, test_repo_binding_isolation.py -> tests/sandbox/,
bot-identity/autofix tests -> tests/github/).
Path-only move: the only content edits are parents[1] -> parents[2]
fixes in test_e2b_integration.py and test_daytona_integration.py,
required because their __file__-relative ROOT path gained one more
directory level in the move.
Monkeypatch retargets for these files were already completed in C4;
none remained outstanding here.
34 lines
1.5 KiB
Python
34 lines
1.5 KiB
Python
from __future__ import annotations
|
|
|
|
from agent.dashboard.agent_overrides import profile_author_prs_as_user
|
|
from agent.utils.authorship import OPEN_SWE_BOT_EMAIL, OPEN_SWE_BOT_NAME
|
|
from agent.utils.github_org_membership import INTERNAL_BOT_LOGINS
|
|
|
|
|
|
def test_author_prs_as_user_defaults_off() -> None:
|
|
# Default is the app bot; the per-user opt-in must be explicit.
|
|
assert profile_author_prs_as_user(None) is False
|
|
assert profile_author_prs_as_user({}) is False
|
|
assert profile_author_prs_as_user({"author_prs_as_user": "true"}) is False
|
|
assert profile_author_prs_as_user({"author_prs_as_user": True}) is True
|
|
|
|
|
|
def test_commit_identity_is_the_app_bot() -> None:
|
|
assert OPEN_SWE_BOT_NAME == "seahaven-openswe[bot]"
|
|
assert OPEN_SWE_BOT_EMAIL == "296972425+seahaven-openswe[bot]@users.noreply.github.com"
|
|
|
|
|
|
def test_self_trigger_guard_recognizes_our_app_bot() -> None:
|
|
# Bot-authored PRs/actions must be recognized as our own to avoid self-trigger loops.
|
|
assert "seahaven-openswe[bot]" in INTERNAL_BOT_LOGINS
|
|
|
|
|
|
def test_default_commit_identity_in_prompt_is_the_app_bot() -> None:
|
|
# SH-IDSPLIT-01: with no triggering-user identity (the default-bot path), the
|
|
# constructed prompt must set the git commit identity to the app bot — so
|
|
# commits, push, and PR all come in as the app (not the triggering user).
|
|
from agent.prompt import construct_system_prompt
|
|
|
|
prompt = construct_system_prompt(working_dir="/workspace", triggering_user_identity=None)
|
|
assert OPEN_SWE_BOT_NAME in prompt
|
|
assert OPEN_SWE_BOT_EMAIL in prompt
|