@sleep2agi/commhub-server 0.9.0-preview.227 → 0.9.0-preview.228
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/health-redaction.test.ts +13 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sleep2agi/commhub-server",
|
|
3
|
-
"version": "0.9.0-preview.
|
|
3
|
+
"version": "0.9.0-preview.228",
|
|
4
4
|
"description": "CommHub Server — AI Agent communication hub with MCP protocol, multi-network isolation, user auth, and MCP tools (17 collaboration-core + node/provider ops tools; authoritative list: docs-site/docs/api/mcp-tools.md).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.ts",
|
|
@@ -1135,6 +1135,19 @@ describe("#473 anonymous /health — watchdog contract intact, no topology leak"
|
|
|
1135
1135
|
}
|
|
1136
1136
|
});
|
|
1137
1137
|
|
|
1138
|
+
// 2026-10-31 —— **单一出口**(外部复核 (a):
|
|
1139
|
+
// 「一个必须在『所有字段写完之后』执行的变换,只有收敛到单一出口才可靠 —— 多出口 × 惰性 = 迟早漏」)。
|
|
1140
|
+
// 这条门只看一件事:`shape(...)` 在源码里只能出现在**一处**。
|
|
1141
|
+
// 出现第二处 ⇒ 说明又有一个 return 各自记得调它 ⇒ 下一个人加第三个出口时就会裸奔。
|
|
1142
|
+
test("the anonymous projection is applied at exactly one call site", async () => {
|
|
1143
|
+
const { readFileSync } = await import("node:fs");
|
|
1144
|
+
const src = readFileSync(new URL("./server.ts", import.meta.url), "utf8");
|
|
1145
|
+
const calls = [...src.matchAll(/Response\.json\(\s*shape\(/g)];
|
|
1146
|
+
expect(calls.length).toBe(1);
|
|
1147
|
+
// 定义处也算一处(`const shape = ...`),但它不是 Response.json 包裹,所以上面的正则不会数到
|
|
1148
|
+
expect((src.match(/const shape = /g) || []).length).toBe(1);
|
|
1149
|
+
});
|
|
1150
|
+
|
|
1138
1151
|
test("no dead entries: every allow-listed key is actually served to anonymous callers", async () => {
|
|
1139
1152
|
const { PUBLIC_HEALTH_KEYS } = await import("./server.js");
|
|
1140
1153
|
const plain = await (await fetch(`${BASE}/health`)).json() as any;
|