Skip to content

fix: filter Keep-internal fields from Jira kwargs#5630

Open
zekebawt wants to merge 2 commits intokeephq:mainfrom
zekebawt:fix/jira-kwargs-regression
Open

fix: filter Keep-internal fields from Jira kwargs#5630
zekebawt wants to merge 2 commits intokeephq:mainfrom
zekebawt:fix/jira-kwargs-regression

Conversation

@zekebawt
Copy link
Contributor

@zekebawt zekebawt commented Feb 15, 2026

Fixes #5534

Fixes regression introduced in #5607 where Keep-internal workflow fields were being passed to Jira API, causing errors.

Problem

The kwargs block added in #5607 filtered priority values but passed all remaining kwargs to Jira fields. This included Keep-internal fields that Jira rejects with 'cannot be set' errors.

Reported by @Eliesmbr in #5607 comments.

Solution

Added explicit filtering for Keep-internal fields:

  • enrich_alert, enrich_incident
  • dispose_on_new_alert
  • audit_enabled
  • if, name, condition, foreach, throttle, provider

These are now skipped while legitimate Jira fields continue to work.

Testing

Regression Fixed

Resolves: 'Field '''enrich_alert''' cannot be set. It is not on the appropriate screen, or unknown.'

@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Feb 15, 2026
@vercel
Copy link

vercel bot commented Feb 15, 2026

@zekebawt is attempting to deploy a commit to the KeepHQ Team on Vercel.

A member of the Team first needs to authorize it.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 15, 2026

Target branch is not in the allowed branches list.

@dosubot dosubot bot added API API related issues Bug Something isn't working labels Feb 15, 2026
Fixes regression introduced in keephq#5607 where Keep-internal workflow fields
(enrich_alert, enrich_incident, dispose_on_new_alert, audit_enabled, etc.)
were being passed to Jira API, causing 'cannot be set' errors.

Filtered fields:
- enrich_alert, enrich_incident
- dispose_on_new_alert
- audit_enabled
- if, name, condition, foreach, throttle, provider

Preserves original keephq#5607 priority filtering logic.
Closes regression reported by @Eliesmbr in keephq#5607.
@zekebawt zekebawt force-pushed the fix/jira-kwargs-regression branch from 80e6186 to c2a4f1a Compare February 15, 2026 17:39
Copy link
Member

@shahargl shahargl left a comment

Choose a reason for hiding this comment

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

lgtm

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Feb 15, 2026
@shahargl shahargl enabled auto-merge (squash) February 15, 2026 18:45
@shahargl
Copy link
Member

@zekebawt would you mind fix the "test docs" step?

@Eliesmbr
Copy link
Contributor

I think also some unit tests are failing because of the new change. Would you mind fixing these @zekebawt ? Currently all new PR pipelines will fail.

@Eliesmbr
Copy link
Contributor

Eliesmbr commented Feb 27, 2026

The 5 failing tests in tests/providers/jira_provider/test_jira_priority_fix.py are not caused by your code changes in this PR. They were introduced in #5607 but never ran in CI because GitHub requires workflow approval for first-time fork contributors the PR was merged before tests were triggered.

The tests use @responses.activate to mock HTTP calls. Unlike @patch("requests.post") (used by the existing Jira tests in tests/test_jira_provider.py), @responses.activate lets the real requests.post()Session.request() code path execute and only intercepts at the HTTP adapter level.

This hits a monkey-patch in keep/api/api.py:96-105 that replaces Session.request with no_redirect_request. When api.py is loaded more than once in the test process, original_request ends up pointing to no_redirect_request itself instead of the real method causing infinite recursion:

keep/api/api.py:102: in no_redirect_request
    return original_request(self, method, url, **kwargs)
keep/api/api.py:102: in no_redirect_request
    return original_request(self, method, url, **kwargs)
...
RecursionError: maximum recursion depth exceeded in comparison

The tests should use @patch("requests.post") instead of @responses.activate, consistent with the existing Jira provider tests in tests/test_jira_provider.py.

Unfortunately i can not commit to zekebawt:fix/jira-kwargs-regression.

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

Labels

API API related issues Bug Something isn't working lgtm This PR has been approved by a maintainer size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[🐛 Bug]: Create issue on jira if priority is not present

3 participants