Skip to content

orm: deprecate global tenant filter APIs, deadline 2027-06-08 - #27389

Merged
JalonSolov merged 6 commits into
vlang:masterfrom
Jengro777:deprecate-global-tenant-apis
Jun 20, 2026
Merged

orm: deprecate global tenant filter APIs, deadline 2027-06-08#27389
JalonSolov merged 6 commits into
vlang:masterfrom
Jengro777:deprecate-global-tenant-apis

Conversation

@Jengro777

Copy link
Copy Markdown
Contributor

Follow-up to #27154, after #27324

The old global tenant filter mechanism (configure_tenant_filter / set_current_tenant_id) has been replaced by the per-instance DataScope / orm.DB pattern introduced in #27324. This PR adds @[deprecated] and @[deprecated_after: '2027-06-08'] to all old public APIs, guiding users to migrate with a one-year grace period.


Summary

File changed: vlib/orm/orm.v (+20 lines)

Deprecation attributes added to 10 public items:

Old API Replacement
TenantFilterConfig orm.DataScope
configure_tenant_filter orm.new_db(conn, scope)
set_tenant_filter_enabled orm.new_db(conn, scope)
set_current_tenant_id Add QueryFilter to DataScope.filters
clear_current_tenant_id Use a separate orm.DB instance
with_tenant orm.new_db(conn, scope)
with_tenant_value orm.new_db(conn, scope)
without_tenant_filter orm.DB.unscoped()
without_tenant_filter_value orm.DB.unscoped()
apply_tenant_filter orm.new_db(conn, scope)

The old global tenant filter mechanism (configure_tenant_filter,
set_current_tenant_id, with_tenant, without_tenant_filter, etc.)
is replaced by the per-instance DataScope / orm.DB pattern.
Add @[deprecated] and @[deprecated_after] attributes to all 10
public items so users get a notice directing them to the new API.

See: PR vlang#27324 (DataScope support)
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.

@medvednikov

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1da1bf7fbc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread vlib/orm/orm.v Outdated
…ckends)

apply_tenant_filter is an internal helper called by the sqlite, mysql,
and pg ORM backends in their select/update/delete paths. Marking it
@[deprecated] would produce notices in every ORM-backed build and
become a hard error after the grace period, breaking the backends.

Keeps the 9 user-facing APIs deprecated as-is.
@Jengro777

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 49a4b01550

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread vlib/orm/orm.v
…ckends)

The apply_tenant_filter function is internal plumbing still used by
db/sqlite, db/pg, and db/mysql backends. Deprecating it with -W in CI
causes every tool that imports db/sqlite or any .vv test that imports
it to fail.

Keeps the other 9 deprecation markers (TenantFilterConfig,
configure_tenant_filter, set_tenant_filter_enabled,
set_current_tenant_id, clear_current_tenant_id, with_tenant,
with_tenant_value, without_tenant_filter,
without_tenant_filter_value).

Fixes all 19 CI failures in PR vlang#27389.
@Jengro777

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 223b2571da

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread vlib/orm/orm.v
@Jengro777 Jengro777 closed this Jun 12, 2026
@Jengro777 Jengro777 reopened this Jun 12, 2026
@medvednikov

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: 5914b80f2a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@JalonSolov
JalonSolov merged commit a3c8c55 into vlang:master Jun 20, 2026
83 checks passed
@Jengro777
Jengro777 deleted the deprecate-global-tenant-apis branch June 21, 2026 00:34
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