diff options
| author | Claude <noreply@anthropic.com> | 2026-05-25 05:01:05 +0000 |
|---|---|---|
| committer | Claude <noreply@anthropic.com> | 2026-05-25 05:01:05 +0000 |
| commit | 6890bafa65a309b540cbe1562c39df137f202369 (patch) | |
| tree | a6e08cf0ea814f08268a96802b5839c415e303c6 /internal/api/validate_test.go | |
| parent | e766b4c3ef13181ec6adf90ec4abe9db0129fab1 (diff) | |
refactor(api): remove the natural-language elaborate REST endpoint (Phase 3)
Chatbots now elaborate tasks in-conversation and submit them via the chatbot
MCP server, so the POST /api/tasks/elaborate shell-out path is no longer needed.
Removes the route, handleElaborateTask, and the task-elaborate-only helpers
(buildElaboratePrompt, sanitizeElaboratedTask, readProjectContext,
appendRawNarrative, elaborateWith{Claude,Local,Gemini}, and the elaboratedTask/
elaboratedAgent types) plus their dedicated tests.
Shared helpers (extractJSON, claude/geminiBinaryPath, claude/geminiJSONResult,
elaborateTimeout, the per-IP limiter) are retained — the story-elaborate
endpoint and task-validate endpoint still use them. Stories themselves are
untouched here; their removal stays in the Phase 8 cleanup pass.
https://claude.ai/code/session_01SESwn7kQ7oP62trWw6pc39
Diffstat (limited to 'internal/api/validate_test.go')
| -rw-r--r-- | internal/api/validate_test.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/internal/api/validate_test.go b/internal/api/validate_test.go index c3d7b1f..60fec14 100644 --- a/internal/api/validate_test.go +++ b/internal/api/validate_test.go @@ -3,11 +3,32 @@ package api import ( "bytes" "encoding/json" + "fmt" "net/http" "net/http/httptest" + "os" + "path/filepath" "testing" ) +// createFakeClaude writes a stub `claude` script that prints the given output +// and exits with the given code, returning its path for use as a binary +// override in tests. +func createFakeClaude(t *testing.T, output string, exitCode int) string { + t.Helper() + dir := t.TempDir() + outputFile := filepath.Join(dir, "output.json") + if err := os.WriteFile(outputFile, []byte(output), 0600); err != nil { + t.Fatal(err) + } + script := filepath.Join(dir, "claude") + content := fmt.Sprintf("#!/bin/sh\ncat %q\nexit %d\n", outputFile, exitCode) + if err := os.WriteFile(script, []byte(content), 0755); err != nil { + t.Fatal(err) + } + return script +} + func TestValidateTask_Success(t *testing.T) { srv, _ := testServer(t) |
