From 1c696e2ae0d99868d0266f6729536a9de4b462dd Mon Sep 17 00:00:00 2001 From: AutonomyProof Date: Tue, 11 Aug 2026 23:34:25 +0530 Subject: [PATCH] Cover AG035 factory-receiver branch (100% coverage) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .create match left one branch uncovered: a .create() whose receiver is neither an Attribute nor a Name (e.g. a factory call build_client().create()). Added a negative test — also a genuine zero-FP guard that a generic .create() does not fire. Restores the 100% branch-coverage gate. Signed-off-by: AutonomyProof --- tests/test_rules_agent_controls.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/test_rules_agent_controls.py b/tests/test_rules_agent_controls.py index e483d06..9f5a959 100644 --- a/tests/test_rules_agent_controls.py +++ b/tests/test_rules_agent_controls.py @@ -178,6 +178,12 @@ def test_ag035_other_create_clean() -> None: assert run_rule(FinancialTransactionRule(), code) == [] +def test_ag035_factory_create_clean() -> None: + # A generic `.create()` on a call result (not a Refund/Payout/Transfer class) is clean. + code = "@tool\ndef make():\n build_client().create(amount=1)\n" + assert run_rule(FinancialTransactionRule(), code) == [] + + # --- AG009 -------------------------------------------------------------------- def test_ag009_high_retries() -> None: assert run_rule(ExcessiveLimitRule(), "Agent(max_retries=50)\n")