f99010fae1
Desktop Artifacts / Desktop Build (Linux) (push) Waiting to run
Desktop Artifacts / Desktop Build (Windows) (push) Waiting to run
Desktop Artifacts / Desktop Build (Linux (arm64)) (push) Waiting to run
Desktop Artifacts (macOS) / Desktop Build (macOS (aarch64)) (push) Waiting to run
Desktop Artifacts (macOS) / Desktop Build (macOS (x86_64)) (push) Waiting to run
CI / lint (push) Failing after 1s
CI / frontend (push) Failing after 1s
CI / scripts (push) Failing after 1s
CI / Go Test (ubuntu-latest) (push) Failing after 0s
CI / frontend-node-25 (push) Failing after 1s
CI / docs (push) Failing after 0s
CI / coverage (push) Failing after 0s
CI / e2e (push) Failing after 0s
Docker / build-and-push (push) Failing after 1s
CI / integration (push) Failing after 4m43s
CI / Go Test (windows-latest) (push) Has been cancelled
CI / Desktop Unit Tests (Windows) (push) Has been cancelled
78 lines
2.0 KiB
Go
78 lines
2.0 KiB
Go
package parser
|
|
|
|
import (
|
|
"encoding/json"
|
|
"os"
|
|
"path/filepath"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
// TestKiroIDEFilePathNativeSet verifies that replace and create actions in
|
|
// a Kiro IDE execution log produce ParsedToolCalls with FilePath set
|
|
// natively from a.Input.File.
|
|
func TestKiroIDEFilePathNativeSet(t *testing.T) {
|
|
execID := "exec-test-001"
|
|
editFile := "src/server.go"
|
|
writeFile := "src/new.go"
|
|
|
|
actions := []kiroIDEExecAction{
|
|
{
|
|
ActionID: "action-replace",
|
|
ActionType: "replace",
|
|
Input: kiroIDEActionInput{
|
|
File: editFile,
|
|
OriginalContent: "package main\n",
|
|
ModifiedContent: "package main\n\n// updated\n",
|
|
},
|
|
},
|
|
{
|
|
ActionID: "action-create",
|
|
ActionType: "create",
|
|
Input: kiroIDEActionInput{
|
|
File: writeFile,
|
|
ModifiedContent: "package main\n",
|
|
},
|
|
},
|
|
}
|
|
|
|
execLog := struct {
|
|
ExecutionID string `json:"executionId"`
|
|
Actions []kiroIDEExecAction `json:"actions"`
|
|
}{
|
|
ExecutionID: execID,
|
|
Actions: actions,
|
|
}
|
|
|
|
data, err := json.Marshal(execLog)
|
|
require.NoError(t, err, "marshal exec log")
|
|
|
|
logPath := filepath.Join(t.TempDir(), execID+".json")
|
|
require.NoError(t, os.WriteFile(logPath, data, 0o600), "write exec log")
|
|
|
|
execIndex := map[string]string{execID: logPath}
|
|
h := kiroIDEHistoryEntry{ExecutionID: execID}
|
|
|
|
_, calls := kiroIDEResolveAssistant(h, execIndex)
|
|
require.NotEmpty(t, calls, "expected tool calls from execution log")
|
|
require.Len(t, calls, 2, "expected replace and create tool calls")
|
|
|
|
var editCall, writeCall ParsedToolCall
|
|
for _, c := range calls {
|
|
switch c.ToolName {
|
|
case "Edit":
|
|
editCall = c
|
|
case "Write":
|
|
writeCall = c
|
|
}
|
|
}
|
|
|
|
assert.Equal(t, "Edit", editCall.ToolName, "edit ToolName")
|
|
assert.Equal(t, editFile, editCall.FilePath, "edit FilePath")
|
|
|
|
assert.Equal(t, "Write", writeCall.ToolName, "write ToolName")
|
|
assert.Equal(t, writeFile, writeCall.FilePath, "write FilePath")
|
|
}
|