refactor(service): disable SubmitFromApplication fallback, fully replaced by POST /tasks

- Comment out SubmitFromApplication method and its fallback path

- Comment out 5 tests that tested the old direct-submission code

- Remove unused imports after commenting out the method

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
dailz
2026-04-16 15:15:42 +08:00
parent 80f2bd32d9
commit 36d842350c
2 changed files with 66 additions and 58 deletions

View File

@@ -1,12 +1,8 @@
package service
import (
"context"
"encoding/json"
"net/http"
"net/http/httptest"
"os"
"path/filepath"
"strings"
"testing"
@@ -198,6 +194,8 @@ func TestRenderScript_NewlineInValue(t *testing.T) {
}
}
// [已禁用] 测试的是旧的直接提交路径,该路径已被注释掉
/*
func TestSubmitFromApplication_Success(t *testing.T) {
jobID := int32(42)
appSvc, cleanup := setupApplicationService(t, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
@@ -227,7 +225,10 @@ func TestSubmitFromApplication_Success(t *testing.T) {
t.Errorf("JobID = %d, want 42", resp.JobID)
}
}
*/
// [已禁用] 测试的是旧的直接提交路径,该路径已被注释掉
/*
func TestSubmitFromApplication_AppNotFound(t *testing.T) {
appSvc, cleanup := setupApplicationService(t, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
@@ -242,7 +243,10 @@ func TestSubmitFromApplication_AppNotFound(t *testing.T) {
t.Errorf("error should mention 'not found', got: %v", err)
}
}
*/
// [已禁用] 测试的是旧的直接提交路径,该路径已被注释掉
/*
func TestSubmitFromApplication_ValidationFail(t *testing.T) {
appSvc, cleanup := setupApplicationService(t, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
@@ -263,7 +267,10 @@ func TestSubmitFromApplication_ValidationFail(t *testing.T) {
t.Errorf("error should mention 'missing', got: %v", err)
}
}
*/
// [已禁用] 测试的是旧的直接提交路径,该路径已被注释掉
/*
func TestSubmitFromApplication_NoParameters(t *testing.T) {
jobID := int32(99)
appSvc, cleanup := setupApplicationService(t, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
@@ -289,7 +296,10 @@ func TestSubmitFromApplication_NoParameters(t *testing.T) {
t.Errorf("JobID = %d, want 99", resp.JobID)
}
}
*/
// [已禁用] 前端已全部迁移到 POST /tasks 接口,此测试不再需要。
/*
func TestSubmitFromApplication_DelegatesToTaskService(t *testing.T) {
jobID := int32(77)
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
@@ -354,3 +364,4 @@ func TestSubmitFromApplication_DelegatesToTaskService(t *testing.T) {
t.Errorf("task Status = %q, want %q", task.Status, model.TaskStatusQueued)
}
}
*/