Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
test(cli): pin the three uninstall file lists together against drift
jkomyno committed
Aug 3, 2026 at 20:27 UTC
c41217bff2b66d7101eebef3e84dc89f9f2ea5c0
1 file changed
+76
-15
test/release-workflow.test.ts
+76
-15
@@ -56,6 +56,7 @@ const installHealthCheck = readFileSync(
56
new URL('../.github/workflows/cli.install-health-check.yml', import.meta.url),
57
'utf8'
58
);
59
+const cliDocsGuide = readFileSync(new URL('../docs/content/docs/cli.mdx', import.meta.url), 'utf8');
60
const resolveTargetScriptUrl = new URL(
61
'../.github/scripts/cli-release/resolve-release-target.sh',
62
import.meta.url
@@ -95,7 +96,10 @@ function readSdkVersions(rows) {
96
/\bv?(\d+(?:\.\d+)+(?:[._-]?(?:a|b|c|rc|alpha|beta|pre|preview)\d*)?(?:[._-]?(?:post|rev|r)\d*)?(?:[._-]?dev\d*)?(?:\+[a-z0-9]+(?:[._-][a-z0-9]+)*)?)\b/gi;
97
98
for (const row of rows) {
98
- const cells = row.split('|').map(cell => cell.trim()).filter(Boolean);
99
+ const cells = row
100
+ .split('|')
101
+ .map(cell => cell.trim())
102
+ .filter(Boolean);
103
const releaseVersionCell = cells[cells.length - 1];
104
if (!releaseVersionCell) continue;
105
@@ -229,12 +233,8 @@ touch "$target/dist/provider.whl"
233
234
{
235
const directVersion = readSdkVersions(['| Python `composio` | `9.9.9` |']);
232
- const versionWithPrevious = readSdkVersions([
233
- '| Python `composio` | v9.9.8 | **v9.9.9** |',
234
- ]);
235
- const previousVersionOnly = readSdkVersions([
236
- '| Python `composio` | v9.9.9 | **v9.9.10** |',
237
- ]);
236
+ const versionWithPrevious = readSdkVersions(['| Python `composio` | v9.9.8 | **v9.9.9** |']);
237
+ const previousVersionOnly = readSdkVersions(['| Python `composio` | v9.9.9 | **v9.9.10** |']);
238
const pep440Versions = readSdkVersions([
239
'| Python `composio` | `9.9.9rc1` |',
240
'| Python `composio` | `9.9.9.post1` |',
@@ -245,11 +245,15 @@ touch "$target/dist/provider.whl"
245
throw new Error('Python SDK changelog version rows must recognize the released version');
246
}
247
if (previousVersionOnly.has('9.9.9')) {
248
- throw new Error('Python SDK changelog version rows must not treat the previous version as released');
248
+ throw new Error(
249
+ 'Python SDK changelog version rows must not treat the previous version as released'
250
+ );
251
}
252
for (const version of ['9.9.9rc1', '9.9.9.post1', '9.9.9.dev1']) {
253
if (!pep440Versions.has(version)) {
252
- throw new Error(`Python SDK changelog version rows must recognize PEP 440 version ${version}`);
254
+ throw new Error(
255
+ `Python SDK changelog version rows must recognize PEP 440 version ${version}`
256
+ );
257
}
258
}
259
}
@@ -499,9 +503,11 @@ if (publishIdx === -1) {
503
'build-cli-binaries.yml must publish by flipping the draft (gh release edit --draft=false)'
504
);
505
}
502
-if (
503
- !(helperCheckoutIdx < draftStepIdx && draftStepIdx < verifyStepIdx && verifyStepIdx < publishIdx)
504
-) {
506
+if (!(
507
+ helperCheckoutIdx < draftStepIdx &&
508
+ draftStepIdx < verifyStepIdx &&
509
+ verifyStepIdx < publishIdx
510
+)) {
511
throw new Error(
512
'build-cli-binaries.yml must order steps helper checkout → draft → verify → publish'
513
);
@@ -620,9 +626,7 @@ for (const guide of manualInstallGuides) {
626
throw new Error(`${guide.label} must create the CLI entry-point directory`);
627
}
628
if (
623
- !guide.source.includes(
624
- 'ln -sf "$COMPOSIO_INSTALL_DIR/composio" "$COMPOSIO_BIN_DIR/composio"'
625
- )
629
+ !guide.source.includes('ln -sf "$COMPOSIO_INSTALL_DIR/composio" "$COMPOSIO_BIN_DIR/composio"')
630
) {
631
throw new Error(`${guide.label} must link the CLI entry point to the release bundle`);
632
}
@@ -717,6 +721,63 @@ if (installHealthCheck.includes('rm -rf "$HOME/.composio"')) {
721
throw new Error('cli.install-health-check.yml must preserve CLI user state between install legs');
722
}
723
724
+// --- uninstall file lists: the hand-maintained copies must stay in sync ---
725
+
726
+// The uninstall file list mirrors the release bundle layout and is duplicated in INSTALL.md,
727
+// docs/content/docs/cli.mdx, and cli.install-health-check.yml. Drift between them ships
728
+// uninstall guidance (or a health-check reset) that leaves release artifacts behind.
729
+function readUninstallEntries(source, command, label) {
730
+ const block = requireMatch(
731
+ source,
732
+ new RegExp(`${command} \\\\\\n((?:[ \\t]*"[^"]+"(?: \\\\)?\\n)+)`),
733
+ `${label} ${command} uninstall block`
734
+ );
735
+ return [...block.matchAll(/"([^"]+)"/g)].map(entry =>
736
+ entry[1]
737
+ .replace(/^\$install_dir\//, '')
738
+ .replace(/^\$bin_dir\//, '')
739
+ .replace(/^\$HOME\/\.composio\//, '')
740
+ .replace(/^\$HOME\/\.local\/bin\//, '')
741
+ );
742
+}
743
+
744
+const uninstallGuides = [
745
+ { label: 'INSTALL.md', source: installGuide },
746
+ { label: 'docs/content/docs/cli.mdx', source: cliDocsGuide },
747
+ { label: 'cli.install-health-check.yml', source: installHealthCheck },
748
+].map(({ label, source }) => ({
749
+ label,
750
+ files: readUninstallEntries(source, 'rm -f', label),
751
+ directories: readUninstallEntries(source, 'rm -rf', label),
752
+}));
753
+
754
+const [canonicalUninstall, ...mirroredUninstallGuides] = uninstallGuides;
755
+
756
+// Guard the parser itself: a mis-anchored match must not pass vacuously.
757
+if (
758
+ !canonicalUninstall.files.includes('run-helpers-runtime.mjs') ||
759
+ !canonicalUninstall.directories.includes('services')
760
+) {
761
+ throw new Error('INSTALL.md uninstall list must cover the release bundle layout');
762
+}
763
+
764
+for (const guide of mirroredUninstallGuides) {
765
+ if (JSON.stringify(guide.files) !== JSON.stringify(canonicalUninstall.files)) {
766
+ throw new Error(
767
+ `${guide.label} uninstall file list drifted from INSTALL.md:\n` +
768
+ ` ${guide.label}: ${JSON.stringify(guide.files)}\n` +
769
+ ` INSTALL.md: ${JSON.stringify(canonicalUninstall.files)}`
770
+ );
771
+ }
772
+ if (JSON.stringify(guide.directories) !== JSON.stringify(canonicalUninstall.directories)) {
773
+ throw new Error(
774
+ `${guide.label} uninstall directory list drifted from INSTALL.md:\n` +
775
+ ` ${guide.label}: ${JSON.stringify(guide.directories)}\n` +
776
+ ` INSTALL.md: ${JSON.stringify(canonicalUninstall.directories)}`
777
+ );
778
+ }
779
+}
780
+
781
const fakeBin = mkdtempSync(join(tmpdir(), 'composio-release-test-'));
782
try {
783
const fakePnpmPath = join(fakeBin, 'pnpm');