Skip to content

feat: add namespaces support#2033

Open
jfrancoa wants to merge 3 commits intodev/1.38from
jose/namespaces
Open

feat: add namespaces support#2033
jfrancoa wants to merge 3 commits intodev/1.38from
jose/namespaces

Conversation

@jfrancoa
Copy link
Copy Markdown
Contributor

@jfrancoa jfrancoa commented May 5, 2026

Summary

  • Adds client.namespaces with full CRUD: create, get, list_all, delete (requires Weaviate 1.38.0+)
  • Adds Permissions.namespaces(namespace=..., manage=True) RBAC factory and NamespacesAction.MANAGE enum, wired into Role parsing
  • Extends client.users.db.create(user_id=..., namespace=...) to bind a DB user to a namespace; UserDB.namespace field populated from server responses
  • Adds ci/docker-compose-namespaces.yml for integration test fixtures (ports 8094/50064, RBAC + dynamic DB users + NAMESPACES_ENABLED=true)
  • 12 unit tests (test/test_namespaces.py) and 7 integration tests (integration/test_namespaces.py), all passing

Test plan

  • pytest test/test_namespaces.py — 12 unit tests (no server required)
  • Start namespaces instance: WEAVIATE_VERSION=1.38.x docker compose -f ci/docker-compose-namespaces.yml up -d
  • pytest integration/test_namespaces.py — 7 integration tests covering create/get/list/delete namespace, namespaced user creation, and RBAC permission management

🤖 Generated with Claude Code

Adds full CRUD support for the Weaviate namespaces feature (requires
Weaviate 1.38.0+): create/get/list/delete namespace endpoints, RBAC
manage_namespaces permission, namespace-scoped DB user creation, and
UserDB.namespace field. Includes unit and integration test suites with
a dedicated docker-compose fixture.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@jfrancoa jfrancoa requested a review from a team as a code owner May 5, 2026 14:15
Copy link
Copy Markdown

@orca-security-eu orca-security-eu Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Orca Security Scan Summary

Status Check Issues by priority
Passed Passed Secrets high 0   medium 0   low 0   info 0 View in Orca

- Add namespaces_permissions=[] to all Role(...) constructions in
  integration/test_rbac.py to match the new required dataclass field
- Wait for namespaces port (8094) in ci/compose.sh
- Use _decode_json_response_list helper in namespaces.list_all
- Round-trip via roles.get(...) in namespace permission integration tests
- Use pass instead of return None in delete callback

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@jfrancoa
Copy link
Copy Markdown
Contributor Author

jfrancoa commented May 5, 2026

@copilot review

Copy link
Copy Markdown

Copilot AI commented May 5, 2026

@copilot review

Here's a summary of the review findings and fixes applied:

CI Failure (already fixed in c636cb3):
The integration tests failed with TypeError: Role.__init__() missing 1 required positional argument: 'namespaces_permissions' because the new namespaces_permissions field was added as a required field to the Role dataclass, but integration/test_rbac.py had many direct Role(...) instantiations that were missing it.

Additional fix (f2babd2):
NamespacesPermissionOutput was not exported from weaviate/outputs/rbac.py, breaking the codebase convention that all public RBAC permission output classes are re-exported from that module. Fixed by adding it to the imports and __all__ list.

All 12 unit tests pass, and both Code Review and CodeQL Security scans are clean.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants