Skip to content
This repository was archived by the owner on Sep 3, 2025. It is now read-only.

Conversation

@whitdog47
Copy link
Contributor

@whitdog47 whitdog47 commented May 30, 2025

This PR addresses an issue where get_by_name_or_default was throwing a ValidationError when a name wasn’t found by refactoring the logic across multiple services and updating error messages to reflect the new expected output.

  • Refactored get_by_name_or_default functions to combine the existence and name-check conditions.
  • Updated ValidationError messages in various services to ensure consistency.
  • Added new tests to verify behavior for both found and default cases across projects, organizations, incidents, and cases.

@whitdog47 whitdog47 requested review from Copilot and mvilanova May 30, 2025 18:04
@whitdog47 whitdog47 self-assigned this May 30, 2025
@whitdog47 whitdog47 added the bug Something isn't working label May 30, 2025
Copy link
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 addresses an issue where get_by_name_or_default was not returning the correct value when a name wasn’t found by refactoring the logic across multiple services and updating error messages to reflect the new expected output.

  • Refactored get_by_name_or_default functions to combine the existence and name-check conditions.
  • Updated ValidationError messages in various services to ensure consistency.
  • Added new tests to verify behavior for both found and default cases across projects, organizations, incidents, and cases.

Reviewed Changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/signal/test_signal_service.py Updated assertions on error messages for signal creation/update.
tests/project/test_project_service.py Minor formatting update and added tests for get_by_name_or_default.
tests/organization/test_organization_service.py Added tests for get_by_name_or_default on organization service.
tests/incident_type/test_incident_type_service.py Added tests for get_by_name_or_default for incident types.
tests/incident_priority/test_incident_priority_service.py Added tests for incident priority get_by_name_or_default.
tests/case_type/test_case_type_service.py Added tests for case type get_by_name_or_default.
src/dispatch/project/service.py Simplified get_by_name_or_default logic.
src/dispatch/organization/service.py Similar refactoring for get_by_name_or_default.
src/dispatch/incident/type/service.py Refactored ValidationError formatting and lookup logic.
src/dispatch/incident/severity/service.py Consistent changes to error-handling and lookup in get_by_name_or_default.
src/dispatch/incident/priority/service.py Refactored similar to other incident service modules.
src/dispatch/case/type/service.py Simplified nested checks in get_by_name_or_default.
src/dispatch/case/severity/service.py Adjusted error messages and conditional logic in get_by_name_or_default.
src/dispatch/case/priority/service.py Reformatted ValidationError messages and refactored lookup logic.

@whitdog47 whitdog47 merged commit b2c20f7 into main Jun 2, 2025
14 checks passed
@whitdog47 whitdog47 deleted the fix/get-by-name-or-default-validation-error branch June 2, 2025 16:32
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants