Channels: move single-account config into accounts.default (#27334)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 50b5771808
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
This commit is contained in:
Gustavo Madeira Santana
2026-02-26 04:06:03 -05:00
committed by GitHub
parent da6a96ed33
commit dfa0b5b4fc
15 changed files with 639 additions and 7 deletions

View File

@@ -164,10 +164,12 @@ describe("normalizeLegacyConfigValues", () => {
expect(res.config.channels?.discord?.streamMode).toBeUndefined();
expect(res.config.channels?.discord?.accounts?.work?.streaming).toBe("off");
expect(res.config.channels?.discord?.accounts?.work?.streamMode).toBeUndefined();
expect(res.changes).toEqual([
expect(res.changes).toContain(
"Normalized channels.discord.streaming boolean → enum (partial).",
);
expect(res.changes).toContain(
"Normalized channels.discord.accounts.work.streaming boolean → enum (off).",
]);
);
});
it("migrates Discord legacy streamMode into streaming enum", () => {
@@ -223,6 +225,44 @@ describe("normalizeLegacyConfigValues", () => {
]);
});
it("moves missing default account from single-account top-level config when named accounts already exist", () => {
const res = normalizeLegacyConfigValues({
channels: {
telegram: {
enabled: true,
botToken: "legacy-token",
dmPolicy: "allowlist",
allowFrom: ["123"],
groupPolicy: "allowlist",
streaming: "partial",
accounts: {
alerts: {
enabled: true,
botToken: "alerts-token",
},
},
},
},
});
expect(res.config.channels?.telegram?.accounts?.default).toEqual({
botToken: "legacy-token",
dmPolicy: "allowlist",
allowFrom: ["123"],
groupPolicy: "allowlist",
streaming: "partial",
});
expect(res.config.channels?.telegram?.botToken).toBeUndefined();
expect(res.config.channels?.telegram?.dmPolicy).toBeUndefined();
expect(res.config.channels?.telegram?.allowFrom).toBeUndefined();
expect(res.config.channels?.telegram?.groupPolicy).toBeUndefined();
expect(res.config.channels?.telegram?.streaming).toBeUndefined();
expect(res.config.channels?.telegram?.accounts?.alerts?.botToken).toBe("alerts-token");
expect(res.changes).toContain(
"Moved channels.telegram single-account top-level values into channels.telegram.accounts.default.",
);
});
it("migrates browser ssrfPolicy allowPrivateNetwork to dangerouslyAllowPrivateNetwork", () => {
const res = normalizeLegacyConfigValues({
browser: {