mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-26 00:01:37 +00:00
992ed01244
* fix: do not apply workspace display name on git-sync pull The workspace display name is stored in settings.yaml and was re-applied on every pull via changeWorkspaceName. Because settings.yaml is shared across the branches of a repo, a workspace could have its name overwritten by another workspace that syncs the same repo. Keep name in settings.yaml for reference (written on push) but stop applying it on pull. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * docs: consolidate workspace-name rationale to one comment (review nit) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * chore: bump git-sync hub scripts to windmill-cli 1.769.1 Repin GIT_SYNC_PULL_SCRIPT_PATH (28795->28808), LATEST_GIT_SYNC_SCRIPT_PATH (28796->28809) and frontend gitInitRepo to the hub scripts bundling windmill-cli@1.769.1, so backend automatic git pulls no longer apply the workspace display name (the CLI fix in this PR only reaches auto-pull via the pinned hub script bundle). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
74 lines
2.6 KiB
TypeScript
74 lines
2.6 KiB
TypeScript
/**
|
|
* Regression guard: a pull (pushWorkspaceSettings) must not apply the workspace
|
|
* display name from settings.yaml. Rationale lives at the apply site in settings.ts.
|
|
*/
|
|
|
|
import { expect, test, describe, beforeEach, mock } from "bun:test";
|
|
|
|
let changeWorkspaceNameCalls: unknown[] = [];
|
|
let editWebhookCalls: unknown[] = [];
|
|
let remoteName = "";
|
|
let remoteWebhook: string | undefined = undefined;
|
|
|
|
// Every wmill.* call reachable from pushWorkspaceSettings is stubbed so the
|
|
// function runs without a backend; only the two we assert on record calls.
|
|
mock.module("../gen/services.gen.ts", () => ({
|
|
getSettings: async (_a: { workspace: string }) => ({ webhook: remoteWebhook }),
|
|
getWorkspaceName: async (_a: { workspace: string }) => remoteName,
|
|
changeWorkspaceName: async (a: unknown) => {
|
|
changeWorkspaceNameCalls.push(a);
|
|
},
|
|
editWebhook: async (a: unknown) => {
|
|
editWebhookCalls.push(a);
|
|
},
|
|
editAutoInvite: async () => {},
|
|
editErrorHandler: async () => {},
|
|
editSuccessHandler: async () => {},
|
|
editDeployTo: async () => {},
|
|
editCopilotConfig: async () => {},
|
|
editLargeFileStorageConfig: async () => {},
|
|
editWorkspaceGitSyncConfig: async () => {},
|
|
editWorkspaceDefaultApp: async () => {},
|
|
editDefaultScripts: async () => {},
|
|
workspaceMuteCriticalAlertsUi: async () => {},
|
|
changeWorkspaceColor: async () => {},
|
|
updateOperatorSettings: async () => {},
|
|
editDataTableConfig: async () => {},
|
|
editSlackCommand: async () => {},
|
|
setWorkspaceSlackOauthConfig: async () => {},
|
|
deleteWorkspaceSlackOauthConfig: async () => {},
|
|
}));
|
|
|
|
const { pushWorkspaceSettings } = await import("../src/core/settings.ts");
|
|
|
|
describe("pushWorkspaceSettings workspace name", () => {
|
|
const ws = "phoenix";
|
|
|
|
beforeEach(() => {
|
|
changeWorkspaceNameCalls = [];
|
|
editWebhookCalls = [];
|
|
remoteName = "phoenix";
|
|
remoteWebhook = undefined;
|
|
});
|
|
|
|
test("a differing name in settings.yaml is not applied to the workspace", async () => {
|
|
// Another setting also differs so the function proceeds past its no-op early
|
|
// return; only that setting must be applied, never the name.
|
|
remoteWebhook = "https://old";
|
|
await pushWorkspaceSettings(ws, "settings", undefined, {
|
|
name: "phoenix-staging",
|
|
webhook: "https://new",
|
|
});
|
|
expect(editWebhookCalls.length).toBe(1);
|
|
expect(changeWorkspaceNameCalls.length).toBe(0);
|
|
});
|
|
|
|
test("a name-only difference is a complete no-op", async () => {
|
|
await pushWorkspaceSettings(ws, "settings", undefined, {
|
|
name: "phoenix-staging",
|
|
});
|
|
expect(editWebhookCalls.length).toBe(0);
|
|
expect(changeWorkspaceNameCalls.length).toBe(0);
|
|
});
|
|
});
|