Skip to content

Preserve empty study names across storage backends - #6818

Merged
not522 merged 1 commit into
optuna:masterfrom
uczltw6:codex/preserve-empty-study-name
Aug 27, 2026
Merged

not522 merged 1 commit into
optuna:masterfrom
uczltw6:codex/preserve-empty-study-name

Conversation

@uczltw6

@uczltw6 uczltw6 commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Motivation

BaseStorage.create_new_study() generates a name only when no name is specified. InMemoryStorage and RDBStorage therefore preserve an explicitly supplied empty study_name, but JournalStorage and GrpcStorageProxy currently treat the empty string as if the argument were omitted and replace it with a generated no-name-* value.

Besides making the same public API behave differently across storage backends, this prevents callers from loading the resulting study with the explicit name they supplied.

Description of the changes

  • Distinguish None from an explicitly supplied empty string in JournalStorage and GrpcStorageProxy.
  • Add a shared storage contract test that verifies the behavior across all seven storage configurations covered by StorageTestCase.

Before the production change, the regression test failed for the two Journal configurations and the two gRPC configurations while passing for the other three. After the change:

  • Focused cross-storage regression: 7 passed
  • Complete tests/storages_tests/test_storages.py: 411 passed, 5 skipped
  • Ruff check and format on changed files: passed
  • mypy on changed files: passed
  • git diff --check: passed

This PR was prepared with assistance from OpenAI Codex. I reviewed and understand both condition changes and the cross-backend regression test, and verified the behavior and test results locally.

@c-bata c-bata self-assigned this Aug 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This pull request has not seen any recent activity.

@github-actions github-actions Bot added the stale Exempt from stale bot labeling. label Aug 27, 2026
@c-bata c-bata removed the stale Exempt from stale bot labeling. label Aug 27, 2026

@c-bata c-bata left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM.

@c-bata c-bata added the enhancement Change that does not break compatibility and not affect public interfaces, but improves performance. label Aug 27, 2026
@c-bata c-bata assigned not522 and unassigned c-bata Aug 27, 2026
@c-bata

c-bata commented Aug 27, 2026

Copy link
Copy Markdown
Member

@not522 Could you review this PR?

@not522 not522 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@not522
not522 merged commit f6898da into optuna:master Aug 27, 2026
14 checks passed
@not522 not522 added this to the v5.0.0 milestone Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Change that does not break compatibility and not affect public interfaces, but improves performance.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants