open-swe/tests/test_authorship.py
Adam Moussa f3db9f02e3
Adopt Sea Haven agent conventions, no attribution (#30)
Codify the box-only #4 customizations into Git so the AWS deployment
(which deploys from this repo) actually applies them — previously only
the retired sh-openswe box had them.

- prompt.py: branch names feature|bug|hotfix/<kebab> (optional <KEY->);
  imperative PR titles with no conventional-commit type: prefix; PR body
  Summary/Validation/Tests/Notes; handbook commit format. Rewrite the
  collaboration template from an attribution MANDATE to a PROHIBITION —
  no Co-authored-by bot trailer, no "Made by [Open SWE]" footer, no
  agent/AI notes on any artifact.
- github_comments.py: add @seahaven-openswe (the deployed App slug) to
  the mention triggers.
- authorship.py: remove the now-unused attribution helpers
  (build_pr_attribution_footer, add_bot_coauthor_trailer,
  add_pr_collaboration_note, PR_ATTRIBUTION_*). Keep OPEN_SWE_BOT_* —
  server.py still uses them for the sandbox git identity.
- Flip the attribution unit tests to assert the no-attribution behavior;
  drop tests for the removed helpers.

Commits stay authored as the triggering user for now — flipping
authorship to the bot account depends on the Vercel preview-deploy
constraint and is deferred to #11.

Refs: #4 #11

Claude-Session: https://claude.ai/code/session_01DMhLf4G5V8MStJQyAW95hi
2026-06-27 22:08:45 -04:00

19 lines
661 B
Python

from __future__ import annotations
from agent.utils.authorship import resolve_triggering_user_identity
def test_resolve_identity_from_config_uses_user_noreply_email() -> None:
config = {
"configurable": {
"source": "slack",
"github_login": "mason-gh",
"github_user_id": 4321,
"slack_thread": {"triggering_user_name": "Mason"},
}
}
identity = resolve_triggering_user_identity(config)
assert identity is not None
assert identity.commit_name == "Mason"
assert identity.commit_email == "4321+mason-gh@users.noreply.github.com"
assert identity.github_login == "mason-gh"