Repository navigation
feat: type WAF rule tools with appwrite-console 0.10 - #129
Conversation
appwrite-console 0.8.1 typed WAF conditions as one string and returned the generic WafRule, so WAF create and update tools sent conditions the API rejects and get_rule dropped the action-specific fields. 0.10.0 takes conditions as a list of strings and returns the model for each rule's action.
🔵 Tier A · Mergeable after minor fixes
The project now requires appwrite-console 0.10.x, and the unit suite checks that WAF create/update tools expose
Fix with agent prompt### Issue 1
tests/unit/test_server.py:1031-1033
**Cover the action-specific WAF get response**
The dependency bump is also meant to make `waf_get_rule` preserve action-specific fields such as `difficulty`, `ttl`, and `location`, but this new test only checks create/update input schemas. A regression to the generic `WafRule` response would still pass; please add a model or fixture assertion for the richer get response.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.📂 Walkthrough · 3
Reviewed |
| def test_waf_rule_tools_take_conditions_as_a_list_of_strings(self): | ||
| manager = register_services(object(), profile=OAUTH_PROFILE) | ||
| tools = {tool.name: tool for tool in manager.get_all_tools()} |
There was a problem hiding this comment.
Cover the action-specific WAF get response
The dependency bump is also meant to make waf_get_rule preserve action-specific fields such as difficulty, ttl, and location, but this new test only checks create/update input schemas. A regression to the generic WafRule response would still pass; please add a model or fixture assertion for the richer get response.
Prompt To Fix With AI
This is a comment left during a code review.
Path: tests/unit/test_server.py
Line: 1031-1033
Comment:
**Cover the action-specific WAF get response**
The dependency bump is also meant to make `waf_get_rule` preserve action-specific fields such as `difficulty`, `ttl`, and `location`, but this new test only checks create/update input schemas. A regression to the generic `WafRule` response would still pass; please add a model or fixture assertion for the richer get response.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.🟡 Minor · testing · Reply if this doesn't apply.
Bumps
appwrite-consolefrom>=0.8.1,<0.9to>=0.10.0,<0.11, so the WAF tools match the API:waf_create_*_ruleandwaf_update_*_ruletakeconditionsas an array of strings. With 0.8.1 the tool schema said a single string, and the API rejected it.waf_get_rulereturns the model for the rule'saction, keeping fields likedifficulty,ttlandlocationthat the genericWafRuledropped.0.9.0 also changed the analytics property tools (no
timezone) and OAuth2resource(now a list of URIs). The API-key catalog keeps the same 27 services and 676 tools.test_waf_rule_tools_take_conditions_as_a_list_of_stringsfails on 0.8.1 and passes on 0.10.0.