Skip to content

feature/samples_summary_failsafe#1168

Merged
Jammy2211 merged 1 commit intomain_buildfrom
feature/samples_summary_failsafe
Jan 28, 2026
Merged

feature/samples_summary_failsafe#1168
Jammy2211 merged 1 commit intomain_buildfrom
feature/samples_summary_failsafe

Conversation

@Jammy2211
Copy link
Collaborator

This pull request updates the behavior of the instance method in autofit/aggregator/search_output.py to improve handling of cases where the max_log_likelihood method is unavailable. Instead of returning None, it now falls back to returning the instance from samples_summary.

Error handling improvement:

  • Updated the instance method to return self.samples_summary.instance when max_log_likelihood is not implemented or accessible, rather than returning None.

Copy link

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 pull request updates the instance property in the SearchOutput class to improve error handling when the max_log_likelihood method is unavailable. Instead of returning None, it now attempts to fall back to samples_summary.instance as an alternative source for the instance data.

Changes:

  • Modified exception handling in the instance property to return self.samples_summary.instance instead of None when AttributeError or NotImplementedError is raised

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

return self.samples.max_log_likelihood()
except (AttributeError, NotImplementedError):
return None
return self.samples_summary.instance
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

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

This change introduces a potential AttributeError that is not caught. The samples_summary property (line 227) calls self.value("samples_summary") which can return None if the file doesn't exist. When summary is None, line 228 will fail with AttributeError: 'NoneType' object has no attribute 'model'. Additionally, even if samples_summary is not None, accessing its instance property could raise exceptions since it internally calls max_log_likelihood().

The docstring on line 248 states "None if samples cannot be loaded", but the new code path doesn't handle these potential failures. Consider wrapping the fallback in a try-except block similar to the pattern used in autofit/non_linear/result.py:115-120, or add proper null checking.

Copilot uses AI. Check for mistakes.
@Jammy2211 Jammy2211 changed the title tested use of samples summary feature/samples_summary_failsafe Jan 28, 2026
@Jammy2211 Jammy2211 merged commit 79e284c into main_build Jan 28, 2026
10 checks passed
@Jammy2211 Jammy2211 deleted the feature/samples_summary_failsafe branch February 13, 2026 13:38
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.

3 participants