fix(council-archive): simplify finalize output and archive reads
This commit is contained in:
@@ -27,10 +27,10 @@ const toolContext = {
|
||||
}
|
||||
|
||||
describe("createCouncilRead", () => {
|
||||
describe("#given an archive file with complete COUNCIL_MEMBER_RESPONSE tags", () => {
|
||||
it("#then returns has_response true, response_complete true, and the content", async () => {
|
||||
describe("#given an archive file with clean extracted content", () => {
|
||||
it("#then returns has_response true, response_complete true, and raw file content", async () => {
|
||||
const archivePath = join(sisyphusDir, "member-1.txt")
|
||||
await writeFile(archivePath, "Some preamble\n<COUNCIL_MEMBER_RESPONSE>Full analysis here</COUNCIL_MEMBER_RESPONSE>")
|
||||
await writeFile(archivePath, "Full analysis here")
|
||||
|
||||
const tool = createCouncilRead(tempDir)
|
||||
const relativePath = `.sisyphus/member-1.txt`
|
||||
@@ -44,10 +44,10 @@ describe("createCouncilRead", () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe("#given an archive file with incomplete COUNCIL_MEMBER_RESPONSE tags", () => {
|
||||
it("#then returns has_response true, response_complete false", async () => {
|
||||
describe("#given an archive file containing tag-like text", () => {
|
||||
it("#then returns raw content without re-parsing tags", async () => {
|
||||
const archivePath = join(sisyphusDir, "member-2.txt")
|
||||
await writeFile(archivePath, "<COUNCIL_MEMBER_RESPONSE>Partial analysis still writing...")
|
||||
await writeFile(archivePath, "<COUNCIL_MEMBER_RESPONSE>do not parse this</COUNCIL_MEMBER_RESPONSE>")
|
||||
|
||||
const tool = createCouncilRead(tempDir)
|
||||
const relativePath = `.sisyphus/member-2.txt`
|
||||
@@ -56,14 +56,15 @@ describe("createCouncilRead", () => {
|
||||
const parsed = JSON.parse(result)
|
||||
|
||||
expect(parsed.has_response).toBe(true)
|
||||
expect(parsed.response_complete).toBe(false)
|
||||
expect(parsed.response_complete).toBe(true)
|
||||
expect(parsed.result).toBe("<COUNCIL_MEMBER_RESPONSE>do not parse this</COUNCIL_MEMBER_RESPONSE>")
|
||||
})
|
||||
})
|
||||
|
||||
describe("#given an archive file with no COUNCIL_MEMBER_RESPONSE tags", () => {
|
||||
it("#then returns has_response false", async () => {
|
||||
describe("#given an archive file with empty content", () => {
|
||||
it("#then returns empty result content", async () => {
|
||||
const archivePath = join(sisyphusDir, "member-3.txt")
|
||||
await writeFile(archivePath, "Just some plain text without any tags.")
|
||||
await writeFile(archivePath, "")
|
||||
|
||||
const tool = createCouncilRead(tempDir)
|
||||
const relativePath = `.sisyphus/member-3.txt`
|
||||
@@ -71,7 +72,9 @@ describe("createCouncilRead", () => {
|
||||
const result = await tool.execute({ file_path: relativePath }, toolContext)
|
||||
const parsed = JSON.parse(result)
|
||||
|
||||
expect(parsed.has_response).toBe(false)
|
||||
expect(parsed.has_response).toBe(true)
|
||||
expect(parsed.response_complete).toBe(true)
|
||||
expect(parsed.result).toBe("")
|
||||
})
|
||||
})
|
||||
|
||||
@@ -108,4 +111,19 @@ describe("createCouncilRead", () => {
|
||||
expect(parsed.error).toBe("Access denied: path must be within .sisyphus/")
|
||||
})
|
||||
})
|
||||
|
||||
describe("#given a Windows-style path under .sisyphus", () => {
|
||||
it("#then normalizes separators and reads the file successfully", async () => {
|
||||
const archivePath = join(sisyphusDir, "windows-path.txt")
|
||||
await writeFile(archivePath, "Windows path response")
|
||||
|
||||
const tool = createCouncilRead(tempDir)
|
||||
const result = await tool.execute({ file_path: ".sisyphus\\windows-path.txt" }, toolContext)
|
||||
const parsed = JSON.parse(result)
|
||||
|
||||
expect(parsed.has_response).toBe(true)
|
||||
expect(parsed.response_complete).toBe(true)
|
||||
expect(parsed.result).toBe("Windows path response")
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user