Initial import of streamline
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
import { test, expect, describe } from "bun:test";
|
||||
import { readFileSync } from "node:fs";
|
||||
import path from "node:path";
|
||||
import { isEvaluatorLane, evaluatorNotifyTargets } from "../src/evaluator_lane";
|
||||
|
||||
const REPO = path.resolve(import.meta.dir, "../..");
|
||||
const notify = readFileSync(path.join(REPO, "control-server/src/notify.ts"), "utf8");
|
||||
const routes = readFileSync(path.join(REPO, "control-server/src/routes.ts"), "utf8");
|
||||
const importer = readFileSync(path.join(REPO, "control-server/src/importer.ts"), "utf8");
|
||||
|
||||
describe("isEvaluatorLane", () => {
|
||||
test("matches cluster evaluator and any evaluator-* name", () => {
|
||||
expect(isEvaluatorLane({ clusters: ["evaluator"] })).toBe(true);
|
||||
expect(isEvaluatorLane({ clusters: ["evaluator-android"] })).toBe(true);
|
||||
expect(isEvaluatorLane({ clusters: ["default", "evaluator-ios"] })).toBe(true);
|
||||
expect(isEvaluatorLane({ clusters: ["evaluators"] })).toBe(false);
|
||||
expect(isEvaluatorLane({ clusters: ["default"] })).toBe(false);
|
||||
expect(isEvaluatorLane({ clusters: [] })).toBe(false);
|
||||
expect(isEvaluatorLane({})).toBe(false);
|
||||
});
|
||||
|
||||
test("hardcoded notify target (non-bug kinds) is jiaopengwen only", () => {
|
||||
expect(evaluatorNotifyTargets()).toEqual(["jiaopengwen@bytedance.com"]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("wired into notify + auto-MR + import", () => {
|
||||
test("status-card fans respect the lane", () => {
|
||||
// Bugs: the task's own watchers, shared group withheld for the lane.
|
||||
expect(notify).toContain("finalizeWatchers(task.watchers || [], !isEvaluatorLane(task))");
|
||||
expect(notify).toContain("isEvaluatorLane(feature)");
|
||||
expect(notify).toContain("isEvaluatorLane(security)");
|
||||
expect(notify).toContain("evaluatorNotifyTargets()");
|
||||
});
|
||||
|
||||
test("auto MR on first manual_review is NOT gated on the lane", () => {
|
||||
expect(routes).not.toMatch(/status === "manual_review" && prev\.status !== "manual_review"\s*&& !isEvaluatorLane/);
|
||||
});
|
||||
|
||||
test("import: ordinary ids + watchers, shared group withheld, cluster kept", () => {
|
||||
// Since 2026-09-23 eval-lane bugs get a random id and the normal watcher
|
||||
// set (creator + Meego assignee + extra groups); only the shared group is skipped.
|
||||
expect(importer).not.toContain("evaluatorTaskId");
|
||||
expect(importer).not.toContain("evaluatorNotifyTargets");
|
||||
expect(importer).toContain("const id = randomUUID();");
|
||||
expect(importer).toContain("!evalLane,");
|
||||
// 2026-10-15: the Messaging → im-sg override is gone, so the lane no longer
|
||||
// needs an exemption — every importer path stores the caller's cluster as-is.
|
||||
expect(importer).not.toContain("routeClusters");
|
||||
expect(importer).toContain("clusters: creator.clusters,");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user