@devries-cameron20 / composio Mirror · read-only / commits / 2acf31d15
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

Mirrored from https://github.com/Camo67/composio.git

Synced Nov 22, 12:00 UTC

fix(ts/e2e): address cursorbot

jkomyno committed Feb 1, 2026 at 12:33 UTC 2acf31d1532d058e78f1dac97461a23525eebec1
4 files changed +22 -12
ts/e2e-tests/_utils/src/config.ts
+4 -1
@@ -160,13 +160,16 @@ export function resolveDenoVersionMetaList(
160 configDenoVersions?: readonly DenoVersionFromUser[]
161 ): NonEmptyArray<DenoVersionMeta> {
162 const envVersion = Bun.env.COMPOSIO_E2E_DENO_VERSION;
163 - const dvmrcVersion = getDvmrcVersion();
163
164 // Local mode with env override: single version, no skip
165 + // Check this BEFORE calling getDvmrcVersion() so env override works without .dvmrc
166 if (!isCI() && envVersion) {
167 return [{ kind: 'overridden', value: envVersion, skip: { value: false } }];
168 }
169
170 + // Only read .dvmrc after env override check (getDvmrcVersion throws if file missing)
171 + const dvmrcVersion = getDvmrcVersion();
172 +
173 // No config provided: use .dvmrc version
174 if (configDenoVersions === undefined || configDenoVersions.length === 0) {
175 return [{ kind: 'current', value: dvmrcVersion, skip: { value: false } }];
ts/e2e-tests/_utils/src/image-lifecycle.ts
+3 -3
@@ -444,10 +444,10 @@ export async function runDenoContainer(options: RunDenoContainerOptions): Promis
444 // Handle cmd as array for direct execution without shell interpretation.
445 if (Array.isArray(cmd)) {
446 dockerArgs.push(...cmd.map(String));
447 - // Handle cmd as string by wrapping in deno run with necessary permissions.
447 + // Handle cmd as string by wrapping in login shell for proper environment setup.
448 + // Callers must explicitly use 'deno run --allow-all <file>' when running Deno scripts.
449 } else if (typeof cmd === 'string' && cmd.length > 0) {
449 - // Use deno run with all permissions for e2e tests
450 - dockerArgs.push('sh', '-lc', `deno run --allow-all ${cmd}`);
450 + dockerArgs.push('sh', '-lc', cmd);
451 } else {
452 throw new Error('runDenoContainer({ cmd, ... }): cmd must be a non-empty string or string[]');
453 }
ts/e2e-tests/_utils/src/runner.ts
+7 -5
@@ -350,7 +350,7 @@ function createNodeDockerExecutors(
350
351 try {
352 await createVolume(volumeName);
353 - await initializeVolumeOwnership(volumeName, imageTag);
353 + await initializeVolumeOwnership(volumeName, imageTag, 'node');
354
355 const setupContainerName = `${containerBaseName}-setup`;
356 const setupStartTime = Date.now();
@@ -481,10 +481,12 @@ function createDenoDockerExecutors(
481 function runFixture(options: { filename: string; setup: string }): Promise<E2ETestResultWithSetup>;
482 async function runFixture(options: RunFixtureOptions): Promise<E2ETestResult | E2ETestResultWithSetup> {
483 const { filename, setup } = options;
484 + // Deno scripts need explicit 'deno run' with permissions
485 + const denoRunCmd = `deno run --allow-all ${filename}`;
486
487 // For Deno without setup, just run the file directly
488 if (!setup) {
487 - return runCmd(filename);
489 + return runCmd(denoRunCmd);
490 }
491
492 // Deno with setup: use Docker volumes for caching
@@ -495,7 +497,7 @@ function createDenoDockerExecutors(
497
498 try {
499 await createVolume(volumeName);
498 - await initializeVolumeOwnership(volumeName, imageTag);
500 + await initializeVolumeOwnership(volumeName, imageTag, 'deno');
501
502 const setupContainerName = `${containerBaseName}-setup`;
503 const setupStartTime = Date.now();
@@ -525,7 +527,7 @@ function createDenoDockerExecutors(
527 const fixtureStartTime = Date.now();
528 const fixtureResult = await runDenoContainer({
529 imageTag,
528 - cmd: filename,
530 + cmd: denoRunCmd,
531 cwd: effectiveCwd,
532 env: containerEnv,
533 name: fixtureContainerName,
@@ -537,7 +539,7 @@ function createDenoDockerExecutors(
539 phase: 'fixture',
540 phaseIndex: 2,
541 totalPhases: 2,
540 - command: filename,
542 + command: denoRunCmd,
543 containerName: fixtureContainerName,
544 durationMs: fixtureDurationMs,
545 exitCode: fixtureResult.exitCode,
ts/e2e-tests/_utils/src/volume.ts
+8 -3
@@ -49,18 +49,23 @@ export async function removeVolume(name: string): Promise<void> {
49 }
50
51 /**
52 - * Initializes a Docker volume with correct ownership for the node user (UID 1000).
52 + * Initializes a Docker volume with correct ownership for the container user.
53 * This is necessary because Docker volumes are created with root ownership by default.
54 *
55 * @param volumeName - Name of the volume to initialize
56 * @param imageTag - Docker image to use for the initialization container
57 + * @param runtime - Runtime type ('node' or 'deno') to determine the correct user/group
58 */
59 export async function initializeVolumeOwnership(
60 volumeName: string,
60 - imageTag: string
61 + imageTag: string,
62 + runtime: 'node' | 'deno'
63 ): Promise<void> {
64 + // Node images use node:node, Deno images use deno:deno
65 + const user = runtime === 'node' ? 'node:node' : 'deno:deno';
66 +
67 // Run a quick container as root to chown the volume contents
63 - const result = await $`docker run --rm --user root -v ${volumeName}:/mnt/vol ${imageTag} chown -R node:node /mnt/vol`.nothrow().quiet();
68 + const result = await $`docker run --rm --user root -v ${volumeName}:/mnt/vol ${imageTag} chown -R ${user} /mnt/vol`.nothrow().quiet();
69
70 if (result.exitCode !== 0) {
71 const err = new Error(`Failed to initialize volume ownership for: ${volumeName}`);