refactor: remove seeded boss console conversation

This commit is contained in:
kris
2026-04-04 10:06:57 +08:00
parent 4e78fb0a34
commit 99acf26b1b
9 changed files with 247 additions and 308 deletions

View File

@@ -44,6 +44,39 @@ test.beforeEach(async () => {
await writeState(structuredClone(baseState));
});
function buildSingleThreadProject(projectId: string) {
return {
id: projectId,
name: "测试线程",
pinned: false,
systemPinned: false,
deviceIds: ["mac-studio"],
preview: "测试线程等待继续处理。",
updatedAt: "2026-04-04T11:30:00+08:00",
lastMessageAt: "2026-04-04T11:30:00+08:00",
isGroup: false,
threadMeta: {
projectId,
threadId: "thread-preflight",
threadDisplayName: "测试线程",
folderName: "测试项目",
activityIconCount: 0,
updatedAt: "2026-04-04T11:30:00+08:00",
codexThreadRef: "thread-preflight",
codexFolderRef: "preflight-project",
},
groupMembers: [],
createdByAgent: true,
collaborationMode: "development" as const,
approvalState: "not_required" as const,
unreadCount: 0,
riskLevel: "low" as const,
messages: [],
goals: [],
versions: [],
};
}
async function createAuthedRequest(projectId: string, body: { body: string }) {
const session = await createAuthSession({
account: "17600003315",
@@ -65,14 +98,17 @@ async function createAuthedRequest(projectId: string, body: { body: string }) {
test("single-thread message rejects projects without a real codex thread binding", async () => {
await setup();
const state = await readState();
const singleProject = state.projects.find(
(project) => project.id !== "master-agent" && !project.isGroup,
);
assert.ok(singleProject, "expected a seeded single-thread project");
const singleProject = buildSingleThreadProject("preflight-thread");
await writeState({
...state,
projects: state.projects.map((project) =>
projects: state.projects.concat(singleProject),
});
const nextState = await readState();
await writeState({
...nextState,
projects: nextState.projects.map((project) =>
project.id === singleProject.id
? {
...project,
@@ -96,8 +132,8 @@ test("single-thread message rejects projects without a real codex thread binding
assert.equal(payload.code, "THREAD_BINDING_REQUIRED");
assert.equal(payload.message, "当前线程还没有绑定真实 Codex 线程,请先重新导入该线程后再试。");
const nextState = await readState();
const queuedTask = nextState.masterAgentTasks.find(
const finalState = await readState();
const queuedTask = finalState.masterAgentTasks.find(
(task) => task.projectId === singleProject.id && task.taskType === "conversation_reply",
);
assert.equal(queuedTask, undefined);