Skip to content

Improve tenants logic.#149

Merged
jfrancoa merged 1 commit intomainfrom
jose/improve-tenant-ops
Mar 5, 2026
Merged

Improve tenants logic.#149
jfrancoa merged 1 commit intomainfrom
jose/improve-tenant-ops

Conversation

@jfrancoa
Copy link
Collaborator

@jfrancoa jfrancoa commented Feb 9, 2026

Summary

  • Add --tenants <list> to create tenants for creating tenants by explicit name
    instead of auto-generated suffix+counter patterns
  • Add --tenants <list> and --auto_tenants N to create data for targeted ingestion
    into specific or auto-generated tenants (requires auto_tenant_creation on the collection)
  • Extract _resolve_tenants_for_ingestion() in DataManager to centralise the
    MT vs non-MT, auto-creation, explicit-list, and suffix-fallback resolution logic
  • Fix missing json_output support in TenantManager.create_tenants()
  • Strip whitespace and filter empty entries from all comma-separated --tenants inputs
    across create, update, and delete commands

Closes #157
Fixes #155

Test plan

  • make lint passes
  • make test passes (229/229 unit tests)
  • Unit tests cover all _resolve_tenants_for_ingestion() decision branches and error paths
  • create tenants --tenants "A,B,C" creates exactly those tenants
  • create tenants --json produces structured JSON output
  • Whitespace in --tenants "A, B, " handled gracefully (stripped + empty entries dropped)

🤖 Generated with Claude Code

Copy link

@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 Infrastructure as Code high 0   medium 0   low 0   info 0 View in Orca
Passed Passed SAST high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Secrets high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Vulnerabilities high 0   medium 0   low 0   info 0 View in Orca

Copy link
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.

Pull request overview

This PR refactors tenant handling in the CLI to support explicitly named tenants during creation and to better control which tenants are targeted during data ingestion, including behavior when auto-tenant creation is enabled at the schema level.

Changes:

  • Add support for creating tenants from an explicit --tenants list (instead of only auto-generating names).
  • Refactor tenant creation logic into helper methods for name resolution and post-create verification.
  • Add a tenant-resolution helper for data ingestion to handle MT/non-MT collections and tenant selection options more cleanly.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.

File Description
weaviate_cli/managers/tenant_manager.py Adds explicit tenant list support and refactors generation/verification into helpers.
weaviate_cli/managers/data_manager.py Adds _resolve_tenants_for_ingestion() and refactors create_data() tenant selection flow.
weaviate_cli/defaults.py Extends tenant-creation defaults to include an optional tenants list.
weaviate_cli/commands/create.py Adds --tenants option to the create tenants CLI command and wires it into TenantManager.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
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.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- Add --tenants <list> to create tenants for explicit name-based creation
- Add --tenants <list> and --auto_tenants N to create data for targeted ingestion
- Extract _resolve_tenants_for_ingestion() in DataManager to centralise MT/non-MT,
  auto-creation, explicit-list, and suffix-fallback resolution logic
- Fix missing json_output support in TenantManager.create_tenants()
- Strip whitespace and filter empty entries from all comma-separated --tenants
  inputs across create, update, and delete commands
- Add unit tests covering all _resolve_tenants_for_ingestion() branches and error paths
- Update operating and contributing skill documentation

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@jfrancoa jfrancoa force-pushed the jose/improve-tenant-ops branch from bba26f0 to b8aa2b7 Compare March 5, 2026 10:42
@jfrancoa jfrancoa merged commit 89ba9b0 into main Mar 5, 2026
21 checks passed
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.

Improve tenant operations: explicit tenant lists, flexible data ingestion No option to create a tenant with specific name

2 participants