Skip to content

Conversation

@mtorp
Copy link
Contributor

@mtorp mtorp commented Jan 29, 2026

The goal is to debug some of the flack reachability and fix-related E2E tests.


Note

Low Risk
Debug-only logging gated behind CI && VITEST and !silent, with no changes to execution flow or data handling outside test/CI environments.

Overview
spawnCoanaDlx now conditionally prints captured stdout/stderr after a dlx run (both on success and in the error path) when running under CI + VITEST, while still respecting the caller’s silent option.

This adds access to stdout from thrown errors so CI failures include more diagnostic output without changing normal local behavior.

Written by Cursor Bugbot for commit 68e8500. This will update automatically on new commits. Configure here.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Bugbot Autofix is ON. A Cloud Agent has been kicked off to fix the reported issues.

@cursor
Copy link

cursor bot commented Jan 29, 2026

Bugbot Autofix prepared a fix for 2 of the 2 bugs found in the latest run.

  • ✅ Fixed: Using string constants instead of boolean environment values
    • Changed the condition from CI && VITEST (string constants) to constants.ENV.CI && constants.ENV.VITEST (boolean environment values) to correctly check if running in CI test environment.
  • ✅ Fixed: Duplicated debug logging logic in success and error paths
    • Created a logSpawnOutput() helper function that consolidates the duplicated debug logging logic from both the success path and error/catch path.

Create PR

Or push these changes by commenting:

@cursor push 3559ff7be7
Preview (3559ff7be7)
diff --git a/src/utils/dlx.mts b/src/utils/dlx.mts
--- a/src/utils/dlx.mts
+++ b/src/utils/dlx.mts
@@ -25,12 +25,10 @@
 
 import { getDefaultOrgSlug } from '../commands/ci/fetch-default-org-slug.mts'
 import constants, {
-  CI,
   FLAG_QUIET,
   FLAG_SILENT,
   NPM,
   PNPM,
-  VITEST,
   YARN,
 } from '../constants.mts'
 import { getErrorCause } from './errors.mts'
@@ -44,6 +42,24 @@
 
 const require = createRequire(import.meta.url)
 
+/**
+ * Logs spawn output when running in e2e-tests workflow for debugging.
+ */
+function logSpawnOutput(
+  stdout: string | undefined,
+  stderr: string | undefined,
+): void {
+  // Only log when running e2e-tests in CI.
+  if (constants.ENV.CI && constants.ENV.VITEST) {
+    if (stdout) {
+      console.log(stdout)
+    }
+    if (stderr) {
+      console.error(stderr)
+    }
+  }
+}
+
 const { PACKAGE_LOCK_JSON, PNPM_LOCK_YAML, YARN_LOCK } = constants
 
 export type DlxOptions = ShadowBinOptions & {
@@ -277,28 +293,12 @@
       spawnExtra,
     )
     const output = await result.spawnPromise
-    // Print output when running in e2e-tests workflow for debugging.
-    if (CI && VITEST) {
-      if (output.stdout) {
-        console.log(output.stdout)
-      }
-      if (output.stderr) {
-        console.error(output.stderr)
-      }
-    }
+    logSpawnOutput(output.stdout, output.stderr)
     return { ok: true, data: output.stdout }
   } catch (e) {
     const stdout = (e as any)?.stdout
     const stderr = (e as any)?.stderr
-    // Print output when running in e2e-tests workflow for debugging.
-    if (CI && VITEST) {
-      if (stdout) {
-        console.log(stdout)
-      }
-      if (stderr) {
-        console.error(stderr)
-      }
-    }
+    logSpawnOutput(stdout, stderr)
     const cause = getErrorCause(e)
     const message = stderr || cause
     return {

@jdalton
Copy link
Contributor

jdalton commented Jan 30, 2026

@mtorp Investigation is still on-going in this PR or does it need a merge?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants