fix(http-provider): stop duplicating results on notify - #6687
Open
dngr2 wants to merge 1 commit into
Open
Conversation
HttpProvider._notify() called the public self.query() rather than the private self._query(). BaseProvider.notify() appends the return value to self.results, and BaseProvider.query() appends as well, so every HTTP action recorded its result twice in the workflow execution output. Calling _query() directly is equivalent here: notify() has already popped enrich_alert/enrich_incident/audit_enabled before invoking _notify(), and the dependency-tracking branch in query() only fires when the result is a list, whereas _query() returns a dict. Adds tests covering single-append on POST/PUT/DELETE, repeated notifies, the unchanged return value, and a guard that query() still records its own result when called directly. Fixes keephq#6431
dngr2
force-pushed
the
fix/6431-http-provider-duplicate-results
branch
from
August 12, 2026 02:51
67beae2 to
19b6193
Compare
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #6431
The bug
HttpProvider._notify()calls the publicself.query()instead of the privateself._query().BaseProvider.notify()appends the return value toself.results, andBaseProvider.query()appends as well — so every HTTP action records its result twice in the workflow execution output:[ {"status": true, "status_code": 200, "body": "..."}, {"status": true, "status_code": 200, "body": "..."} ]Thanks to @DANIILSKRIPCHENKO for the diagnosis in the issue — it was accurate, this PR is that fix plus tests.
Why calling
_query()directly is equivalentquery()does two things_query()does not, and neither applies here:enrich_alert/audit_enabledfrom kwargs — butnotify()has already popped those before it calls_notify(), so they are never present at this pointresults[0].__class__tocontext_manager.dependencieswhen the result is a list —_query()returns a dict, so that branch is a no-op for this providerTests
New file:
tests/providers/http_provider/test_http_provider_bugs.pyThe tests were written before the fix and run against unmodified
main: 6 failed, 1 passed, failing withLeft contains one more item. With the one-line change: 7 passed.notify()calls append two results, not fournotify()still returns the same payloadquery()called directly still records its own result, so the fix does not over-correcttests/providersin full: 60 passed. I have not run the suites that need Docker and a database locally — leaving those to CI.