fix: Include verification rules in affectedRequestIds to prevent silent check loss on redirect chain merge#1147
Draft
cursor[bot] wants to merge 1 commit intomainfrom
Draft
fix: Include verification rules in affectedRequestIds to prevent silent check loss on redirect chain merge#1147cursor[bot] wants to merge 1 commit intomainfrom
cursor[bot] wants to merge 1 commit intomainfrom
Conversation
…nt check loss on redirect chain merge Verification rules were excluded from affectedRequestIds, causing redirect chains to merge even when non-final hops had verification checks. The merge path only keeps the last hop's checks (checks: last.checks), silently dropping all checks from earlier hops. Concrete trigger: User adds a verification rule (e.g. status check) on a request that is part of a redirect chain but not the final hop. The chain merges and the check is silently removed from the generated k6 script. Co-authored-by: Edgar Fisher <e-fisher@users.noreply.github.com>
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.
Description
Bug: Verification rules were excluded from the
affectedRequestIdsset built inapplyRules(). This set controls whether redirect chains are merged or split inprocessRedirectChains(). When a chain is merged, only the last hop's checks survive (checks: last.checks), silently dropping any verification checks applied to non-final hops.Concrete trigger: A user adds a verification rule (e.g., assert status equals 302) that matches a request in a redirect chain (e.g.,
POST /login → 302 → GET /dashboard). The verification rule correctly adds a check to the first hop's snippet, but since verification is not inaffectedRequestIds, the chain merges and the check is silently removed from the generated k6 script. The user sees no error — the check simply does not appear in the output.Root cause: In
src/rules/rules.ts, theaffectedRequestIdscollection handledparameterization,customCode, andcorrelationrule types, but returned[]forverification, even though verification rules add checks to request snippets viamatchedRequestIds.Fix: Added
'verification'to the condition that collectsmatchedRequestIdsintoaffectedRequestIds, ensuring redirect chains containing verification-matched requests are split rather than merged.How to Test
does not drop checks from non-final hops when they are in affectedRequestIds— verifies that a 3-hop redirect chain with checks on non-final hops preserves all checks when the chain is affected.Checklist