2026-01-29 03:03:40 +08:00
|
|
|
package service
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"strings"
|
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func TestSanitizeOpenCodeText_RewritesCanonicalSentence(t *testing.T) {
|
|
|
|
|
in := "You are OpenCode, the best coding agent on the planet."
|
2026-01-31 01:40:38 +08:00
|
|
|
got := sanitizeSystemText(in)
|
2026-01-29 03:03:40 +08:00
|
|
|
require.Equal(t, strings.TrimSpace(claudeCodeSystemPrompt), got)
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-31 02:01:51 +08:00
|
|
|
func TestSanitizeToolDescription_DoesNotRewriteKeywords(t *testing.T) {
|
2026-01-29 03:03:40 +08:00
|
|
|
in := "OpenCode and opencode are mentioned."
|
2026-01-31 02:01:51 +08:00
|
|
|
got := sanitizeToolDescription(in)
|
|
|
|
|
// We no longer rewrite tool descriptions; only redact obvious path leaks.
|
|
|
|
|
require.Equal(t, in, got)
|
2026-01-29 03:03:40 +08:00
|
|
|
}
|