Skip to content

Fix AttributeError masking dropped AEDT connection in solution_type fallback - #8025

Open
agu2347 wants to merge 2 commits into
ansys:mainfrom
agu2347:fix-default-solution-attribute-typo-issue-8020
Open

Fix AttributeError masking dropped AEDT connection in solution_type fallback#8025
agu2347 wants to merge 2 commits into
ansys:mainfrom
agu2347:fix-default-solution-attribute-typo-issue-8020

Conversation

@agu2347

@agu2347 agu2347 commented Aug 24, 2026

Copy link
Copy Markdown

Bug

Reported in #8020. design_solutions.py falls back to self._design_type.default_solution when GetSolutionType() raises, but every constant class in generic/aedt_constants.py (HfssConstants, Q3dConstants, IcepakConstants, Maxwell3dConstants, CircuitConstants, etc.) only defines solution_default:

python -c "from ansys.aedt.core.generic.aedt_constants import HfssConstants as H; print(hasattr(H, 'solution_default'), hasattr(H, 'default_solution'))"
True False

The fallback therefore raises AttributeError itself. Because this fallback runs exactly when the gRPC connection to AEDT has broken, the user sees 'HfssConstants' object has no attribute 'default_solution' instead of a connection error, which points debugging at design types instead of the actual failure.

DesignSolution.solution_type's getter already uses the correct solution_default spelling; the setter (value is None branch) and both of HFSSDesignSolution.solution_type's getter and setter still used default_solution. On current main this affects 9 call sites in src/ansys/aedt/core/application/design_solutions.py, all identical in shape (self._design_type.default_solution).

Fix

Rename all 9 remaining default_solution accesses to solution_default, matching every other call site in the file and the actual attribute the constant classes define. No changes needed to the constants themselves.

Testing

No AEDT installation or license is required to reproduce or verify this — the bug is a pure attribute-name mismatch between two Python modules.

Added tests/unit/test_design_solutions.py:

  • test_constants_only_define_solution_default — confirms the constant classes define solution_default and not default_solution.
  • test_design_solution_getter_falls_back_on_connection_error — control, exercises the getter's already-correct branch.
  • test_design_solution_setter_falls_back_on_connection_error — regression test for the setter's value is None branch, using a fake ODesign whose GetSolutionType() raises to simulate a dropped connection.
  • test_design_solution_setter_no_odesign_falls_back — regression test for the no-_odesign fallback branch.
  • test_hfss_design_solution_getter_falls_back_on_connection_error — regression test for HFSSDesignSolution's getter.

Verified all 3 regression tests reproduce the exact reported AttributeError against the unfixed code (reverted design_solutions.py to the current main version, reran — 3 failed with AttributeError: type object 'HfssConstants'/'Q3dConstants' has no attribute 'default_solution', 2 passed as controls), then reapplied the fix and reran — all 5 pass.

Fixes #8020

…allback

design_solutions.py falls back to self._design_type.default_solution
when self._odesign.GetSolutionType() raises (e.g. because the gRPC
connection to AEDT was lost). Every constant class in
generic/aedt_constants.py only defines solution_default, never
default_solution, so this fallback itself raises AttributeError. That
AttributeError, naming a design-type constant, replaces the original
connection error and points debugging in the wrong direction.

DesignSolution.solution_type already uses the correct solution_default
spelling in its getter; the setter (value=None branch) and
HFSSDesignSolution.solution_type getter/setter still used the wrong
default_solution spelling. Fix all nine remaining occurrences.

Added tests/unit/test_design_solutions.py with unit tests (no AEDT
installation required) that reproduce the exact AttributeError against
the unfixed code via a fake ODesign whose GetSolutionType() raises, and
pass against the fix.

Fixes ansys#8020
@agu2347
agu2347 requested a review from a team as a code owner August 24, 2026 16:26
@ansys-cla-bot

ansys-cla-bot Bot commented Aug 24, 2026

Copy link
Copy Markdown

The following people have not signed the Contributors License Agreement (CLA):

Read the CLA in the link above and sign it by clicking below:

You will receive a confirmation as soon as your signature is captured.

Note

Action Required: Repository maintainers with write access can trigger a recheck by commenting
@cla-bot rerun
Please contact the maintainers to rerun the CLA check after the missing signatures have been captured.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AttributeError: 'HfssConstants' has no attribute 'default_solution' masks the real connection error (constants define solution_default)

1 participant