99
1010from scripts import reviewer_bot
1111from scripts .reviewer_bot_lib import event_inputs , lease_lock , review_state
12+ from scripts .reviewer_bot_lib .config import AssignmentAttempt , GitHubApiResult
1213from scripts .reviewer_bot_lib .runtime import ReviewerBotRuntime , StdErrLogger
1314from scripts .reviewer_bot_lib .runtime_protocols import (
1415 CommentApplicationRuntimeContext ,
2021 ReconcileWorkflowRuntimeContext ,
2122)
2223from tests .fixtures .fake_runtime import FakeReviewerBotRuntime
24+ from tests .fixtures .http_responses import FakeGitHubResponse
2325from tests .fixtures .reviewer_bot import make_state
2426
2527
@@ -97,6 +99,29 @@ def test_runtime_head_repair_contract_is_runtime_scoped():
9799 assert hints ["return" ].__name__ == "HeadObservationRepairResult"
98100
99101
102+ def test_bootstrapped_runtime_re_exposes_retained_github_type_homes ():
103+ runtime = reviewer_bot ._runtime_bot ()
104+
105+ assert runtime .AssignmentAttempt is AssignmentAttempt
106+ assert runtime .GitHubApiResult is GitHubApiResult
107+
108+
109+ def test_bootstrapped_runtime_supports_typed_rest_and_assignment_paths (monkeypatch ):
110+ runtime = reviewer_bot ._runtime_bot ()
111+ monkeypatch .setenv ("GITHUB_TOKEN" , "token" )
112+ runtime .rest_transport = SimpleNamespace (
113+ request = lambda * args , ** kwargs : FakeGitHubResponse (201 , {"ok" : True }, "ok" )
114+ )
115+
116+ response = runtime .github_api_request ("GET" , "issues/42" )
117+ attempt = runtime .github .request_pr_reviewer_assignment (42 , "alice" )
118+
119+ assert isinstance (response , GitHubApiResult )
120+ assert response .ok is True
121+ assert isinstance (attempt , AssignmentAttempt )
122+ assert attempt .success is True
123+
124+
100125def _protocol_member_names (protocol_type ) -> set [str ]:
101126 return set (protocol_type .__annotations__ ) | {
102127 name
@@ -546,6 +571,9 @@ def test_f2a_runtime_surface_inventory_fixture_records_retained_triples():
546571 capabilities = {entry ["capability" ]: entry for entry in inventory ["capability_triples" ]}
547572
548573 assert capabilities ["comment-event dispatch" ]["classification" ] == "retained final surface"
574+ assert capabilities ["typed REST request result" ]["classification" ] == "retained final surface"
575+ assert capabilities ["typed assignment helper result" ]["classification" ] == "retained final surface"
576+ assert capabilities ["reviewer-board GraphQL metadata read" ]["classification" ] == "retained final surface"
549577 assert "workflow-run dispatch" not in capabilities
550578 assert "refresh reviewer review from live preferred review" not in capabilities
551579 assert "repair missing reviewer review state" not in capabilities
@@ -571,6 +599,13 @@ def test_f2a_runtime_surface_inventory_matches_bootstrap_adapter_examples():
571599 assert capabilities ["mandatory approver satisfaction" ]["bootstrap_adapter" ].endswith (
572600 "satisfy_mandatory_approver_requirement"
573601 )
602+ assert capabilities ["typed REST request result" ]["bootstrap_adapter" ].endswith ("github_api_request" )
603+ assert capabilities ["typed assignment helper result" ]["bootstrap_adapter" ].endswith (
604+ "request_pr_reviewer_assignment"
605+ )
606+ assert capabilities ["reviewer-board GraphQL metadata read" ]["bootstrap_adapter" ].endswith (
607+ "github_graphql_request"
608+ )
574609
575610
576611def test_f2c_no_runtime_surface_triples_are_deletion_ready_yet ():
0 commit comments