fix: invalid state and TypeError bug in _AllowedDomainNames.valid_name#5050
Open
fix: invalid state and TypeError bug in _AllowedDomainNames.valid_name#5050
_AllowedDomainNames.valid_name#5050Conversation
2 tasks
Up to standards ✅🟢 Issues
|
… fix ZoneError call Agent-Logs-Url: https://github.com/ansys/pyfluent/sessions/a493dbab-5525-4799-8b10-b99c18923d8d Co-authored-by: Gobot1234 <50501825+Gobot1234@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix potential data invalid state in _AllowedDomainNames
Fix invalid state and TypeError bug in Apr 2, 2026
_AllowedDomainNames.valid_name
…er PR #5048) Agent-Logs-Url: https://github.com/ansys/pyfluent/sessions/7cf80380-e40d-4804-b766-bab5a89d01f4 Co-authored-by: Gobot1234 <50501825+Gobot1234@users.noreply.github.com>
Gobot1234
reviewed
Apr 8, 2026
| ) | ||
|
|
||
|
|
||
| class DomainError(ValueError): |
Collaborator
There was a problem hiding this comment.
@prmukherj looks like ZoneError is defined above so I think the location of this exception should be fine
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes an exception-path bug in the solution variables domain validation helper so invalid/missing domain IDs reliably raise a proper, user-facing error (instead of triggering a TypeError). It also adds focused unit tests to prevent regressions related to issue #5042.
Changes:
- Add a new
DomainErrorexception type for invalid domain-name inputs. - Update
_AllowedDomainNames.valid_name()to return a domain ID when present and raiseDomainErrorwhen the ID cannot be resolved (including the priorTypeErrorscenario). - Add unit tests covering success,
0domain ID, missing domain ID, and invalid domain name.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/ansys/fluent/core/services/solution_variables.py |
Introduces DomainError and updates _AllowedDomainNames.valid_name() to avoid TypeError and to fail fast when domain_id is None. |
tests/test_solution_variables.py |
Adds unit tests validating _AllowedDomainNames.valid_name() behavior for valid/invalid domain names and missing IDs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
_AllowedDomainNames.valid_name_AllowedDomainNames.valid_name
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.
Fixes #5042 and adds a test to ensure can't happen