Skip to content

feat(llm): child tenants keep their own copy of Root-shared model prices (F005) - #2885

Merged
jieyuhuayang merged 1 commit into
releasefrom
feat/3.1.0
Dec 3, 2026
Merged

jieyuhuayang merged 1 commit into
releasefrom
feat/3.1.0

Conversation

@jieyuhuayang

Copy link
Copy Markdown
Collaborator

改动

F005 追加需求(spec §2.5,AC-24–AC-30):Root 共享给子租户的模型,在首次共享时按 Root 当时的价格给子租户复制一份,之后子租户管理员自己维护,与 Root 不再同步。

  • 新表 llm_model_tenant_pricing(Alembic 只做 DDL)。
  • 新接收方初始化 initialize_shared_models 同时补默认可见范围和价格副本,只补缺失。
  • 计费、积分倍率、基准模型和价格表在子租户中只读自己的副本,不回退 Root。
  • 子租户编辑 Root 共享模型的价格写自己的副本,Root 价格不变。
  • scripts/snapshot_child_model_defaults.py 增加价格步骤:给子租户补缺失的价格副本,列出 Root 本身缺价的模型。

升级

alembic upgrade head 后重新执行一次 python scripts/snapshot_child_model_defaults.py --operator-user-id <id> --apply(见 features/v3.1.0/005-tenant-model-share-snapshot/upgrade.md)。

验证

相关 38 个测试文件在本分支与主检出上的失败集合相同(13 个均为已有失败),新增测试全部通过;ruff、arch-guard 通过。

🤖 Generated with Claude Code

A child tenant now gets a copy of Root's price when a Root provider is
first shared with it (mount, share list, or a new model on a shared
provider). The child admin can edit the copy. Billing, credit ratios and
the price table read only the child's copy and never fall back to Root.
Unsharing keeps the copy; sharing again copies only missing prices.

- New table llm_model_tenant_pricing (DDL-only Alembic revision).
- initialize_shared_models adds the price copy next to the default
  visibility at every new-receiver path.
- snapshot_child_model_defaults.py also copies missing prices and lists
  Root models that have no price.

Spec F005 §2.5 (AC-24 to AC-30), design decisions 10 to 14.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jieyuhuayang
jieyuhuayang merged commit d1b94ba into release Dec 3, 2026
2 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.

1 participant