Gateway: deep-compare array config paths for reload diff

This commit is contained in:
Vignesh Natarajan
2026-02-21 19:17:46 -08:00
parent 2830dafbe9
commit f2d664e24f
3 changed files with 47 additions and 1 deletions

View File

@@ -23,6 +23,48 @@ describe("diffConfigPaths", () => {
const paths = diffConfigPaths(prev, next);
expect(paths).toContain("messages.groupChat.mentionPatterns");
});
it("does not report unchanged arrays of objects as changed", () => {
const prev = {
memory: {
qmd: {
paths: [{ path: "~/docs", pattern: "**/*.md", name: "docs" }],
scope: {
rules: [{ when: { channel: "slack" }, include: ["docs"] }],
},
},
},
};
const next = {
memory: {
qmd: {
paths: [{ path: "~/docs", pattern: "**/*.md", name: "docs" }],
scope: {
rules: [{ when: { channel: "slack" }, include: ["docs"] }],
},
},
},
};
expect(diffConfigPaths(prev, next)).toEqual([]);
});
it("reports changed arrays of objects", () => {
const prev = {
memory: {
qmd: {
paths: [{ path: "~/docs", pattern: "**/*.md", name: "docs" }],
},
},
};
const next = {
memory: {
qmd: {
paths: [{ path: "~/docs", pattern: "**/*.txt", name: "docs" }],
},
},
};
expect(diffConfigPaths(prev, next)).toContain("memory.qmd.paths");
});
});
describe("buildGatewayReloadPlan", () => {