Skip to content

feat: raise tag string limit to 512 chars and cap tag count at 30 - #1727

Merged
SAKURA-CAT merged 1 commit into
mainfrom
fix/tags
Aug 6, 2026
Merged

feat: raise tag string limit to 512 chars and cap tag count at 30#1727
SAKURA-CAT merged 1 commit into
mainfrom
fix/tags

Conversation

@SAKURA-CAT

Copy link
Copy Markdown
Member

Summary

调整实验标签(tags)的约束规则:单条 tag 字符串上限从 20 字符放宽到 512 字符,同时将标签数量上限从 50 条收紧到 30 条。

Changes

  • swanlab/sdk/internal/pkg/constraints/__init__.pyTagString max_length 从 20 改为 512
  • swanlab/sdk/internal/settings/experiment.pyTags 列表 max_length 从 50 改为 30
  • tests/unit/sdk/internal/pkg/constraints/test_pkg_constraints.pyTestTagString 边界值同步更新
  • tests/unit/sdk/internal/settings/test_settings_experiment.py — 新增 test_experiment_tags_count_limit,覆盖 30 条通过 / 31 条报错的场景

Testing

uv run pytest tests/unit/sdk/internal/pkg/constraints/ \
             tests/unit/sdk/internal/settings/ -q
# 171 passed

uv run ruff check [changed files]
# All checks passed

uv run basedpyright [source files]
# 0 errors, 0 warnings

Notes

  • TagString 20 → 512 是向后兼容的放宽,不会影响现有存储数据。
  • Tags 50 → 30 是收紧约束,已有超过 30 条 tag 的实验在再次写入时可能触发 ValidationError。当前线上 tag 数极少超过此阈值。

Raise tag string max length to 512 chars and lower tags count limit to
30 in experiment settings, with matching test updates.
@SAKURA-CAT SAKURA-CAT added the 💪 enhancement New feature or request label Aug 6, 2026
@SAKURA-CAT SAKURA-CAT self-assigned this Aug 6, 2026
@SAKURA-CAT
SAKURA-CAT merged commit 219f6fc into main Aug 6, 2026
19 checks passed
@SAKURA-CAT
SAKURA-CAT deleted the fix/tags branch August 6, 2026 07:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

💪 enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant