Fix permission endpoint tests by resolving method signature conflicts

- Renamed internal allowed_resources_sql() to _build_permission_rules_sql()
  to avoid conflict with public method
- Made public allowed_resources_sql() keyword-only to prevent argument order bugs
- Fixed PermissionRulesView to use _build_permission_rules_sql() which returns
  full permission rules (with allow/deny) instead of filtered resources
- Fixed _build_permission_rules_sql() to pass actor dict to build_rules_union()
- Added actor_id extraction in AllowedResourcesView
- Added root_enabled=True to test fixture to grant permissions-debug to root user

All 51 tests in test_permission_endpoints.py now pass.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Simon Willison 2025-10-23 14:53:07 -07:00
commit 06af34240f
3 changed files with 11 additions and 8 deletions

View file

@ -30,6 +30,7 @@ async def ds_with_permissions():
}
}
)
ds.root_enabled = True
await ds.invoke_startup()
# Add some test databases
ds.add_memory_database("content")