Merge pull request 'Update Gitea operator guide and skill registry for role-aware task routing' (#162) from feat/issue-144-operator-guide-updates into master
This commit was merged in pull request #162.
This commit is contained in:
@@ -43,6 +43,7 @@ EXPECTED_SKILLS = [
|
||||
"gitea-pr-review",
|
||||
"gitea-pr-merge",
|
||||
"gitea-issue-comments",
|
||||
"gitea-resolve-task-capability",
|
||||
"profile-switching",
|
||||
"redaction-security-review",
|
||||
"jenkins-readonly",
|
||||
@@ -155,6 +156,50 @@ class TestControlPlaneGuide(GuideTestBase):
|
||||
self.assertIn("workflows", g)
|
||||
self.assertEqual(g["skills_tool"], "mcp_list_project_skills")
|
||||
|
||||
@patch("mcp_server.api_request", return_value={"login": "author-bot"})
|
||||
@patch("mcp_server.get_auth_header", return_value=FAKE_AUTH)
|
||||
def test_guide_mentions_resolve_capability_and_issue_comment_separation(self, _auth, _api):
|
||||
"""Covers #144 AC: guide tells to resolve task cap, issue comments require gitea.issue.comment (not implied by pr.comment)."""
|
||||
env = dict(AUTHOR_ENV, GITEA_ALLOWED_OPERATIONS="gitea.read,gitea.pr.comment,gitea.pr.create")
|
||||
with patch.dict(os.environ, env, clear=True):
|
||||
g = mcp_get_control_plane_guide(remote="prgs")
|
||||
blob = " ".join(g["guidance"]).lower()
|
||||
self.assertIn("resolve", blob)
|
||||
self.assertIn("gitea.issue.comment", blob)
|
||||
self.assertIn("pr.comment", blob) # separation noted
|
||||
|
||||
@patch("mcp_server.api_request", return_value={"login": "author-bot"})
|
||||
@patch("mcp_server.get_auth_header", return_value=FAKE_AUTH)
|
||||
def test_guide_static_profile_safe_next_action(self, _auth, _api):
|
||||
"""Covers #144 AC: static-profile safe next action guidance."""
|
||||
# default is static (no allow_runtime_switching)
|
||||
with patch.dict(os.environ, AUTHOR_ENV, clear=True):
|
||||
g = mcp_get_control_plane_guide(remote="prgs")
|
||||
# since author, guidance includes author info; resolver advice always present
|
||||
blob = json.dumps(g).lower()
|
||||
self.assertTrue("static" in blob or "relaunch" in blob or "namespace" in blob)
|
||||
self.assertIn("resolve", " ".join(g["guidance"]).lower())
|
||||
|
||||
@patch("mcp_server.api_request", return_value={"login": "no-comment-bot"})
|
||||
@patch("mcp_server.get_auth_header", return_value=FAKE_AUTH)
|
||||
def test_missing_issue_comment_guidance(self, _auth, _api):
|
||||
"""Covers #144 AC: Guide lists issue comments require gitea.issue.comment and PR comments do not imply them."""
|
||||
with patch.dict(os.environ, AUTHOR_ENV, clear=True):
|
||||
g = mcp_get_control_plane_guide(remote="prgs")
|
||||
hard_stops = g["rules"]["hard_stops"]
|
||||
self.assertTrue(any("gitea.issue.comment" in r for r in hard_stops))
|
||||
self.assertTrue(any("gitea.pr.comment" in r for r in hard_stops))
|
||||
|
||||
@patch("mcp_server.api_request", return_value={"login": "static-bot"})
|
||||
@patch("mcp_server.get_auth_header", return_value=FAKE_AUTH)
|
||||
def test_static_profile_safe_next_action(self, _auth, _api):
|
||||
"""Covers #144 AC: Guide covers static-profile safe next action switching instruction."""
|
||||
with patch.dict(os.environ, AUTHOR_ENV, clear=True):
|
||||
g = mcp_get_control_plane_guide(remote="prgs")
|
||||
switching_rules = g["rules"]["profile_switching"]
|
||||
self.assertTrue(any("static-profile mode" in r for r in switching_rules))
|
||||
self.assertTrue(any("GITEA_MCP_PROFILE" in r for r in switching_rules))
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# mcp_list_project_skills
|
||||
|
||||
Reference in New Issue
Block a user