fix(api): add mode validation for WandBConfig and SwanlabConfig#1134
Merged
garrett4wade merged 1 commit intoApr 7, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces validation for the 'mode' attribute in the WandBConfig and SwanlabConfig classes and updates the CLI documentation. The reviewer recommended using dataclasses.field with metadata to improve CLI help consistency and suggested formatting validation error messages as comma-separated lists for better readability.
Add __post_init__ validation for tracking mode fields to catch
configuration errors early:
- WandBConfig: validate mode is one of {online, offline, disabled, shared}
- SwanlabConfig: validate mode is one of {cloud, local, disabled, offline}
- Use field() with metadata (help + choices) for CLI help consistency
- Fix SwanlabConfig.mode type hint: str | None -> str
- Format error messages as comma-separated lists for readability
BREAKING CHANGE: Invalid mode values that were previously silently
accepted will now raise ValueError at config initialization.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
guozhihao-224
force-pushed
the
fix/api-validate-tracking-mode
branch
from
April 2, 2026 14:26
99f9298 to
2df1161
Compare
SathyaGnanakumar
pushed a commit
to danielkiely/AReaL
that referenced
this pull request
Apr 29, 2026
…l-project#1134) Add __post_init__ validation for tracking mode fields to catch configuration errors early: - WandBConfig: validate mode is one of {online, offline, disabled, shared} - SwanlabConfig: validate mode is one of {cloud, local, disabled, offline} - Use field() with metadata (help + choices) for CLI help consistency - Fix SwanlabConfig.mode type hint: str | None -> str - Format error messages as comma-separated lists for readability BREAKING CHANGE: Invalid mode values that were previously silently accepted will now raise ValueError at config initialization. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This was referenced May 14, 2026
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Add
__post_init__validation for tracking mode fields inWandBConfigandSwanlabConfigto catch configuration errors early. Also fix type hint inconsistency inSwanlabConfig.mode(str | None→str) to align with validation behavior.Related Issue
None
Type of Change
Checklist
jb build docs/gemini review)Breaking Change Details (if applicable):
Invalid mode values that were previously silently accepted will now raise
ValueErrorat config initialization. This helps users catch configuration errors early rather than failing silently.Additional Context
Files changed:
areal/api/cli_args.py: Add validation and docstrings for mode fieldsdocs/en/cli_reference.md: Update SwanlabConfig.mode type in docsdocs/zh/cli_reference.md: Update SwanlabConfig.mode type in docs