feat(persona): unify system and code channel routes
This commit is contained in:
parent
53564e0fdf
commit
e80ee6d966
29 changed files with 825 additions and 242 deletions
|
|
@ -20,10 +20,13 @@ test("canonical AI and persona entry files route to the domestic map", () => {
|
|||
assert.match(key, /禁止从本路径恢复.*\/exec/);
|
||||
});
|
||||
|
||||
test("code map resolves REPO-012 as current and keeps REPO-001 as domestic history", () => {
|
||||
test("code map resolves only REPO-012 and REPO-014 as current push routes", () => {
|
||||
const codeMap = read(".code-map");
|
||||
assert.match(codeMap, /^REPO-001=https:\/\/guanghulab\.com\/fifth-domain\/bingshuo\/fifth-domain\.git$/m);
|
||||
assert.match(codeMap, /^REPO-001=HISTORICAL_READ_ONLY_NO_PUSH$/m);
|
||||
assert.match(codeMap, /^REPO-001-HISTORICAL-URL=https:\/\/guanghulab\.com\/fifth-domain\/bingshuo\/fifth-domain\.git$/m);
|
||||
assert.match(codeMap, /^REPO-012=https:\/\/guanghulab\.com\/code\/bingshuo\/guanghu-ice-heart\.git$/m);
|
||||
assert.match(codeMap, /^REPO-014=https:\/\/guanghulab\.com\/code\/bingshuo\/hololake-system-architecture\.git$/m);
|
||||
assert.match(codeMap, /^CURRENT-PUSH-ALLOWLIST=REPO-012,REPO-014$/m);
|
||||
assert.match(codeMap, /^REPO-001-LEGACY-SG=/m);
|
||||
assert.match(codeMap, /^FD-REPO-MAP-001=routing\/repository-route-map\.json$/m);
|
||||
assert.match(codeMap, /^FD-WORLD-TREE-001=routing\/fifth-domain-world-tree\.json$/m);
|
||||
|
|
|
|||
|
|
@ -6,16 +6,16 @@ const {
|
|||
resolveSubjectId, search, searchAll,
|
||||
} = require("./server");
|
||||
|
||||
test("repository map has unique registered codes, preserves REPO-013 gap, and uses domestic routes", () => {
|
||||
test("repository map exposes only the two current code-channel repositories", () => {
|
||||
const map = loadMap();
|
||||
const expectedCodes = [
|
||||
...Array.from({ length: 12 }, (_, index) => `REPO-${String(index + 1).padStart(3, "0")}`),
|
||||
"REPO-014",
|
||||
];
|
||||
const expectedCodes = ["REPO-012", "REPO-014"];
|
||||
assert.deepEqual(map.repositories.map(item => item.code), expectedCodes);
|
||||
assert.equal(new Set(map.repositories.map(item => item.code)).size, expectedCodes.length);
|
||||
assert.ok(!map.repositories.some(item => item.code === "REPO-013"));
|
||||
for (const item of map.repositories) assert.match(item.primary.url, /^https:\/\/guanghulab\.com\/(?:fifth-domain|code)\//);
|
||||
for (const item of map.repositories) {
|
||||
assert.match(item.primary.url, /^https:\/\/guanghulab\.com\/code\//);
|
||||
}
|
||||
assert.equal(map.historical_repositories.length, 11);
|
||||
assert.ok(map.historical_repositories.every(item => item.state.includes("HISTORICAL")));
|
||||
});
|
||||
|
||||
test("Chinese language-world query resolves the Fifth Domain primary", () => {
|
||||
|
|
@ -24,15 +24,14 @@ test("Chinese language-world query resolves the Fifth Domain primary", () => {
|
|||
assert.equal(results[0].state, "CURRENT_FIFTH_DOMAIN_ENTRY");
|
||||
});
|
||||
|
||||
test("Chenglu persistent agent query resolves its independent repository", () => {
|
||||
test("Chenglu legacy identity does not resolve as a current repository", () => {
|
||||
const results = search(loadMap(), "澄路 常驻人格体 湖心频道");
|
||||
assert.equal(results[0].code, "REPO-009");
|
||||
assert.equal(results[0].slug, "chenglu-agent");
|
||||
assert.equal(results.length, 0);
|
||||
});
|
||||
|
||||
test("Kezhou and Guideng resolve to their independent resident repositories", () => {
|
||||
assert.equal(search(loadMap(), "刻舟 湖心频道")[0].code, "REPO-010");
|
||||
assert.equal(search(loadMap(), "归灯 每日心跳")[0].code, "REPO-011");
|
||||
test("Kezhou and Guideng legacy identities do not resolve as current repositories", () => {
|
||||
assert.equal(search(loadMap(), "刻舟 湖心频道").length, 0);
|
||||
assert.equal(search(loadMap(), "归灯 每日心跳").length, 0);
|
||||
});
|
||||
|
||||
test("server node map binds Zhuyuan routes to the domestic primary", () => {
|
||||
|
|
@ -86,9 +85,12 @@ test("public endpoints are read-only and expose CORS", async () => {
|
|||
const base = `http://127.0.0.1:${server.address().port}`;
|
||||
try {
|
||||
const response = await fetch(`${base}/v1/resolve?id=REPO-004`);
|
||||
assert.equal(response.status, 200);
|
||||
assert.equal(response.status, 404);
|
||||
assert.equal(response.headers.get("access-control-allow-origin"), "*");
|
||||
assert.equal((await response.json()).slug, "guanghu");
|
||||
assert.equal((await response.json()).error, "route_not_found");
|
||||
const currentRepository = await fetch(`${base}/v1/resolve?id=REPO-014`);
|
||||
assert.equal(currentRepository.status, 200);
|
||||
assert.equal((await currentRepository.json()).slug, "hololake-system-architecture");
|
||||
const nodeResponse = await fetch(`${base}/v1/resolve?id=JD-FD-PRIMARY`);
|
||||
assert.equal(nodeResponse.status, 200);
|
||||
assert.equal((await nodeResponse.json()).node_id, "JD-FD-PRIMARY");
|
||||
|
|
|
|||
Loading…
Reference in a new issue