# Behavior traces — cypress-io/cypress

> Canonical page: https://codevetter.com/unpack/cypress/behavior-traces

# Behavior traces — cypress-io/cypress

Scanned commit 7d987f04740f8f5388ac3116e8ef7957373ead14 (2026-10-02). Generated by codevetter codevetter 1.15.0 on 2026-10-02.

Source inspection; upstream code and tests were not executed.

Three concrete flows were followed across their relevant files: test-run startup/results, interception registration through response completion, and interactive-session persistence through CLI attachment. The traces below retain important branches such as dev verification bypass, recording delegation, static-response termination, and browser-readiness filtering. A supplementary startup trace explains how the interactive window becomes available.
- Run entry: bin/cypress.ts → CLI.init() → run command action → runModule.start() → processRunOptions() → spawnStart(); non-dev execution awaits binary verify.start(), while dev execution bypasses it. — [cli/lib/bin/cypress.ts#L1-5](https://github.com/cypress-io/cypress/blob/7d987f04740f8f5388ac3116e8ef7957373ead14/cli/lib/bin/cypress.ts#L1-L5) [cli/lib/cli.ts#L506-515](https://github.com/cypress-io/cypress/blob/7d987f04740f8f5388ac3116e8ef7957373ead14/cli/lib/cli.ts#L506-L515) [cli/lib/exec/run.ts#L179-212](https://github.com/cypress-io/cypress/blob/7d987f04740f8f5388ac3116e8ef7957373ead14/cli/lib/exec/run.ts#L179-L212)
- Run initialization: cypress.start() parses argv and selects run for runProject → startInMode() → runElectron() → modes factory → setCtx(makeDataContext()) and initializeMode() → modes/run.run() awaits loading and calls ready(). — [packages/server/lib/cypress.ts#L141-158](https://github.com/cypress-io/cypress/blob/7d987f04740f8f5388ac3116e8ef7957373ead14/packages/server/lib/cypress.ts#L141-L158) [packages/server/lib/cypress.ts#L193-209](https://github.com/cypress-io/cypress/blob/7d987f04740f8f5388ac3116e8ef7957373ead14/packages/server/lib/cypress.ts#L193-L209) [packages/server/lib/modes/index.ts#L26-40](https://github.com/cypress-io/cypress/blob/7d987f04740f8f5388ac3116e8ef7957373ead14/packages/server/lib/modes/index.ts#L26-L40) [packages/server/lib/modes/run.ts#L1298-1325](https://github.com/cypress-io/cypress/blob/7d987f04740f8f5388ac3116e8ef7957373ead14/packages/server/lib/modes/run.ts#L1298-L1325)
- Run completion: ready() discovers browsers and opens the project, validates recording parameters, and handles empty specs; runAllSpecs() calls runSpecs(), which invokes before:run → iterateThroughSpecs/runEachSpec → runSpec() → after:run → writeOutput(). Recording delegates through createRunAndRecordSpecs; POSIX mode collapses failure counts except reserved code 112. — [packages/server/lib/modes/run.ts#L1146-1163](https://github.com/cypress-io/cypress/blob/7d987f04740f8f5388ac3116e8ef7957373ead14/packages/server/lib/modes/run.ts#L1146-L1163) [packages/server/lib/modes/run.ts#L1186-1203](https://github.com/cypress-io/cypress/blob/7d987f04740f8f5388ac3116e8ef7957373ead14/packages/server/lib/modes/run.ts#L1186-L1203) [packages/server/lib/modes/run.ts#L951-998](https://github.com/cypress-io/cypress/blob/7d987f04740f8f5388ac3116e8ef7957373ead14/packages/server/lib/modes/run.ts#L951-L998) [packages/server/lib/cypress.ts#L261-286](https://github.com/cypress-io/cypress/blob/7d987f04740f8f5388ac3116e8ef7957373ead14/packages/server/lib/cypress.ts#L261-L286)
- Intercept registration: addCommand() installs intercept → getMatcherOptions() → validateRouteMatcherOptions() → addRoute() → emitNetEvent('route:added') via Cypress.backend('net', ...) → onNetStubbingEvent() → onRouteAdded(). — [packages/driver/src/cy/net-stubbing/add-command.ts#L304-315](https://github.com/cypress-io/cypress/blob/7d987f04740f8f5388ac3116e8ef7957373ead14/packages/driver/src/cy/net-stubbing/add-command.ts#L304-L315) [packages/driver/src/cy/net-stubbing/add-command.ts#L216-239](https://github.com/cypress-io/cypress/blob/7d987f04740f8f5388ac3116e8ef7957373ead14/packages/driver/src/cy/net-stubbing/add-command.ts#L216-L239) [packages/driver/src/cy/net-stubbing/events/index.ts#L49-55](https://github.com/cypress-io/cypress/blob/7d987f04740f8f5388ac3116e8ef7957373ead14/packages/driver/src/cy/net-stubbing/events/index.ts#L49-L55) [packages/net-stubbing/lib/server/driver-events.ts#L111-124](https://github.com/cypress-io/cypress/blob/7d987f04740f8f5388ac3116e8ef7957373ead14/packages/net-stubbing/lib/server/driver-events.ts#L111-L124)
- Intercept request: SetMatchingRoutes() applies dev-server/preflight conditions and core.matchRoutes() → InterceptRequest() → core.handleRequest() → handleInterceptRequest() creates and registers InterceptedRequest → ensureBody() → addDefaultSubscriptions() → before:request handlers → merge changes → end() if responseSent, otherwise continueRequest(). — [packages/net-stubbing/lib/server/middleware/request.ts#L15-58](https://github.com/cypress-io/cypress/blob/7d987f04740f8f5388ac3116e8ef7957373ead14/packages/net-stubbing/lib/server/middleware/request.ts#L15-L58) [packages/network-interception/lib/core/network-interception-core.ts#L59-60](https://github.com/cypress-io/cypress/blob/7d987f04740f8f5388ac3116e8ef7957373ead14/packages/network-interception/lib/core/network-interception-core.ts#L59-L60) [packages/net-stubbing/lib/server/handle-intercept-request.ts#L31-48](https://github.com/cypress-io/cypress/blob/7d987f04740f8f5388ac3116e8ef7957373ead14/packages/net-stubbing/lib/server/handle-intercept-request.ts#L31-L48) [packages/net-stubbing/lib/server/handle-intercept-request.ts#L93-139](https://github.com/cypress-io/cypress/blob/7d987f04740f8f5388ac3116e8ef7957373ead14/packages/net-stubbing/lib/server/handle-intercept-request.ts#L93-L139)
- Intercept response: handleInterceptResponse() bypasses unmatched requests, obtains a plain-text/binary body, invokes before:response → response:callback → response subscriptions, merges response/header changes, and continues with getBodyStream(); response finish emits after:response and removes the request from server state. — [packages/net-stubbing/lib/server/handle-intercept-response.ts#L22-55](https://github.com/cypress-io/cypress/blob/7d987f04740f8f5388ac3116e8ef7957373ead14/packages/net-stubbing/lib/server/handle-intercept-response.ts#L22-L55) [packages/net-stubbing/lib/server/handle-intercept-response.ts#L67-83](https://github.com/cypress-io/cypress/blob/7d987f04740f8f5388ac3116e8ef7957373ead14/packages/net-stubbing/lib/server/handle-intercept-response.ts#L67-L83) [packages/net-stubbing/lib/server/handle-intercept-request.ts#L54-65](https://github.com/cypress-io/cypress/blob/7d987f04740f8f5388ac3116e8ef7957373ead14/packages/net-stubbing/lib/server/handle-intercept-request.ts#L54-L65)
- Session lifecycle: ProjectBase registers an open-mode session → addSession() creates UUID identity → persist() serializes writes and renames a temporary JSON file → CLI readLiveSessions() validates records/reaps dead PIDs → verifySessionRecord() checks the session echo and CDP /json/version → resolveSession() filters ready supported sessions → CDP attachment probes page targets for the tap binding. — [packages/server/lib/project-base.ts#L268-274](https://github.com/cypress-io/cypress/blob/7d987f04740f8f5388ac3116e8ef7957373ead14/packages/server/lib/project-base.ts#L268-L274) [packages/server/lib/cypress-sessions.ts#L25-61](https://github.com/cypress-io/cypress/blob/7d987f04740f8f5388ac3116e8ef7957373ead14/packages/server/lib/cypress-sessions.ts#L25-L61) [cli/lib/cypress-sessions/index.ts#L109-168](https://github.com/cypress-io/cypress/blob/7d987f04740f8f5388ac3116e8ef7957373ead14/cli/lib/cypress-sessions/index.ts#L109-L168) [cli/lib/tap/tap-connection.ts#L92-148](https://github.com/cypress-io/cypress/blob/7d987f04740f8f5388ac3116e8ef7957373ead14/cli/lib/tap/tap-connection.ts#L92-L148) [cli/lib/cypress-sessions/store.ts#L47-82](https://github.com/cypress-io/cypress/blob/7d987f04740f8f5388ac3116e8ef7957373ead14/cli/lib/cypress-sessions/store.ts#L47-L82) [cli/lib/cypress-sessions/store.ts#L100-118](https://github.com/cypress-io/cypress/blob/7d987f04740f8f5388ac3116e8ef7957373ead14/cli/lib/cypress-sessions/store.ts#L100-L118) [cli/lib/cypress-sessions/liveness.ts#L26-77](https://github.com/cypress-io/cypress/blob/7d987f04740f8f5388ac3116e8ef7957373ead14/cli/lib/cypress-sessions/liveness.ts#L26-L77)
- Interactive startup: modes factory starts initializeMode() → interactive.run() concurrently awaits app.whenReady() and makeGraphQLServer() → ready() loads saved state and opens the desktop window → optional 'Cypress is ready' sentinel lets detached CLI spawning destroy streams, unref the child, and resolve. — [packages/server/lib/modes/index.ts#L26-45](https://github.com/cypress-io/cypress/blob/7d987f04740f8f5388ac3116e8ef7957373ead14/packages/server/lib/modes/index.ts#L26-L45) [packages/server/lib/modes/interactive.ts#L138-159](https://github.com/cypress-io/cypress/blob/7d987f04740f8f5388ac3116e8ef7957373ead14/packages/server/lib/modes/interactive.ts#L138-L159) [packages/server/lib/modes/interactive.ts#L162-204](https://github.com/cypress-io/cypress/blob/7d987f04740f8f5388ac3116e8ef7957373ead14/packages/server/lib/modes/interactive.ts#L162-L204) [cli/lib/exec/spawn.ts#L208-224](https://github.com/cypress-io/cypress/blob/7d987f04740f8f5388ac3116e8ef7957373ead14/cli/lib/exec/spawn.ts#L208-L224)

Every claim links to its cited files at the pinned commit. Citations identify source evidence; they do not establish runtime correctness. Independent CodeVetter scan — not reviewed by upstream maintainers.

## Public product links

- [CodeVetter](https://codevetter.com/)
- [Download](https://codevetter.com/download)
- [Documentation](https://codevetter.com/docs/)
- [Source](https://github.com/Codevetter/codevetter)
