From 1fa0bc871192f41192d3b4c5573c8929553aaa84 Mon Sep 17 00:00:00 2001 From: HiranoMasaaki Date: Mon, 23 Feb 2026 16:17:02 +0000 Subject: [PATCH] fix: remove smol-toml dependency from create-expert E2E test Replace TOML parsing with simple string matching to avoid importing smol-toml (transitive dep not resolvable from e2e/ directory) or workspace packages (@perstack/perstack-toml) that bun test can't resolve outside the workspace. Co-Authored-By: Claude Opus 4.6 --- e2e/create-expert/create-expert.test.ts | 27 +++++++++++-------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/e2e/create-expert/create-expert.test.ts b/e2e/create-expert/create-expert.test.ts index 5b0dfbcf..0919b761 100644 --- a/e2e/create-expert/create-expert.test.ts +++ b/e2e/create-expert/create-expert.test.ts @@ -14,7 +14,6 @@ import { spawn } from "node:child_process" import fs from "node:fs" import os from "node:os" import path from "node:path" -import { parsePerstackConfig } from "@perstack/perstack-toml" import { assertEventSequenceContains } from "../lib/assertions.js" import { extractToolCalls, filterEventsByType } from "../lib/event-parser.js" import { injectProviderArgs } from "../lib/round-robin.js" @@ -123,14 +122,13 @@ describe("create-expert", () => { expect(toolNames).toContain("writeTextFile") expect(toolNames).toContain("addDelegateFromConfig") - // Verify perstack.toml was created with valid expert definitions + // Verify perstack.toml was created with at least one expert definition const tomlPath = path.join(tempDir, "perstack.toml") expect(fs.existsSync(tomlPath)).toBe(true) - const parsed = parsePerstackConfig(fs.readFileSync(tomlPath, "utf-8")) - expect(parsed.experts).toBeDefined() - expect(Object.keys(parsed.experts as Record).length).toBeGreaterThanOrEqual( - 1, - ) + const tomlContent = fs.readFileSync(tomlPath, "utf-8") + const expertMatches = tomlContent.match(/\[experts\."[^"]+"\]/g) + expect(expertMatches).not.toBeNull() + expect(expertMatches!.length).toBeGreaterThanOrEqual(1) }, LLM_TIMEOUT, ) @@ -174,16 +172,15 @@ pick = ["attemptCompletion"] expect(toolNames).toContain("writeTextFile") expect(toolNames).toContain("addDelegateFromConfig") - // Verify perstack.toml was updated + // Verify perstack.toml was updated with existing + new experts const tomlPath = path.join(tempDir, "perstack.toml") - const parsed = parsePerstackConfig(fs.readFileSync(tomlPath, "utf-8")) - expect(parsed.experts).toBeDefined() - - const experts = parsed.experts as Record + const tomlContent = fs.readFileSync(tomlPath, "utf-8") // Original expert should be preserved - expect(experts["existing-expert"]).toBeDefined() - // New expert should be added - expect(Object.keys(experts).length).toBeGreaterThanOrEqual(2) + expect(tomlContent).toContain('[experts."existing-expert"]') + // New expert should be added (at least 2 expert sections) + const expertMatches = tomlContent.match(/\[experts\."[^"]+"\]/g) + expect(expertMatches).not.toBeNull() + expect(expertMatches!.length).toBeGreaterThanOrEqual(2) }, LLM_TIMEOUT, )