import { describe, expect, it } from "vitest";
import { TREE_3000_ROUTE_BOUNDARY_MANIFEST } from "./tree-route-boundary";

describe("TREE_3000_ROUTE_BOUNDARY_MANIFEST", () => {
  it("固定 3000 route 的 Rust Web gateway owner 与 legacy compat 边界", () => {
    expect(TREE_3000_ROUTE_BOUNDARY_MANIFEST).toMatchObject({
      schema: "mnote.tree.3000_route_boundary",
      schemaVersion: 1,
      publicEntry: "3000",
    });

    expect(TREE_3000_ROUTE_BOUNDARY_MANIFEST.routes).toEqual(
      expect.arrayContaining([
        expect.objectContaining({
          id: "tree.commands",
          role: "rust-owned",
          route: "/api/tree/commands",
          owner: "rust-web-gateway",
        }),
        expect.objectContaining({
          id: "tree.stream",
          role: "rust-owned",
          route: "/api/tree/stream",
          owner: "rust-web-gateway",
        }),
        expect.objectContaining({
          id: "tree.shell.debug",
          role: "compat-pending",
          route: "/api/tree/shell",
          owner: "next-app-router-legacy",
        }),
      ]),
    );
    expect(TREE_3000_ROUTE_BOUNDARY_MANIFEST.rustOwnedSemantics).toContain("tree.subtree.move");
    expect(TREE_3000_ROUTE_BOUNDARY_MANIFEST.nextThinProxyDuties).toContain(
      "legacy route alias 与 header 透传",
    );
    expect(TREE_3000_ROUTE_BOUNDARY_MANIFEST.browserSubstrateDuties).toContain(
      "新页面 scaffold 文件创建",
    );
    expect(TREE_3000_ROUTE_BOUNDARY_MANIFEST.forbiddenNextSemantics).toContain("树排序 canonical plan");
    expect(TREE_3000_ROUTE_BOUNDARY_MANIFEST.forbiddenNextSemantics).toContain(
      "主 tree command transport owner",
    );
  });
});
