Suggestion: use ConnectorResponseSizeLimitError typed error (re: elastic/kibana#268591) - #4
Draft
jcger wants to merge 2 commits into
Draft
Conversation
jcger
force-pushed
the
pr-268591-typed-response-size-error
branch
from
May 14, 2026 10:59
8a06ae2 to
9e95d24
Compare
9 tasks
jcger
pushed a commit
that referenced
this pull request
Jul 30, 2026
## Summary Fixes this test that has been failing CI on `main`: ``` Fleet Cypress Tests #4 / Assets - Real API for integration with ML and transforms should install integration with ML module & transforms ``` Example affected PR: elastic#277223 ### Cause This test failed recently when integration `lmd` 3.0.0 was published. elastic#264584 fixed it. `lmd` 3.3.0 was [recently pusblished](elastic/integrations#19998) which changed the transform source index from `logs-*` to `logs-endpoint.events.process-*`. It seems likely that that source data stream doesn't exist in CI, so the transform health would be non-green, causing the test's final assertion `expect(response.body.transforms[0].health.status).to.equal('green')` to fail. ### Fix Add a `before` step to create an empty `logs-endpoint.events.process-default` index and delete it after the test. ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/docs/extend/kibana/contributing/workflow/how-we-use-github#release-notes) - [ ] Review the [backport guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing) and apply applicable `backport:*` labels. ### Identify risks N/A: fixes a failing Cypress test.
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.
Context
This is a suggestion for elastic/kibana#268591 showing what the
ConnectorAuthorizationErrorpattern would look like applied to the response size limit case.What this adds
ConnectorResponseSizeLimitErrorinkbn-connector-specs— a typed error with explicitlimitBytes,contentLengthBytes, andestimatedOutputBytesfields, following the same shape asConnectorAuthorizationError. Also adds a WeakMap-basedsetConnectorActionErrorMeta/getConnectorActionErrorMetaAPI so connector actions can annotate errors with provider-specific size hints before the executor processes them.responseSizeHeaderonActionDefinition— lets a connector declare which HTTP response header advertises the response size (defaults tocontent-length). The generated executor reads this header when a size-limit error occurs.get_axios_instance.ts— adds an Axios response interceptor that convertsERR_BAD_RESPONSEerrors intoConnectorResponseSizeLimitErrorat the point the HTTP client aborts the stream.generate_executor_function.ts— catchesConnectorResponseSizeLimitErrorfrom the interceptor and rethrows it enriched with connector-specific metadata: the connector's declaredresponseSizeHeadervalue and any WeakMap-annotated hints from the action handler (e.g. Jina'sx-decompressed-content-length).action_executor.ts— handlesConnectorResponseSizeLimitErrorin the catch block (parallel to the existingisConnectorAuthorizationErrorbranch), serializing it into the action result aserrorName: 'ConnectorResponseSizeLimitError'and structurederrorMeta.ActionsResponseContentLengthLimitErrorin the workflow layer — a newExecutionErrorsubtype for when the Actions HTTP limit fires before the workflow step can enforcemax-step-size. Gives actionable guidance including whether raisingmax-step-sizewould also raise the connector request limit.connector_step.ts— replaces theerrorMsg.includes('maxContentLength')string-match witherrorName === 'ConnectorResponseSizeLimitError'as the primary detection path. Routes toResponseSizeLimitErrorwhen the workflow transport limit applies (i.e.httptype, or spec connector withmax-step-size), or toActionsResponseContentLengthLimitErrorwhen the actions HTTP limit fired before the workflow could apply its own limit.ResponseSizeLimitError— extended to accept and surfacecontentLengthBytesandestimatedOutputBytesin the error message anddetails, including a suggestedmax-step-sizevalue when one can be derived.What this changes vs. the original PR
The cross-layer contract (actions plugin → workflow step) becomes explicit and typed instead of an untyped
Record<string, unknown>bag detected by string-matching an internal Axios message. The olderrorMsg.includes('maxContentLength')check is removed entirely; detection is now driven byerrorName.