Skip to content

Fix tags api - #2011

Open
hmpf wants to merge 3 commits into
incident-api-v3from
fix-tags-api
Open

Fix tags api#2011
hmpf wants to merge 3 commits into
incident-api-v3from
fix-tags-api

Conversation

@hmpf

@hmpf hmpf commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Scope and purpose

Fixes #136. Dependent on #2010

This only fixes the API and does not touch the database.

The tests have been copied and updated from v2, and split up a bit for easier debugging.

This pull request

  • changes the API

Contributor Checklist

Every pull request should have this checklist filled out, no matter how small it is.
More information about contributing to Argus can be found in the
Development docs.

  • Added a changelog fragment for towncrier
  • Added/amended tests for new/changed code
  • Added/changed documentation, including updates to the user manual if feature flow or UI is considerably changed
  • Linted/formatted the code with ruff and djLint, easiest by using pre-commit
  • The first line of the commit message continues the sentence "If applied, this commit will ...", starts with a capital letter, does not end with punctuation and is 50 characters or less long. See our how-to
  • If applicable: Created new issues if this PR does not fix the issue completely/there is further work to be done
  • [ ] If this results in changes in the UI: Added screenshots of the before and after
  • [ ] If this results in changes to the database model: Updated the ER diagram

@hmpf hmpf self-assigned this Jul 30, 2026
@hmpf hmpf added API Affects Argus' REST API API v2 Ideas for API v2, backwards incompatible NOT OK API v3 Ideas for API v3, backwards incompatible OK labels Jul 30, 2026
@github-actions

Copy link
Copy Markdown

Warning

48 of 48 new test names are missing convention keywords (given/when/then/it_should)

File Test name
tests/incident/v3/test_serializers.py test_validate_stateful_incident_data
tests/incident/v3/test_serializers.py test_validate_stateless_incident_data
tests/incident/v3/test_serializers.py test_validate_early_end_time
tests/incident/v3/test_serializers.py test_validate_erroneus_end_time
tests/incident/v3/test_serializers.py test_incident_serializer_is_invalid_with_incorrect_ticket_url
tests/incident/v3/test_serializers.py test_incident_serializer_is_valid_with_correct_tags
tests/incident/v3/test_serializers.py test_incident_serializer_is_invalid_with_incorrect_tags
tests/incident/v3/test_serializers.py test_incident_pure_deserializer_is_valid_with_correct_input
tests/incident/v3/test_serializers.py test_incident_pure_deserializer_is_invalid_with_forbidden_fields
tests/incident/v3/test_serializers.py test_incident_pure_deserializer_is_invalid_with_additional_fields
tests/incident/v3/test_serializers.py test_incident_pure_deserializer_is_invalid_with_incorrect_ticket_url
tests/incident/v3/test_serializers.py test_incident_pure_deserializer_can_create_tags
tests/incident/v3/test_serializers.py test_tag_serializer_is_valid_with_correct_input
tests/incident/v3/test_serializers.py test_tag_serializer_is_invalid_with_wrong_form
tests/incident/v3/test_serializers.py test_tag_serializer_is_invalid_with_empty_key
tests/incident/v3/test_views.py test_cannot_delete_incident_if_indelible_is_True
tests/incident/v3/test_views.py test_superuser_can_delete_incident_if_indelible_is_False
tests/incident/v3/test_views.py test_source_can_delete_owned_incident_if_indelible_is_False
tests/incident/v3/test_views.py test_can_delete_acknowledged_incidente
tests/incident/v3/test_views.py test_source_cannot_delete_unowned_incident_if_indelible_is_False
tests/incident/v3/test_views.py test_nonsource_nonsuperuser_cannot_delete_incident
tests/incident/v3/test_views.py test_filter_by_filter_pk_returns_no_incidents_on_non_existent_filter
tests/incident/v3/test_views.py test_filter_by_filter_pk_raises_error_on_invalid_decimal_pk
tests/incident/v3/test_views.py test_filter_by_filter_pk_returns_no_incidents_on_someone_elses_filter
tests/incident/v3/test_views.py test_can_get_all_incidents
tests/incident/v3/test_views.py test_can_get_incident_by_incident_description
tests/incident/v3/test_views.py test_can_get_incident_by_event_description
tests/incident/v3/test_views.py test_cannot_get_incident_by_nonexisting_description
tests/incident/v3/test_views.py test_can_get_incident_by_incident_description_and_event_description
tests/incident/v3/test_views.py test_can_get_multiple_incidents_by_incident_description
tests/incident/v3/test_views.py test_can_get_multiple_incidents_by_incident_description_and_event_description
tests/incident/v3/test_views.py test_can_get_specific_incident
tests/incident/v3/test_views.py test_can_create_incident_with_tag
tests/incident/v3/test_views.py test_can_update_incident_level
tests/incident/v3/test_views.py test_can_update_incident_metadata
tests/incident/v3/test_views.py test_can_update_incident_description
tests/incident/v3/test_views.py test_can_create_ticket_url_of_incident
tests/incident/v3/test_views.py test_can_get_all_tags_of_incident
tests/incident/v3/test_views.py test_can_get_specific_tag_of_incident
tests/incident/v3/test_views.py test_can_create_tag_of_incident
tests/incident/v3/test_views.py test_cannot_create_tag_of_incident_with_invalid_key
tests/incident/v3/test_views.py test_can_delete_tag_of_incident
tests/incident/v3/test_views.py test_can_get_my_incidents
tests/incident/v3/test_views.py test_can_create_my_incident_with_tag
tests/incident/v3/test_views.py test_can_get_all_source_systems
tests/incident/v3/test_views.py test_can_get_specific_source_system
tests/incident/v3/test_views.py test_can_create_source_system
tests/incident/v3/test_views.py test_can_update_source_system
Why am I seeing this?

Test names should follow a loose given/when/then pattern with keywords like given, when, then, or it_should. This is a suggestion, not a blocker. The check runs on new test methods added in this PR.

Examples:

  • test_when_no_incidents_then_returns_empty_list
  • test_it_should_create_incident_with_set_description
  • test_given_expired_token_when_refreshing_then_raises_error

@github-actions

github-actions Bot commented Jul 30, 2026

Copy link
Copy Markdown

Test results

    8 files  1 840 suites   3m 24s ⏱️
1 028 tests 1 027 ✅ 1 💤 0 ❌
8 224 runs  8 216 ✅ 8 💤 0 ❌

Results for commit af092db.

♻️ This comment has been updated with latest results.

@johannaengland
johannaengland requested a review from a team July 30, 2026 13:26
@hmpf
hmpf force-pushed the fix-tags-api branch 2 times, most recently from a81ade5 to 4532648 Compare July 31, 2026 06:23
@codecov

codecov Bot commented Jul 31, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.40288% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.18%. Comparing base (c1fe0ef) to head (af092db).

Files with missing lines Patch % Lines
src/argus/incident/v3/serializers.py 96.07% 2 Missing ⚠️
src/argus/incident/v3/views.py 95.65% 2 Missing ⚠️
src/argus/incident/factories.py 96.29% 1 Missing ⚠️
Additional details and impacted files
@@                 Coverage Diff                 @@
##           incident-api-v3    #2011      +/-   ##
===================================================
+ Coverage            88.97%   89.18%   +0.21%     
===================================================
  Files                  155      156       +1     
  Lines                 7346     7474     +128     
===================================================
+ Hits                  6536     6666     +130     
+ Misses                 810      808       -2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@hmpf
hmpf force-pushed the fix-tags-api branch 2 times, most recently from 8711b13 to 19e7357 Compare July 31, 2026 07:53
@hmpf
hmpf changed the base branch from main to incident-api-v3 July 31, 2026 10:36
@hmpf
hmpf force-pushed the fix-tags-api branch 2 times, most recently from f9cb546 to 8f548d4 Compare July 31, 2026 10:56
hmpf added 3 commits July 31, 2026 12:59
* BaseIncidentViewSet
* IncidentViewSet
* SourceLockedIncidentViewSet

.. and move HeartbeatMixin to an API version-independent file.
.. the huge test case for API integration tests has been broken up into
one class per viewset and one class per extra action.
@sonarqubecloud

Copy link
Copy Markdown

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

Labels

API v2 Ideas for API v2, backwards incompatible NOT OK API v3 Ideas for API v3, backwards incompatible OK API Affects Argus' REST API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Simplify the tag data structure required by the Incident API endpoint

2 participants