mirror of
https://github.com/CopilotKit/CopilotKit.git
synced 2026-09-14 16:26:20 +08:00
bee19e78df
Two release-tooling defects turned a pair of canary publishes into a broken combination for consumers (a canary runtime resolving the last STABLE channels-intelligence, which still called the removed `channel.addAdapter`). 1. Canary versions were prereleases of an ALREADY-PUBLISHED version. A stable release leaves the working tree on the version it just published, and computePrereleaseVersion appended `-canary.<id>` to exactly that, so the canary sorted BELOW its own release (`0.2.1-canary.x < 0.2.1`): the `canary` dist-tag pointed behind `latest`, and no dependent range could ever resolve it. Base the canary on the next unreleased version instead (patch bump, reusing computeNextStableVersion's prerelease rule). 2. A canary published one scope at a time, but the scopes are only independent on the version axis. `@copilotkit/runtime` carries `"@copilotkit/channels-intelligence": "workspace:*"`, and `pnpm pack` resolves that against the working tree — so a `monorepo` canary pinned the channels family to its last stable release even when the commit changed both sides of the contract. Add a prerelease-only `all` selector that bumps and publishes every scope from one commit under one shared canary id, and warn loudly when a single-scope canary leaves a cross-scope pin behind. `all` is a selector, never a scope: stable releases stay single-scope (their tag, release branch, and npm/Slack links all derive from one scope name), which publish-release.yml enforces in both jobs and the dropdown guard enforces per workflow.
59 lines
1.8 KiB
TypeScript
59 lines
1.8 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import {
|
|
ALL_SCOPES,
|
|
getScopeConfig,
|
|
loadConfig,
|
|
resolveScopes,
|
|
} from "./config.js";
|
|
import { getPackagesForScope } from "./versions.js";
|
|
|
|
const CHANNELS_PACKAGES = [
|
|
"@copilotkit/channels-ui",
|
|
"@copilotkit/channels-core",
|
|
"@copilotkit/channels-slack",
|
|
"@copilotkit/channels-teams",
|
|
"@copilotkit/channels-intelligence",
|
|
"@copilotkit/channels-discord",
|
|
"@copilotkit/channels-telegram",
|
|
"@copilotkit/channels-whatsapp",
|
|
"@copilotkit/channels",
|
|
];
|
|
|
|
describe("Channels release scope", () => {
|
|
it("publishes the complete Channels family from one shared scope", () => {
|
|
expect(getScopeConfig("channels")).toEqual({
|
|
packages: CHANNELS_PACKAGES,
|
|
versionSource: "@copilotkit/channels",
|
|
sharedVersion: true,
|
|
});
|
|
});
|
|
|
|
it("resolves Channels packages in configured publish order", () => {
|
|
expect(getPackagesForScope("channels").map((pkg) => pkg.name)).toEqual(
|
|
CHANNELS_PACKAGES,
|
|
);
|
|
});
|
|
});
|
|
|
|
describe("resolveScopes", () => {
|
|
it("resolves a single scope to itself", () => {
|
|
expect(resolveScopes("channels")).toEqual(["channels"]);
|
|
});
|
|
|
|
it("expands the all sentinel to every configured scope, in config order", () => {
|
|
expect(resolveScopes(ALL_SCOPES)).toEqual(Object.keys(loadConfig().scopes));
|
|
});
|
|
|
|
it("rejects an unknown scope and names the valid selectors", () => {
|
|
expect(() => resolveScopes("runtime")).toThrow(
|
|
/Unknown scope: runtime\. Valid scopes: .*channels, all/,
|
|
);
|
|
});
|
|
|
|
// "all" is a selector, never a scope: a scope named `all` in
|
|
// release.config.json would make the sentinel ambiguous.
|
|
it("keeps the sentinel out of the configured scope names", () => {
|
|
expect(Object.keys(loadConfig().scopes)).not.toContain(ALL_SCOPES);
|
|
});
|
|
});
|