@devries-cameron20 / composio-1 / commits / 7c5e22c3c
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.

fix(cli): unblock release checksum generation (#3990)

This PR: - fixes https://github.com/ComposioHQ/composio/actions/runs/30535159056/job/90850055191 by keeping checksum generation independent of unbuilt CLI runtime packages - extracts the shared Effect teardown into a dependency-light module while preserving existing script imports - adds an executable release regression that generates a checksum manifest from a clean fixture - verifies the fix with `pnpm test:release-workflow`, `pnpm build:packages`, CLI typecheck, the full CLI test suite, and `pnpm validate:changesets`

Alberto Schiabel committed Jul 30, 2026 at 18:15 UTC 7c5e22c3ce1cddfc4b4a795161be9e6b83361cfb
4 files changed +65 -15
test/release-workflow.test.ts
+46
@@ -66,6 +66,12 @@ const verifyAssetsScript = readFileSync(
66 new URL('../.github/scripts/cli-release/verify-assets.sh', import.meta.url),
67 'utf8'
68 );
69 +const generateChecksumsScriptUrl = new URL(
70 + '../ts/packages/cli/scripts/generate-checksums.ts',
71 + import.meta.url
72 +);
73 +const generateChecksumsScriptPath = generateChecksumsScriptUrl.pathname;
74 +const generateChecksumsScript = readFileSync(generateChecksumsScriptUrl, 'utf8');
75
76 function requireMatch(text, pattern, label) {
77 const match = text.match(pattern);
@@ -527,6 +533,46 @@ if (!(packageSkillsIdx < generateChecksumsIdx)) {
533 );
534 }
535
536 +if (
537 + !generateChecksumsScript.includes("from './_teardown'") ||
538 + generateChecksumsScript.includes("from './_shared'")
539 +) {
540 + throw new Error(
541 + 'CLI checksum generation must use the dependency-light teardown without loading CLI runtime helpers'
542 + );
543 +}
544 +
545 +// The release job runs checksum generation in a fresh checkout where workspace packages have not
546 +// been built. Exercise the script from an unrelated working directory to prevent imports from
547 +// pulling in the CLI runtime and its unbuilt @composio/core dependency.
548 +{
549 + const fixtureDir = mkdtempSync(join(tmpdir(), 'composio-cli-checksums-'));
550 + try {
551 + const binariesDir = join(fixtureDir, 'dist/binaries');
552 + mkdirSync(binariesDir, { recursive: true });
553 + writeFileSync(join(binariesDir, 'composio-linux-x64.zip'), 'release archive fixture\n');
554 +
555 + const result = spawnSync(process.execPath, [generateChecksumsScriptPath], {
556 + cwd: fixtureDir,
557 + encoding: 'utf8',
558 + env: process.env,
559 + });
560 +
561 + if (result.status !== 0) {
562 + throw new Error(
563 + `CLI checksum generation must run without built workspace packages\nstdout:\n${result.stdout}\nstderr:\n${result.stderr}`
564 + );
565 + }
566 +
567 + const checksums = readFileSync(join(binariesDir, 'checksums.txt'), 'utf8');
568 + if (!/^[a-f0-9]{64} composio-linux-x64\.zip\n$/.test(checksums)) {
569 + throw new Error(`CLI checksum generation wrote an invalid manifest:\n${checksums}`);
570 + }
571 + } finally {
572 + rmSync(fixtureDir, { recursive: true, force: true });
573 + }
574 +}
575 +
576 // Per-tag concurrency prevents two runs clobbering the same release without serializing betas.
577 if (!buildCliWorkflow.includes('group: cli-release-${{ needs.prepare.outputs.release_tag }}')) {
578 throw new Error(
ts/packages/cli/scripts/_shared.ts
+3 -14
@@ -2,11 +2,12 @@ import { builtinModules } from 'node:module';
2 import { chmod, copyFile, mkdir, readdir, rm, stat, writeFile } from 'node:fs/promises';
3 import * as path from 'node:path';
4 import process from 'node:process';
5 -import { Cause, Effect, Exit } from 'effect';
6 -import type { Teardown } from '@effect/platform/Runtime';
5 +import { Effect } from 'effect';
6 import { RUN_COMPANION_MODULE_BASENAMES } from '../src/services/run-companion-modules';
7 import { materializeAcpAdaptersCache } from './_acp-adapters';
8
9 +export { teardown } from './_teardown';
10 +
11 const RUN_COMPANION_SERVICE_ENTRY_MAP = Object.fromEntries(
12 RUN_COMPANION_MODULE_BASENAMES.map(name => [`services/${name}`, `src/services/${name}.ts`])
13 ) satisfies Record<string, string>;
@@ -295,18 +296,6 @@ const buildCompanionServiceBundles = async (outputDir: string): Promise<void> =>
296 }
297 };
298
298 -/**
299 - * Shared teardown for all CLI scripts.
300 - *
301 - * Exits with a non-zero code when the Effect program fails
302 - * (unless the failure is an interrupt-only cause).
303 - */
304 -export const teardown: Teardown = <E, A>(exit: Exit.Exit<E, A>, onExit: (code: number) => void) => {
305 - const shouldFail = Exit.isFailure(exit) && !Cause.isInterruptedOnly(exit.cause);
306 - const errorCode = Number(process.exitCode ?? 1);
307 - onExit(shouldFail ? errorCode : 0);
308 -};
309 -
299 export const buildCompanionModules = (outputDir: string) =>
300 Effect.gen(function* () {
301 yield* Effect.tryPromise(() => mkdir(outputDir, { recursive: true }));
ts/packages/cli/scripts/_teardown.ts new
+15
@@ -0,0 +1,15 @@
1 +import process from 'node:process';
2 +import { Cause, Exit } from 'effect';
3 +import type { Teardown } from '@effect/platform/Runtime';
4 +
5 +/**
6 + * Shared teardown for CLI scripts.
7 + *
8 + * Keep this module dependency-light so release-only scripts can use it without
9 + * loading the CLI runtime or requiring built workspace packages.
10 + */
11 +export const teardown: Teardown = <E, A>(exit: Exit.Exit<E, A>, onExit: (code: number) => void) => {
12 + const shouldFail = Exit.isFailure(exit) && !Cause.isInterruptedOnly(exit.cause);
13 + const errorCode = Number(process.exitCode ?? 1);
14 + onExit(shouldFail ? errorCode : 0);
15 +};
ts/packages/cli/scripts/generate-checksums.ts
+1 -1
@@ -17,7 +17,7 @@
17 import process from 'node:process';
18 import { Config, ConfigProvider, Console, Effect, Logger, Layer, LogLevel } from 'effect';
19 import { BunContext, BunRuntime } from '@effect/platform-bun';
20 -import { teardown } from './_shared';
20 +import { teardown } from './_teardown';
21 import { readdir, readFile, writeFile } from 'node:fs/promises';
22 import path from 'node:path';
23