cypress icon indicating copy to clipboard operation
cypress copied to clipboard

fix(proxy/prerequests): fix duplicate key behavior, fallthrough

Open flotwig opened this issue 1 year ago • 2 comments

  • Closes

User facing changelog

  • Fixed an issue introduced in 10.3.0 where network logs could be missing certain information or cause certain requests to be delayed by 500ms.

Additional details

  • Performance fixes in https://github.com/cypress-io/cypress/pull/22462 caused a couple of unintended changes:
    • Missing return statement on line 77 here causes a matched prerequest to be queued anyways: https://github.com/cypress-io/cypress/blob/8fb785a4664acf74ab9eacc243c09763e2730bf7/packages/proxy/lib/http/util/prerequests.ts#L69-L83
    • More impactful, the Record<string, ...> data structure would clobber any duplicate url+method requests/pre-requests, which could manifest itself in incorrect pre-request data or unintended delays of requests by 500ms.
      • Replaced this with a StackMap which supports duplicate keys and .pop by key.

Steps to test

How has the user experience changed?

PR Tasks

  • [x] Have tests been added/updated?
  • [x] Has the original issue (or this PR, if no issue exists) been tagged with a release in ZenHub? (user-facing changes only)
  • [na] Has a PR for user-facing changes been opened in cypress-documentation?
  • [na] Have API changes been updated in the type definitions?

flotwig avatar Aug 09 '22 22:08 flotwig

Thanks for taking the time to open a PR!

cypress-bot[bot] avatar Aug 09 '22 22:08 cypress-bot[bot]



Test summary

37846 0 469 0Flakiness 4


Run details

Project cypress
Status Passed
Commit ba215e04d8
Started Aug 10, 2022 3:52 PM
Ended Aug 10, 2022 4:13 PM
Duration 21:07 💡
OS Linux Debian - 11.3
Browser Multiple

View run in Cypress Dashboard ➡️


Flakiness

cypress/proxy-logging.cy.ts Flakiness
1 Proxy Logging > request logging > xhr log has response body/status code when xhr response is logged second
2 Proxy Logging > request logging > xhr log has response body/status code when xhr response is logged second
e2e/origin/commands/assertions.cy.ts Flakiness
1 cy.origin assertions > #consoleProps > .should() and .and()
next.cy.ts Flakiness
1 Working with next-12.1.6 > should detect new spec

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

cypress[bot] avatar Aug 09 '22 22:08 cypress[bot]

Released in 10.5.0.

This comment thread has been locked. If you are still experiencing this issue after upgrading to Cypress v10.5.0, please open a new issue.

cypress-bot[bot] avatar Aug 15 '22 22:08 cypress-bot[bot]