Skip to content

fix(http-provider): stop duplicating results on notify - #6687

Open
dngr2 wants to merge 1 commit into
keephq:mainfrom
dngr2:fix/6431-http-provider-duplicate-results
Open

fix(http-provider): stop duplicating results on notify#6687
dngr2 wants to merge 1 commit into
keephq:mainfrom
dngr2:fix/6431-http-provider-duplicate-results

Conversation

@dngr2

@dngr2 dngr2 commented Aug 12, 2026

Copy link
Copy Markdown

Fixes #6431

The bug

HttpProvider._notify() calls the public self.query() instead of the private self._query().

BaseProvider.notify() appends the return value to self.results, and BaseProvider.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 equivalent

query() does two things _query() does not, and neither applies here:

  • it pops enrich_alert / audit_enabled from kwargs — but notify() has already popped those before it calls _notify(), so they are never present at this point
  • it adds results[0].__class__ to context_manager.dependencies when the result is a list — _query() returns a dict, so that branch is a no-op for this provider

Tests

New file: tests/providers/http_provider/test_http_provider_bugs.py

The tests were written before the fix and run against unmodified main: 6 failed, 1 passed, failing with Left contains one more item. With the one-line change: 7 passed.

  • exactly one result appended, on POST / PUT / DELETE
  • two notify() calls append two results, not four
  • notify() still returns the same payload
  • guard: query() called directly still records its own result, so the fix does not over-correct

tests/providers in full: 60 passed. I have not run the suites that need Docker and a database locally — leaving those to CI.

@dosubot dosubot Bot added size:XS This PR changes 0-9 lines, ignoring generated files. Bug Something isn't working Provider Providers related issues labels Aug 12, 2026
@CLAassistant

CLAassistant commented Aug 12, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

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
dngr2 force-pushed the fix/6431-http-provider-duplicate-results branch from 67beae2 to 19b6193 Compare August 12, 2026 02:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something isn't working Provider Providers related issues size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[🐛 Bug]: HTTP provider action results duplicated in workflow execution output

2 participants