This repository was archived by the owner on Sep 3, 2025. It is now read-only.
fix(signal): keep existing filters on signal update#5973
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR introduces two endpoints for updating signal definitions while handling signal filters differently and fixes a CLI check to allow database initialization and restore when the database does not already exist.
- Updated the API endpoint for updating signals.
- Separated update endpoints for UI (with filters) and API (without filters).
- Refactored exception-handling in signal views and service functions and improved model definitions for user updates.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/dispatch/static/dispatch/src/signal/api.js | Adjusted the API endpoint for updating signals to include "/update/". |
| src/dispatch/signal/views.py | Added two separate update endpoints and refactored error handling. |
| src/dispatch/signal/service.py | Updated the signal update function to conditionally update filters. |
| src/dispatch/cli.py | Changed the CLI confirmation flow to return early for non-drop commands. |
| src/dispatch/auth/models.py | Updated Pydantic models for user updates with Optional types. |
Comments suppressed due to low confidence (3)
src/dispatch/auth/models.py:213
- [nitpick] Consider providing a default value (e.g., = None) for the 'organizations' field in the UserUpdate model for consistency with the other Optional fields.
organizations: Optional[list[UserOrganization]]
src/dispatch/static/dispatch/src/signal/api.js:21
- Ensure that changing the update endpoint path to include '/update/' is consistent with the overall API design and routing standards across the project.
return API.put(`${resource}/update/${signalId}`, payload)
src/dispatch/signal/service.py:540
- Confirm that SignalFilter objects are hashable and have an appropriate equality implementation, as they are used within a set for filter updates.
filter_set = set() if update_filters else set(signal.filters)
ghost
approved these changes
May 14, 2025
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
This PR creates two endpoints to update the signal defintion, one that allows the signal filters (snooze, deduplication) to be overwritten (a new endpoint just for the UI), and one that only allows addition of new signal filters (the existing endpoint). It also fixes a discrepancy with the cli check that wouldn't allow a database init and restore if the db didn't previously exist.