Skip to content

fix: invalid state and TypeError bug in _AllowedDomainNames.valid_name#5050

Open
Copilot wants to merge 4 commits intomainfrom
copilot/fix-allowed-domain-names-invalid-state
Open

fix: invalid state and TypeError bug in _AllowedDomainNames.valid_name#5050
Copilot wants to merge 4 commits intomainfrom
copilot/fix-allowed-domain-names-invalid-state

Conversation

Copy link
Copy Markdown

Copilot AI commented Apr 2, 2026

Fixes #5042 and adds a test to ensure can't happen

@codacy-production
Copy link
Copy Markdown

codacy-production bot commented Apr 2, 2026

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

TIP This summary will be updated as you push new changes. Give us feedback

… 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 _AllowedDomainNames.valid_name Apr 2, 2026
Copilot AI requested a review from Gobot1234 April 2, 2026 13:26
)


class DomainError(ValueError):
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@prmukherj looks like ZoneError is defined above so I think the location of this exception should be fine

@github-actions github-actions bot added the bug Issue, problem or error in PyFluent label Apr 8, 2026
@Gobot1234 Gobot1234 marked this pull request as ready for review April 8, 2026 10:22
Copilot AI review requested due to automatic review settings April 8, 2026 10:22
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 DomainError exception type for invalid domain-name inputs.
  • Update _AllowedDomainNames.valid_name() to return a domain ID when present and raise DomainError when the ID cannot be resolved (including the prior TypeError scenario).
  • Add unit tests covering success, 0 domain 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.

@Gobot1234 Gobot1234 changed the title Fix invalid state and TypeError bug in _AllowedDomainNames.valid_name fix: invalid state and TypeError bug in _AllowedDomainNames.valid_name Apr 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Issue, problem or error in PyFluent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Potential data invalid state between _AllowedDomainNames.valid_name

4 participants