RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.
Go agent-harnessagent-native-databaseagentic-aiagentic-retrievalagentic-searchaiai-agentscontext-enginecontext-engineeringcontext-managementharness-engineeringknowledge-compilationragretrieval-augmented-generationretrieval-harnesssearch-harness
Refactor: remove API_PROXY_SCHEME (#20470)
Lynnfc9a58caceb4
diff --git a/.github/workflows/sep-tests.yml b/.github/workflows/sep-tests.ymlindex 8c681fa2b6..30fb414164 100644--- a/.github/workflows/sep-tests.yml+++ b/.github/workflows/sep-tests.yml@@ -53,7 +53,6 @@ jobs:has_go_changes: ${{ steps.detect_changes.outputs.has_go_changes }}has_web_changes: ${{ steps.detect_changes.outputs.has_web_changes }}has_native_deepdoc_changes: ${{ steps.detect_changes.outputs.has_native_deepdoc_changes }}- api_proxy_schemes: ${{ steps.detect_changes.outputs.api_proxy_schemes }}steps:- name: Ensure workspace ownershiprun: |@@ -213,27 +212,19 @@ jobs:fifi- api_proxy_schemes='["go"]'-echo "has_go_changes=${has_go}" >> $GITHUB_OUTPUTecho "has_web_changes=${has_web}" >> $GITHUB_OUTPUTecho "has_native_deepdoc_changes=${has_native_deepdoc}" >> $GITHUB_OUTPUT- echo "api_proxy_schemes=${api_proxy_schemes}" >> $GITHUB_OUTPUT- echo "Go: ${has_go}, Web: ${has_web}, Native DeepDoc: ${has_native_deepdoc}, proxy schemes: ${api_proxy_schemes}"+ echo "Go: ${has_go}, Web: ${has_web}, Native DeepDoc: ${has_native_deepdoc}"ragflow_tests_infinity:- name: ragflow_tests_infinity (${{ matrix.api_proxy_scheme }})+ name: ragflow_tests_infinityneeds: ragflow_preflightif: ${{ github.event_name != 'pull_request' && github.event_name != 'pull_request_target' || (github.event.pull_request.draft == false && contains(github.event.pull_request.labels.*.name, 'ci') && (github.event.action != 'labeled' || github.event.label.name == 'ci')) }}runs-on: [ "self-hosted", "ragflow-test" ]- strategy:- fail-fast: false- matrix:- api_proxy_scheme: ${{ fromJSON(needs.ragflow_preflight.outputs.api_proxy_schemes) }}env:DOC_ENGINE: infinity- API_PROXY_SCHEME: ${{ matrix.api_proxy_scheme }}- RAGFLOW_IMAGE: infiniflow/ragflow:${{ github.run_id }}-infinity-${{ matrix.api_proxy_scheme }}+ RAGFLOW_IMAGE: infiniflow/ragflow:${{ github.run_id }}-infinityHTTP_API_TEST_LEVEL: ${{ needs.ragflow_preflight.outputs.http_api_test_level }}HAS_GO: ${{ needs.ragflow_preflight.outputs.has_go_changes }}HAS_WEB: ${{ needs.ragflow_preflight.outputs.has_web_changes }}@@ -254,7 +245,6 @@ jobs:allow-unsafe-pr-checkout: true- name: Build ragflow go server- if: env.API_PROXY_SCHEME == 'go'run: |set -euo pipefailBUILDER_CONTAINER=ragflow_build_${GITHUB_RUN_ID}_${DOC_ENGINE}_$(od -An -N4 -tx4 /dev/urandom | tr -d ' ')@@ -276,7 +266,6 @@ jobs:./build.sh --go- name: Run Go unit tests- if: env.API_PROXY_SCHEME == 'go'# Runs after `./build.sh --go`, which guarantees the C++ static# library (librag_tokenizer_c_api.a) is present on disk. The Go# test binaries link against it transitively through@@ -388,19 +377,14 @@ jobs:# Dockerfile / Dockerfile_ci read it from ARG GITEE_TOKEN (NOT a BuildKit secret),# so the runner must expose GITEE_TOKEN as an environment variable (e.g. via the# runner's docker-compose `environment:` mapping sourced from its .env file).- # Pick the Dockerfile matching the API proxy scheme:- # - go -> Dockerfile (Go-native image)- # - * -> Dockerfile_ci (Python/legacy image)- DOCKERFILE=Dockerfile(flock -w 10800 9 || { echo "Timed out waiting for the shared Docker build slot" >&2; exit 1; }- echo "Acquired Docker build slot for ${DOC_ENGINE}/${API_PROXY_SCHEME} (dockerfile=${DOCKERFILE})"+ echo "Acquired Docker build slot for ${DOC_ENGINE}"##sudo docker pull ubuntu:24.04- sudo DOCKER_BUILDKIT=1 docker build --build-arg NEED_MIRROR=1 --build-arg HTTPS_PROXY=${HTTPS_PROXY} --build-arg HTTP_PROXY=${HTTP_PROXY} --build-arg GITEE_TOKEN=${GITEE_TOKEN} -f "${DOCKERFILE}" -t ${RAGFLOW_IMAGE} .+ sudo DOCKER_BUILDKIT=1 docker build --build-arg NEED_MIRROR=1 --build-arg HTTPS_PROXY=${HTTPS_PROXY} --build-arg HTTP_PROXY=${HTTP_PROXY} --build-arg GITEE_TOKEN=${GITEE_TOKEN} -f Dockerfile -t ${RAGFLOW_IMAGE} .) 9>"${BUILD_LOCK_FILE}"- name: Prepare Python test environment- if: env.API_PROXY_SCHEME != 'web'run: |git config --global url."https://oauth2:${GITEE_TOKEN}@gitee.com/".insteadOf "https://gitee.com/"uv sync --python 3.13 --group test --frozen@@ -414,10 +398,10 @@ jobs:## ss already installed##sudo apt update && sudo apt install -y iproute2RUNNER_WORKSPACE_PREFIX=${RUNNER_WORKSPACE_PREFIX:-${HOME}}- COMPOSE_PROJECT_NAME="${GITHUB_RUN_ID}-${DOC_ENGINE}-${API_PROXY_SCHEME}"+ COMPOSE_PROJECT_NAME="${GITHUB_RUN_ID}-${DOC_ENGINE}"echo "COMPOSE_PROJECT_NAME=${COMPOSE_PROJECT_NAME}" >> ${GITHUB_ENV}echo "RAGFLOW_CONTAINER=${COMPOSE_PROJECT_NAME}-ragflow-cpu-1" >> ${GITHUB_ENV}- ARTIFACTS_DIR=${RUNNER_WORKSPACE_PREFIX}/artifacts/${GITHUB_REPOSITORY}/${GITHUB_RUN_ID}/${DOC_ENGINE}/${API_PROXY_SCHEME}+ ARTIFACTS_DIR=${RUNNER_WORKSPACE_PREFIX}/artifacts/${GITHUB_REPOSITORY}/${GITHUB_RUN_ID}/${DOC_ENGINE}echo "ARTIFACTS_DIR=${ARTIFACTS_DIR}" >> ${GITHUB_ENV}rm -rf "${ARTIFACTS_DIR}" && mkdir -p "${ARTIFACTS_DIR}"@@ -607,7 +591,7 @@ jobs:# Persist computed ports into .env so docker-compose uses the correct host bindings.# Remove previous CI overrides first; docker compose uses the last duplicate key.- sed -i '/^ES_PORT=/d;/^OS_PORT=/d;/^INFINITY_THRIFT_PORT=/d;/^INFINITY_HTTP_PORT=/d;/^INFINITY_PSQL_PORT=/d;/^EXPOSE_MYSQL_PORT=/d;/^MINIO_PORT=/d;/^MINIO_CONSOLE_PORT=/d;/^REDIS_PORT=/d;/^KVROCKS_PORT=/d;/^EXPOSE_NATS_PORT=/d;/^EXPOSE_NATS_MONITORING_PORT=/d;/^NATS_MONITORING_PORT=/d;/^TEI_PORT=/d;/^KIBANA_PORT=/d;/^SVR_HTTP_PORT=/d;/^ADMIN_SVR_HTTP_PORT=/d;/^SVR_MCP_PORT=/d;/^SANDBOX_EXECUTOR_MANAGER_PORT=/d;/^SVR_WEB_HTTP_PORT=/d;/^SVR_WEB_HTTPS_PORT=/d;/^EXPOSE_CLICKHOUSE_TCP_PORT=/d;/^CLICKHOUSE_HTTP_PORT=/d;/^COMPOSE_PROFILES=/d;/^TEI_MODEL=/d;/^RAGFLOW_IMAGE=/d;/^DOC_ENGINE=/d;/^API_PROXY_SCHEME=/d' .env+ sed -i '/^ES_PORT=/d;/^OS_PORT=/d;/^INFINITY_THRIFT_PORT=/d;/^INFINITY_HTTP_PORT=/d;/^INFINITY_PSQL_PORT=/d;/^EXPOSE_MYSQL_PORT=/d;/^MINIO_PORT=/d;/^MINIO_CONSOLE_PORT=/d;/^REDIS_PORT=/d;/^KVROCKS_PORT=/d;/^EXPOSE_NATS_PORT=/d;/^EXPOSE_NATS_MONITORING_PORT=/d;/^NATS_MONITORING_PORT=/d;/^TEI_PORT=/d;/^KIBANA_PORT=/d;/^SVR_HTTP_PORT=/d;/^ADMIN_SVR_HTTP_PORT=/d;/^SVR_MCP_PORT=/d;/^SANDBOX_EXECUTOR_MANAGER_PORT=/d;/^SVR_WEB_HTTP_PORT=/d;/^SVR_WEB_HTTPS_PORT=/d;/^EXPOSE_CLICKHOUSE_TCP_PORT=/d;/^CLICKHOUSE_HTTP_PORT=/d;/^COMPOSE_PROFILES=/d;/^TEI_MODEL=/d;/^RAGFLOW_IMAGE=/d;/^DOC_ENGINE=/d' .env# docker-compose-go.yml uses env_file: .env-go for the ragflow-cpu# container, so the Go server process reads COMPOSE_PROFILES and# TEI_MODEL from .env (not .env). Without syncing these two,@@ -644,7 +628,6 @@ jobs:echo "TEI_MODEL=BAAI/bge-small-en-v1.5"echo "RAGFLOW_IMAGE=${RAGFLOW_IMAGE}"echo "DOC_ENGINE=${DOC_ENGINE}"- echo "API_PROXY_SCHEME=${API_PROXY_SCHEME}"} >> .env# Sync COMPOSE_PROFILES and TEI_MODEL into .env so the Go# server container (env_file: .env) sees the same TEI bypass@@ -675,7 +658,6 @@ jobs:sudo docker compose -f "${COMPOSE_FILE}" -p ${COMPOSE_PROJECT_NAME} up -d- name: Run New RESTFUL api tests against Infinity- if: env.API_PROXY_SCHEME != 'web'run: |export http_proxy=""; export https_proxy=""; export no_proxy=""; export HTTP_PROXY=""; export HTTPS_PROXY=""; export NO_PROXY=""svc_ready=0@@ -710,7 +692,7 @@ jobs:run: |set -uo pipefailRUNNER_WORKSPACE_PREFIX="${RUNNER_WORKSPACE_PREFIX:-${HOME}}"- ARTIFACTS_DIR="${RUNNER_WORKSPACE_PREFIX}/artifacts/${GITHUB_REPOSITORY}/${GITHUB_RUN_ID}/${DOC_ENGINE}/${API_PROXY_SCHEME}"+ ARTIFACTS_DIR="${RUNNER_WORKSPACE_PREFIX}/artifacts/${GITHUB_REPOSITORY}/${GITHUB_RUN_ID}/${DOC_ENGINE}"LOG_DEST="${ARTIFACTS_DIR}/ragflow-logs-infinity"mkdir -p "${ARTIFACTS_DIR}"if [ -d docker/ragflow-logs ]; then@@ -749,18 +731,13 @@ jobs:ragflow_tests_elasticsearch:- name: ragflow_tests_elasticsearch (${{ matrix.api_proxy_scheme }})+ name: ragflow_tests_elasticsearchneeds: ragflow_preflightif: ${{ github.event_name != 'pull_request' && github.event_name != 'pull_request_target' || (github.event.pull_request.draft == false && contains(github.event.pull_request.labels.*.name, 'ci') && (github.event.action != 'labeled' || github.event.label.name == 'ci')) }}runs-on: [ "self-hosted", "ragflow-test" ]- strategy:- fail-fast: false- matrix:- api_proxy_scheme: ${{ fromJSON(needs.ragflow_preflight.outputs.api_proxy_schemes) }}env:DOC_ENGINE: elasticsearch- API_PROXY_SCHEME: ${{ matrix.api_proxy_scheme }}- RAGFLOW_IMAGE: infiniflow/ragflow:${{ github.run_id }}-elasticsearch-${{ matrix.api_proxy_scheme }}+ RAGFLOW_IMAGE: infiniflow/ragflow:${{ github.run_id }}-elasticsearchHTTP_API_TEST_LEVEL: ${{ needs.ragflow_preflight.outputs.http_api_test_level }}HAS_GO: ${{ needs.ragflow_preflight.outputs.has_go_changes }}HAS_WEB: ${{ needs.ragflow_preflight.outputs.has_web_changes }}@@ -781,7 +758,6 @@ jobs:allow-unsafe-pr-checkout: true- name: Build ragflow go server- if: env.API_PROXY_SCHEME == 'go'run: |set -euo pipefailBUILDER_CONTAINER=ragflow_build_${GITHUB_RUN_ID}_${DOC_ENGINE}_$(od -An -N4 -tx4 /dev/urandom | tr -d ' ')@@ -803,7 +779,6 @@ jobs:./build.sh --go- name: Run Go unit tests- if: env.API_PROXY_SCHEME == 'go'# Runs after `./build.sh --go`, which guarantees the C++ static# library (librag_tokenizer_c_api.a) is present on disk. The Go# test binaries link against it transitively through@@ -906,7 +881,6 @@ jobs:fi- name: Run ragflow_deps regression guards- if: env.API_PROXY_SCHEME == 'go'# Pure-Python, local, needs no API keys or model downloads; guards (a) the# ONNX Runtime extraction logic the in-process (Go) DeepDoc backend build# depends on (notably the version-bump path C2 hardened) and (b) the@@ -930,19 +904,14 @@ jobs:# Dockerfile / Dockerfile_ci read it from ARG GITEE_TOKEN (NOT a BuildKit secret),# so the runner must expose GITEE_TOKEN as an environment variable (e.g. via the# runner's docker-compose `environment:` mapping sourced from its .env file).- # Pick the Dockerfile matching the API proxy scheme:- # - go -> Dockerfile (Go-native image)- # - * -> Dockerfile_ci (Python/legacy image)- DOCKERFILE=Dockerfile(flock -w 10800 9 || { echo "Timed out waiting for the shared Docker build slot" >&2; exit 1; }- echo "Acquired Docker build slot for ${DOC_ENGINE}/${API_PROXY_SCHEME} (dockerfile=${DOCKERFILE})"+ echo "Acquired Docker build slot for ${DOC_ENGINE}"##sudo docker pull ubuntu:24.04- sudo DOCKER_BUILDKIT=1 docker build --build-arg NEED_MIRROR=1 --build-arg HTTPS_PROXY=${HTTPS_PROXY} --build-arg HTTP_PROXY=${HTTP_PROXY} --build-arg GITEE_TOKEN=${GITEE_TOKEN} -f "${DOCKERFILE}" -t ${RAGFLOW_IMAGE} .+ sudo DOCKER_BUILDKIT=1 docker build --build-arg NEED_MIRROR=1 --build-arg HTTPS_PROXY=${HTTPS_PROXY} --build-arg HTTP_PROXY=${HTTP_PROXY} --build-arg GITEE_TOKEN=${GITEE_TOKEN} -f Dockerfile -t ${RAGFLOW_IMAGE} .) 9>"${BUILD_LOCK_FILE}"- name: Prepare Python test environment- if: env.API_PROXY_SCHEME != 'web'run: |git config --global url."https://oauth2:${GITEE_TOKEN}@gitee.com/".insteadOf "https://gitee.com/"uv sync --python 3.13 --group test --frozen@@ -956,10 +925,10 @@ jobs:## ss already installed##sudo apt update && sudo apt install -y iproute2RUNNER_WORKSPACE_PREFIX=${RUNNER_WORKSPACE_PREFIX:-${HOME}}- COMPOSE_PROJECT_NAME="${GITHUB_RUN_ID}-${DOC_ENGINE}-${API_PROXY_SCHEME}"+ COMPOSE_PROJECT_NAME="${GITHUB_RUN_ID}-${DOC_ENGINE}"echo "COMPOSE_PROJECT_NAME=${COMPOSE_PROJECT_NAME}" >> ${GITHUB_ENV}echo "RAGFLOW_CONTAINER=${COMPOSE_PROJECT_NAME}-ragflow-cpu-1" >> ${GITHUB_ENV}- ARTIFACTS_DIR=${RUNNER_WORKSPACE_PREFIX}/artifacts/${GITHUB_REPOSITORY}/${GITHUB_RUN_ID}/${DOC_ENGINE}/${API_PROXY_SCHEME}+ ARTIFACTS_DIR=${RUNNER_WORKSPACE_PREFIX}/artifacts/${GITHUB_REPOSITORY}/${GITHUB_RUN_ID}/${DOC_ENGINE}echo "ARTIFACTS_DIR=${ARTIFACTS_DIR}" >> ${GITHUB_ENV}rm -rf "${ARTIFACTS_DIR}" && mkdir -p "${ARTIFACTS_DIR}"@@ -1149,7 +1118,7 @@ jobs:# Persist computed ports into .env so docker-compose uses the correct host bindings.# Remove previous CI overrides first; docker compose uses the last duplicate key.- sed -i '/^ES_PORT=/d;/^OS_PORT=/d;/^INFINITY_THRIFT_PORT=/d;/^INFINITY_HTTP_PORT=/d;/^INFINITY_PSQL_PORT=/d;/^EXPOSE_MYSQL_PORT=/d;/^MINIO_PORT=/d;/^MINIO_CONSOLE_PORT=/d;/^REDIS_PORT=/d;/^KVROCKS_PORT=/d;/^EXPOSE_NATS_PORT=/d;/^EXPOSE_NATS_MONITORING_PORT=/d;/^NATS_MONITORING_PORT=/d;/^TEI_PORT=/d;/^KIBANA_PORT=/d;/^SVR_HTTP_PORT=/d;/^ADMIN_SVR_HTTP_PORT=/d;/^SVR_MCP_PORT=/d;/^SANDBOX_EXECUTOR_MANAGER_PORT=/d;/^SVR_WEB_HTTP_PORT=/d;/^SVR_WEB_HTTPS_PORT=/d;/^EXPOSE_CLICKHOUSE_TCP_PORT=/d;/^CLICKHOUSE_HTTP_PORT=/d;/^COMPOSE_PROFILES=/d;/^TEI_MODEL=/d;/^RAGFLOW_IMAGE=/d;/^DOC_ENGINE=/d;/^API_PROXY_SCHEME=/d' .env+ sed -i '/^ES_PORT=/d;/^OS_PORT=/d;/^INFINITY_THRIFT_PORT=/d;/^INFINITY_HTTP_PORT=/d;/^INFINITY_PSQL_PORT=/d;/^EXPOSE_MYSQL_PORT=/d;/^MINIO_PORT=/d;/^MINIO_CONSOLE_PORT=/d;/^REDIS_PORT=/d;/^KVROCKS_PORT=/d;/^EXPOSE_NATS_PORT=/d;/^EXPOSE_NATS_MONITORING_PORT=/d;/^NATS_MONITORING_PORT=/d;/^TEI_PORT=/d;/^KIBANA_PORT=/d;/^SVR_HTTP_PORT=/d;/^ADMIN_SVR_HTTP_PORT=/d;/^SVR_MCP_PORT=/d;/^SANDBOX_EXECUTOR_MANAGER_PORT=/d;/^SVR_WEB_HTTP_PORT=/d;/^SVR_WEB_HTTPS_PORT=/d;/^EXPOSE_CLICKHOUSE_TCP_PORT=/d;/^CLICKHOUSE_HTTP_PORT=/d;/^COMPOSE_PROFILES=/d;/^TEI_MODEL=/d;/^RAGFLOW_IMAGE=/d;/^DOC_ENGINE=/d' .env# docker-compose-go.yml uses env_file: .env-go for the ragflow-cpu# container, so the Go server process reads COMPOSE_PROFILES and# TEI_MODEL from .env (not .env). Without syncing these two,@@ -1186,7 +1155,6 @@ jobs:echo "TEI_MODEL=BAAI/bge-small-en-v1.5"echo "RAGFLOW_IMAGE=${RAGFLOW_IMAGE}"echo "DOC_ENGINE=${DOC_ENGINE}"- echo "API_PROXY_SCHEME=${API_PROXY_SCHEME}"} >> .env# Sync COMPOSE_PROFILES and TEI_MODEL into .env so the Go# server container (env_file: .env) sees the same TEI bypass@@ -1216,7 +1184,6 @@ jobs:sudo docker compose -f "${COMPOSE_FILE}" -p ${COMPOSE_PROJECT_NAME} up -d- name: Run New RESTFUL api tests against Elasticsearch- if: env.API_PROXY_SCHEME != 'web'run: |export http_proxy=""; export https_proxy=""; export no_proxy=""; export HTTP_PROXY=""; export HTTPS_PROXY=""; export NO_PROXY=""svc_ready=0@@ -1243,7 +1210,7 @@ jobs:run: |set -uo pipefailRUNNER_WORKSPACE_PREFIX="${RUNNER_WORKSPACE_PREFIX:-${HOME}}"- ARTIFACTS_DIR="${RUNNER_WORKSPACE_PREFIX}/artifacts/${GITHUB_REPOSITORY}/${GITHUB_RUN_ID}/${DOC_ENGINE}/${API_PROXY_SCHEME}"+ ARTIFACTS_DIR="${RUNNER_WORKSPACE_PREFIX}/artifacts/${GITHUB_REPOSITORY}/${GITHUB_RUN_ID}/${DOC_ENGINE}"LOG_DEST="${ARTIFACTS_DIR}/ragflow-logs-es"mkdir -p "${ARTIFACTS_DIR}"if [ -d docker/ragflow-logs ]; then@@ -1390,7 +1357,6 @@ jobs:runs-on: [ "self-hosted", "ragflow-test" ]env:DOC_ENGINE: infinity- API_PROXY_SCHEME: gosteps:- name: Ensure workspace ownershiprun: |@@ -1436,10 +1402,10 @@ jobs:## ss already installed##sudo apt update && sudo apt install -y iproute2RUNNER_WORKSPACE_PREFIX=${RUNNER_WORKSPACE_PREFIX:-${HOME}}- COMPOSE_PROJECT_NAME="${GITHUB_RUN_ID}-go-int-${DOC_ENGINE}-${API_PROXY_SCHEME}"+ COMPOSE_PROJECT_NAME="${GITHUB_RUN_ID}-go-int-${DOC_ENGINE}"echo "COMPOSE_PROJECT_NAME=${COMPOSE_PROJECT_NAME}" >> ${GITHUB_ENV}echo "RAGFLOW_CONTAINER=${COMPOSE_PROJECT_NAME}-ragflow-cpu-1" >> ${GITHUB_ENV}- ARTIFACTS_DIR=${RUNNER_WORKSPACE_PREFIX}/artifacts/${GITHUB_REPOSITORY}/${GITHUB_RUN_ID}/${DOC_ENGINE}/${API_PROXY_SCHEME}+ ARTIFACTS_DIR=${RUNNER_WORKSPACE_PREFIX}/artifacts/${GITHUB_REPOSITORY}/${GITHUB_RUN_ID}/${DOC_ENGINE}echo "ARTIFACTS_DIR=${ARTIFACTS_DIR}" >> ${GITHUB_ENV}rm -rf "${ARTIFACTS_DIR}" && mkdir -p "${ARTIFACTS_DIR}"@@ -1629,7 +1595,7 @@ jobs:# Persist computed ports into .env so docker-compose uses the correct host bindings.# Remove previous CI overrides first; docker compose uses the last duplicate key.- sed -i '/^ES_PORT=/d;/^OS_PORT=/d;/^INFINITY_THRIFT_PORT=/d;/^INFINITY_HTTP_PORT=/d;/^INFINITY_PSQL_PORT=/d;/^EXPOSE_MYSQL_PORT=/d;/^MINIO_PORT=/d;/^MINIO_CONSOLE_PORT=/d;/^REDIS_PORT=/d;/^KVROCKS_PORT=/d;/^EXPOSE_NATS_PORT=/d;/^EXPOSE_NATS_MONITORING_PORT=/d;/^NATS_MONITORING_PORT=/d;/^TEI_PORT=/d;/^KIBANA_PORT=/d;/^SVR_HTTP_PORT=/d;/^ADMIN_SVR_HTTP_PORT=/d;/^SVR_MCP_PORT=/d;/^SANDBOX_EXECUTOR_MANAGER_PORT=/d;/^SVR_WEB_HTTP_PORT=/d;/^SVR_WEB_HTTPS_PORT=/d;/^EXPOSE_CLICKHOUSE_TCP_PORT=/d;/^CLICKHOUSE_HTTP_PORT=/d;/^COMPOSE_PROFILES=/d;/^TEI_MODEL=/d;/^RAGFLOW_IMAGE=/d;/^DOC_ENGINE=/d;/^API_PROXY_SCHEME=/d' .env+ sed -i '/^ES_PORT=/d;/^OS_PORT=/d;/^INFINITY_THRIFT_PORT=/d;/^INFINITY_HTTP_PORT=/d;/^INFINITY_PSQL_PORT=/d;/^EXPOSE_MYSQL_PORT=/d;/^MINIO_PORT=/d;/^MINIO_CONSOLE_PORT=/d;/^REDIS_PORT=/d;/^KVROCKS_PORT=/d;/^EXPOSE_NATS_PORT=/d;/^EXPOSE_NATS_MONITORING_PORT=/d;/^NATS_MONITORING_PORT=/d;/^TEI_PORT=/d;/^KIBANA_PORT=/d;/^SVR_HTTP_PORT=/d;/^ADMIN_SVR_HTTP_PORT=/d;/^SVR_MCP_PORT=/d;/^SANDBOX_EXECUTOR_MANAGER_PORT=/d;/^SVR_WEB_HTTP_PORT=/d;/^SVR_WEB_HTTPS_PORT=/d;/^EXPOSE_CLICKHOUSE_TCP_PORT=/d;/^CLICKHOUSE_HTTP_PORT=/d;/^COMPOSE_PROFILES=/d;/^TEI_MODEL=/d;/^RAGFLOW_IMAGE=/d;/^DOC_ENGINE=/d' .env# docker-compose-go.yml uses env_file: .env-go for the ragflow-cpu# container, so the Go server process reads COMPOSE_PROFILES and# TEI_MODEL from .env (not .env). Without syncing these two,@@ -1672,7 +1638,6 @@ jobs:echo "COMPOSE_PROFILES=infinity,ragflow-go,tei-cpu,metadata-mysql,clickhouse"echo "TEI_MODEL=BAAI/bge-small-en-v1.5"echo "DOC_ENGINE=${DOC_ENGINE}"- echo "API_PROXY_SCHEME=${API_PROXY_SCHEME}"} >> .env# Sync COMPOSE_PROFILES and TEI_MODEL into .env so the Go# server container (env_file: .env) sees the same TEI bypassdiff --git a/docker/.env b/docker/.envindex 935730d119..d0d16190eb 100644--- a/docker/.env+++ b/docker/.env@@ -264,10 +264,6 @@ SVR_MCP_PORT=9382# first login.ADMIN_DEFAULT_PASSWORD=admin-# API_PROXY_SCHEME=hybrid # go and python hybrid deploy mode-API_PROXY_SCHEME=go-#API_PROXY_SCHEME=python # use pure python server deployment-# Development-only: set to 1 to bypass host safety checks for test_db_connection and allow private/local database hosts.# Do not enable in production.ALLOW_ANY_HOST=0diff --git a/docker/launch_backend_service.sh b/docker/launch_backend_service.shindex eba2d5f96e..3ab864ad2f 100755--- a/docker/launch_backend_service.sh+++ b/docker/launch_backend_service.sh@@ -12,10 +12,10 @@ usage() {echo " --debug Enable debug mode and debug-level logging"echoecho "Available service types:"- echo " ragflow Start RAGFlow server based on API_PROXY_SCHEME"- echo " task_executor Start task workers based on API_PROXY_SCHEME"- echo " admin Start Admin server based on API_PROXY_SCHEME"- echo " data_sync Start the data source syncer based on API_PROXY_SCHEME"+ echo " ragflow Start RAGFlow server"+ echo " task_executor Start task workers"+ echo " admin Start Admin server"+ echo " data_sync Start the data source syncer"echoecho "Examples:"echo " $0"@@ -50,12 +50,8 @@ load_env_file# Unset HTTP proxies that might be set by Docker daemonexport http_proxy=""; export https_proxy=""; export no_proxy=""; export HTTP_PROXY=""; export HTTPS_PROXY=""; export NO_PROXY=""-export PYTHONPATH=$(pwd)export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/-JEMALLOC_PATH=$(pkg-config --variable=libdir jemalloc)/libjemalloc.so--PY=python3# Set default number of workers if WS is not set or less than 1if [[ -z "$WS" || $WS -lt 1 ]]; then@@ -95,25 +91,18 @@ trap cleanup SIGINT SIGTERM# Function to execute task_executor with retry logictask_exe(){local task_id=$1- local task_name="task_executor.py for task $task_id"- local -a task_cmd=("$PY" "rag/svr/task_executor.py" "-i" "$task_id")- if [[ "${API_PROXY_SCHEME}" == "go" ]]; then- prepare_for_go- task_name="ragflow_server --ingestor"- task_cmd=("bin/ragflow_server" "--ingestor")- if [[ "$DEBUG_MODE" -eq 1 ]]; then- task_cmd+=("--log-level" "debug")- fi+ local task_name="ragflow_server --ingestor"+ local -a task_cmd=("bin/ragflow_server" "--ingestor")+ prepare_for_go+ if [[ "$DEBUG_MODE" -eq 1 ]]; then+ task_cmd+=("--log-level" "debug")filocal retry_count=0+while ! $STOP && [ $retry_count -lt $MAX_RETRIES ]; doecho "Starting ${task_cmd[*]} (Attempt $((retry_count+1)))"EXIT_CODE=0- if [[ "${API_PROXY_SCHEME}" == "go" ]]; then- "${task_cmd[@]}" || EXIT_CODE=$?- else- LD_PRELOAD=$JEMALLOC_PATH "${task_cmd[@]}" || EXIT_CODE=$?- fi+ "${task_cmd[@]}" || EXIT_CODE=$?if [ $EXIT_CODE -eq 0 ]; thenecho "$task_name exited successfully."break@@ -132,17 +121,11 @@ task_exe(){# Function to execute ragflow_server with retry logicrun_server(){- local server_name="ragflow_server.py"- local -a server_cmd=("$PY" "api/ragflow_server.py")- if [[ "${API_PROXY_SCHEME}" == "go" ]]; then- prepare_for_go- server_name="ragflow_server"- server_cmd=("bin/ragflow_server" "--api")- if [[ "$DEBUG_MODE" -eq 1 ]]; then- server_cmd+=("--log-level" "debug")- fi- elif [[ "$DEBUG_MODE" -eq 1 ]]; then- server_cmd+=("--debug")+ local server_name="ragflow_server"+ local -a server_cmd=("bin/ragflow_server" "--api")+ prepare_for_go+ if [[ "$DEBUG_MODE" -eq 1 ]]; then+ server_cmd+=("--log-level" "debug")filocal retry_count=0while ! $STOP && [ $retry_count -lt $MAX_RETRIES ]; do@@ -167,15 +150,11 @@ run_server(){# Function to execute admin_server with retry logicrun_admin_server(){- local server_name="admin_server.py"- local -a server_cmd=("$PY" "admin/server/admin_server.py")- if [[ "${API_PROXY_SCHEME}" == "go" ]]; then- prepare_for_go- server_name="admin_server"- server_cmd=("bin/ragflow_server" "--admin")- if [[ "$DEBUG_MODE" -eq 1 ]]; then- server_cmd+=("--log-level" "debug")- fi+ local server_name="admin_server"+ local -a server_cmd=("bin/ragflow_server" "--admin")+ prepare_for_go+ if [[ "$DEBUG_MODE" -eq 1 ]]; then+ server_cmd+=("--log-level" "debug")filocal retry_count=0while ! $STOP && [ $retry_count -lt $MAX_RETRIES ]; do@@ -199,15 +178,11 @@ run_admin_server(){# Function to execute sync_data_source with retry logicrun_data_sync(){- local server_name="sync_data_source.py"- local -a sync_cmd=("$PY" "rag/svr/sync_data_source.py")- if [[ "${API_PROXY_SCHEME}" == "go" ]]; then- prepare_for_go- server_name="ragflow_server --syncer"- sync_cmd=("bin/ragflow_server" "--syncer")- if [[ "$DEBUG_MODE" -eq 1 ]]; then- sync_cmd+=("--log-level" "debug")- fi+ local server_name="ragflow_server --syncer"+ local -a sync_cmd=("bin/ragflow_server" "--syncer")+ prepare_for_go+ if [[ "$DEBUG_MODE" -eq 1 ]]; then+ sync_cmd+=("--log-level" "debug")filocal retry_count=0while ! $STOP && [ $retry_count -lt $MAX_RETRIES ]; do@@ -230,12 +205,6 @@ run_data_sync(){fi}-ensure_db_init() {- echo "Initializing database tables..."- "$PY" -c "from api.db.db_models import init_database_tables as init_web_db; init_web_db()"- echo "Database tables initialized."-}-run_migrations() {local db_type="${DB_TYPE:-mysql}"db_type="${db_type,,}"@@ -246,15 +215,10 @@ run_migrations() {return 0fi- if [[ "${API_PROXY_SCHEME}" == "go" ]]; then- # The Go backend owns the model provider tables. --migrate is a- # standalone action: it runs the migrations and exits, so it is- # independent of any server actually starting.- echo "Running model provider table migrations (go)..."- bin/ragflow_server --migrate- else- tools/scripts/run_migrations.sh- fi+ # --migrate is a standalone action: it runs the migrations and exits, so it+ # is independent of any server actually starting.+ echo "Running model provider table migrations..."+ bin/ragflow_server --migrate}prepare_for_go() {@@ -317,23 +281,12 @@ for arg in "$@"; doesacdone-if [[ "$DEBUG_MODE" -eq 1 && "${API_PROXY_SCHEME}" != "go" ]]; then- export LOG_LEVELS="root=DEBUG"-fi-if [[ "$SERVICE_SELECTED" -eq 0 ]]; thenSTART_RAGFLOW=1START_TASK_EXECUTOR=1fiif [[ "$START_RAGFLOW" -eq 1 ]]; then- # The Go backend owns the schema when it serves the API, so skip the- # Python-side table creation then. A Go-only deployment may not ship the api- # package at all, and letting both sides create tables makes them fight over- # the same schema.- if [[ "${API_PROXY_SCHEME}" != "go" ]]; then- ensure_db_init- firun_migrationsfidiff --git a/internal/handler/dataset.go b/internal/handler/dataset.goindex 7591c6528e..679260743a 100644--- a/internal/handler/dataset.go+++ b/internal/handler/dataset.go@@ -948,9 +948,8 @@ func (h *DatasetsHandler) AggregateTags(c *gin.Context) {}// GetCompilationStatus returns the dataset-level knowledge-compile lifecycle-// state (scheduler contract for API_PROXY_SCHEME=go/hybrid). It replaces the-// Python-era TraceIndex task-progress endpoint for the Go backend. The optional-// `kind` query parameter scopes the status to one compile type.+// state. The optional `kind` query parameter scopes the status to one compile+// type.func (h *DatasetsHandler) GetCompilationStatus(c *gin.Context) {user, errorCode, errorMessage := GetUser(c)if errorCode != common.CodeSuccess {diff --git a/internal/router/router.go b/internal/router/router.goindex cf5ed59652..3f38e8529d 100644--- a/internal/router/router.go+++ b/internal/router/router.go@@ -340,8 +340,8 @@ func (r *Router) Setup(engine *gin.Engine) {datasets.GET("/:dataset_id/graph", r.datasetsHandler.GetKnowledgeGraph)datasets.POST("/:dataset_id/embedding/check", r.datasetsHandler.CheckEmbedding)datasets.POST("/:dataset_id/documents/batch-update-status", r.documentHandler.BatchUpdateDocumentStatus)- // Scheduler compile-status contract (API_PROXY_SCHEME=go/hybrid);- // replaces the retired RunIndex/TraceIndex/DeleteIndex /index routes.+ // Scheduler compile-status contract; replaces the retired+ // RunIndex/TraceIndex/DeleteIndex /index routes.datasets.GET("/:dataset_id/compilation/status", r.datasetsHandler.GetCompilationStatus)// Knowledge-compilation wiki artifactsdiff --git a/internal/service/dataset/compilation_status.go b/internal/service/dataset/compilation_status.goindex 6ce2a8f712..9224bde74d 100644--- a/internal/service/dataset/compilation_status.go+++ b/internal/service/dataset/compilation_status.go@@ -15,9 +15,7 @@ import ()// CompilationStatus is the dataset-level knowledge-compile lifecycle state-// surfaced by GET /datasets/:id/compilation/status. It is the Go scheduler-// contract that replaces the Python-era RunIndex/TraceIndex task progress for-// API_PROXY_SCHEME=go / hybrid.+// surfaced by GET /datasets/:id/compilation/status.//// State only takes one of idle/pending/running/completed. Error is NOT a fifth// state: it is a diagnostic attached to a pending/running batch left for retry,diff --git a/test/testcases/configs.py b/test/testcases/configs.pyindex 65b71ef5b9..7d0b8daba2 100644--- a/test/testcases/configs.py+++ b/test/testcases/configs.py@@ -13,43 +13,16 @@# See the License for the specific language governing permissions and# limitations under the License.#-import loggingimport os-from pathlib import Pathimport pytest-_DOCKER_ENV = Path(__file__).resolve().parents[2] / "docker" / ".env"---def _docker_env_value(name: str) -> str | None:- if not _DOCKER_ENV.exists():- return None- for line in _DOCKER_ENV.read_text().splitlines():- line = line.strip()- if not line or line.startswith("#") or "=" not in line:- continue- key, value = line.split("=", 1)- if key.strip() == name:- return value.split("#", 1)[0].strip().strip('"').strip("'")- return None---def _config_value(name: str, default: str | None = None) -> str | None:- return os.getenv(name) or _docker_env_value(name) or default---API_PROXY_SCHEME = _config_value("API_PROXY_SCHEME", "python")-IS_GO_PROXY = API_PROXY_SCHEME == "go"-SDK_UNAUTHORIZED_ERROR_MESSAGE = "Invalid access token" if IS_GO_PROXY else "<Unauthorized '401: Unauthorized'>"-def _default_host_address() -> str:return "http://127.0.0.1:9380"HOST_ADDRESS = os.getenv("HOST_ADDRESS") or _default_host_address()-logging.info("Resolved API proxy configuration: scheme=%s, is_go_proxy=%s, host_address=%s", API_PROXY_SCHEME, IS_GO_PROXY, HOST_ADDRESS)VERSION = "v1"ZHIPU_AI_API_KEY = os.getenv("ZHIPU_AI_API_KEY")if ZHIPU_AI_API_KEY is None:diff --git a/test/testcases/conftest.py b/test/testcases/conftest.pyindex 09439d96e5..dc14d09a8b 100644--- a/test/testcases/conftest.py+++ b/test/testcases/conftest.py@@ -95,7 +95,7 @@ import timeimport pytestimport requests-from test.testcases.configs import API_PROXY_SCHEME, EMAIL, HOST_ADDRESS, IS_GO_PROXY, PASSWORD, SILICONFLOW_API_KEY, VERSION, ZHIPU_AI_API_KEY+from test.testcases.configs import EMAIL, HOST_ADDRESS, PASSWORD, SILICONFLOW_API_KEY, VERSION, ZHIPU_AI_API_KEYMARKER_EXPRESSIONS = {"p1": "p1",@@ -179,13 +179,7 @@ def _auth_with_admin_bootstrap_retry():@pytest.fixture(scope="session")def auth():- if IS_GO_PROXY:- return _auth_with_admin_bootstrap_retry()- try:- register()- except Exception as e:- print(e)- return login()+ return _auth_with_admin_bootstrap_retry()@pytest.fixture(scope="session")@@ -207,24 +201,14 @@ def get_added_models(auth, factory_name):res = response.json()if res.get("code") != 0:raise Exception(res.get("message"))- # Go server (post-Python port) serializes this field as `model_provider`- # in the RESTful `/api/v1/models` response. Fall back to the legacy- # `provider_name` key so this conftest works against both.- added_factory = {model.get("model_provider") or model["provider_name"] for model in res.get("data", [])}- if API_PROXY_SCHEME == "go":- added_factory = {provider.casefold() for provider in added_factory}- factory_name = factory_name.casefold()- if factory_name in added_factory:- return True- return False+ added_factory = {model["provider_name"].casefold() for model in res.get("data", [])}+ return factory_name.casefold() in added_factorydef _response_json_or_warning(response, action: str) -> dict:try:return response.json()except ValueError:- if API_PROXY_SCHEME != "go":- raisemessage = response.text.strip() or response.reason or "empty response body"return {"code": response.status_code or -1,diff --git a/test/testcases/restful_api/conftest.py b/test/testcases/restful_api/conftest.pyindex 0246f6a8f3..62f0261281 100644--- a/test/testcases/restful_api/conftest.py+++ b/test/testcases/restful_api/conftest.py@@ -16,7 +16,6 @@import pytest-from test.testcases.configs import IS_GO_PROXYfrom libs.auth import RAGFlowHttpApiAuthfrom test.testcases.restful_api.helpers.client import RestClientfrom utils.file_utils import create_txt_file@@ -102,8 +101,6 @@ GO_ONLY_SKIPS = {def pytest_collection_modifyitems(items):- if not IS_GO_PROXY:- returnfor item in items:test_name = item.name.split("[", 1)[0]for reason, skipped_tests in GO_ONLY_SKIPS.items():diff --git a/test/testcases/restful_api/helpers/assertions.py b/test/testcases/restful_api/helpers/assertions.pyindex 2f13bdb3ef..bc703df5d0 100644--- a/test/testcases/restful_api/helpers/assertions.py+++ b/test/testcases/restful_api/helpers/assertions.py@@ -14,17 +14,10 @@# limitations under the License.#-from test.testcases.configs import IS_GO_PROXY-def assert_auth_error(payload: dict, scenario_name: str) -> None:assert payload["code"] == 401, (scenario_name, payload)- if IS_GO_PROXY:- if scenario_name == "missing token":- assert payload["message"] == "Missing Authorization header", (scenario_name, payload)- else:- assert payload["message"] in {"Invalid access token", "Invalid auth credentials"}, (scenario_name, payload)- return+ if scenario_name == "missing token":+ assert payload["message"] == "Missing Authorization header", (scenario_name, payload)else:- expected = "<Unauthorized '401: Unauthorized'>"- assert payload["message"] == expected, (scenario_name, payload)+ assert payload["message"] in {"Invalid access token", "Invalid auth credentials"}, (scenario_name, payload)diff --git a/test/testcases/restful_api/helpers/client.py b/test/testcases/restful_api/helpers/client.pyindex 221750a3dd..1fac4e7aa9 100644--- a/test/testcases/restful_api/helpers/client.py+++ b/test/testcases/restful_api/helpers/client.py@@ -19,7 +19,7 @@ from typing import Anyimport pytestimport requests-from test.testcases.configs import HOST_ADDRESS, IS_GO_PROXY, VERSION+from test.testcases.configs import HOST_ADDRESS, VERSION@dataclass@@ -69,18 +69,17 @@ class RestClient:timeout=timeout,**request_kwargs,)- if IS_GO_PROXY:- try:- payload = response.json()- except ValueError:- return response- if not isinstance(payload, dict):- return response- message = payload.get("message", "")- if payload.get("code") == 500 and "Unknown column 'meta_fields'" in message:- pytest.skip("Go deployment database schema is missing document.meta_fields")- if payload.get("code") == 500 and "http://localhost:6380/embed" in message and "connect: connection refused" in message:- pytest.skip("Go memory embedding service is unavailable on localhost:6380")+ try:+ payload = response.json()+ except ValueError:+ return response+ if not isinstance(payload, dict):+ return response+ message = payload.get("message", "")+ if payload.get("code") == 500 and "Unknown column 'meta_fields'" in message:+ pytest.skip("Go deployment database schema is missing document.meta_fields")+ if payload.get("code") == 500 and "http://localhost:6380/embed" in message and "connect: connection refused" in message:+ pytest.skip("Go memory embedding service is unavailable on localhost:6380")return responsedef get(self, path: str, **kwargs) -> requests.Response:diff --git a/test/testcases/restful_api/test_agents_go_mode.py b/test/testcases/restful_api/test_agents_go_mode.pyindex 175f300ab4..7226d05817 100644--- a/test/testcases/restful_api/test_agents_go_mode.py+++ b/test/testcases/restful_api/test_agents_go_mode.py@@ -1,13 +1,7 @@-import osimport uuidimport pytest-pytestmark = pytest.mark.skipif(- os.environ.get("API_PROXY_SCHEME", "python") != "go",- reason="Go mode only (set API_PROXY_SCHEME=go + bin/ragflow_server on 9380)",-)-V2_DSL = {"graph": {"nodes": [diff --git a/test/testcases/restful_api/test_datasets.py b/test/testcases/restful_api/test_datasets.pyindex 9d37290f72..7c669faeda 100644--- a/test/testcases/restful_api/test_datasets.py+++ b/test/testcases/restful_api/test_datasets.py@@ -19,38 +19,26 @@ import uuidfrom concurrent.futures import ThreadPoolExecutor, as_completedimport pytest-from configs import DATASET_NAME_LIMIT, DEFAULT_PARSER_CONFIG+from configs import DATASET_NAME_LIMIT-from test.testcases.configs import INVALID_API_TOKEN, IS_GO_PROXY+from test.testcases.configs import INVALID_API_TOKENfrom test.testcases.restful_api.helpers.assertions import assert_auth_errorfrom test.testcases.restful_api.helpers.client import RestClientfrom test.testcases.utils import encode_avatarfrom test.testcases.utils.file_utils import create_image_file, create_txt_file-ARGUMENT_ERROR_CODE = 102 if IS_GO_PROXY else 101-PARSER_ID_FIELD = "parser_id" if IS_GO_PROXY else "chunk_method"---def _skip_go_ignored_null(payload, field):- if IS_GO_PROXY and payload.get("message") == "no properties were modified":- pytest.skip(f"Go dataset update ignores an explicit null {field}")+ARGUMENT_ERROR_CODE = 102+PARSER_ID_FIELD = "parser_id"def _parser_id_fields(chunk_method):- """Build parser_id/chunk_method fields with parse_type=1 for Go proxy.-- Go proxy requires parse_type alongside parser_id (fail-fast by design);- Python mode uses chunk_method alone.- """- fields = {PARSER_ID_FIELD: chunk_method}- if IS_GO_PROXY:- fields["parse_type"] = 1- return fields+ """Build the parser_id field; the Go API requires parse_type alongside it."""+ return {PARSER_ID_FIELD: chunk_method, "parse_type": 1}def _expected_chunk_method(chunk_method):- """Return the API-visible parser ID for the active proxy."""- if IS_GO_PROXY and chunk_method == "naive":+ """Return the API-visible parser ID."""+ if chunk_method == "naive":return "general"return chunk_method@@ -248,143 +236,6 @@ def test_dataset_update_chunk_method_contract(rest_client, clear_datasets, chunkassert update_payload["data"][PARSER_ID_FIELD] == _expected_chunk_method(chunk_method), update_payload- "name, parser_config",- [- ("auto_keywords_min", {"auto_keywords": 0}),- ("auto_keywords_mid", {"auto_keywords": 16}),- ("auto_keywords_max", {"auto_keywords": 32}),- ("auto_questions_min", {"auto_questions": 0}),- ("auto_questions_mid", {"auto_questions": 5}),- ("auto_questions_max", {"auto_questions": 10}),- ("chunk_token_num_min", {"chunk_token_num": 1}),- ("chunk_token_num_mid", {"chunk_token_num": 1024}),- ("chunk_token_num_max", {"chunk_token_num": 2048}),- ("delimiter", {"delimiter": "\n"}),- ("delimiter_space", {"delimiter": " "}),- ("html4excel_true", {"html4excel": True}),- ("html4excel_false", {"html4excel": False}),- ("layout_recognize_DeepDOC", {"layout_recognize": "DeepDOC"}),- ("layout_recognize_navie", {"layout_recognize": "Plain Text"}),- ("tag_kb_ids", {"tag_kb_ids": ["1", "2"]}),- ("topn_tags_min", {"topn_tags": 1}),- ("topn_tags_mid", {"topn_tags": 5}),- ("topn_tags_max", {"topn_tags": 10}),- ("filename_embd_weight_min", {"filename_embd_weight": 0.1}),- ("filename_embd_weight_mid", {"filename_embd_weight": 0.5}),- ("filename_embd_weight_max", {"filename_embd_weight": 1.0}),- ("task_page_size_min", {"task_page_size": 1}),- ("task_page_size_None", {"task_page_size": None}),- ("pages", {"pages": [[1, 100]]}),- ("pages_none", {"pages": None}),- ("graphrag_true", {"graphrag": {"use_graphrag": True}}),- ("graphrag_false", {"graphrag": {"use_graphrag": False}}),- ("graphrag_entity_types", {"graphrag": {"entity_types": ["age", "sex", "height", "weight"]}}),- ("graphrag_method_general", {"graphrag": {"method": "general"}}),- ("graphrag_method_light", {"graphrag": {"method": "light"}}),- ("graphrag_community_true", {"graphrag": {"community": True}}),- ("graphrag_community_false", {"graphrag": {"community": False}}),- ("graphrag_resolution_true", {"graphrag": {"resolution": True}}),- ("graphrag_resolution_false", {"graphrag": {"resolution": False}}),- ("raptor_true", {"raptor": {"use_raptor": True}}),- ("raptor_false", {"raptor": {"use_raptor": False}}),- ("raptor_prompt", {"raptor": {"prompt": "Who are you?"}}),- ("raptor_max_token_min", {"raptor": {"max_token": 512}}),- ("raptor_max_token_mid", {"raptor": {"max_token": 1024}}),- ("raptor_max_token_max", {"raptor": {"max_token": 2048}}),- ("raptor_clustering_threshold_min", {"raptor": {"clustering_threshold": 0.0}}),- ("raptor_clustering_threshold_mid", {"raptor": {"clustering_threshold": 0.5}}),- ("raptor_clustering_threshold_max", {"raptor": {"clustering_threshold": 1.0}}),- ("raptor_max_cluster_min", {"raptor": {"max_cluster": 1}}),- ("raptor_max_cluster_mid", {"raptor": {"max_cluster": 512}}),- ("raptor_max_cluster_max", {"raptor": {"max_cluster": 1024}}),- ("raptor_random_seed_min", {"raptor": {"random_seed": 0}}),- ],- ids=[- "auto_keywords_min",- "auto_keywords_mid",- "auto_keywords_max",- "auto_questions_min",- "auto_questions_mid",- "auto_questions_max",- "chunk_token_num_min",- "chunk_token_num_mid",- "chunk_token_num_max",- "delimiter",- "delimiter_space",- "html4excel_true",- "html4excel_false",- "layout_recognize_DeepDOC",- "layout_recognize_navie",- "tag_kb_ids",- "topn_tags_min",- "topn_tags_mid",- "topn_tags_max",- "filename_embd_weight_min",- "filename_embd_weight_mid",- "filename_embd_weight_max",- "task_page_size_min",- "task_page_size_None",- "pages",- "pages_none",- "graphrag_true",- "graphrag_false",- "graphrag_entity_types",- "graphrag_method_general",- "graphrag_method_light",- "graphrag_community_true",- "graphrag_community_false",- "graphrag_resolution_true",- "graphrag_resolution_false",- "raptor_true",- "raptor_false",- "raptor_prompt",- "raptor_max_token_min",- "raptor_max_token_mid",- "raptor_max_token_max",- "raptor_clustering_threshold_min",- "raptor_clustering_threshold_mid",- "raptor_clustering_threshold_max",- "raptor_max_cluster_min",- "raptor_max_cluster_mid",- "raptor_max_cluster_max",- "raptor_random_seed_min",- ],-)-def test_dataset_update_parser_config_valid_matrix_contract(rest_client, clear_datasets, name, parser_config):- create_res = rest_client.post("/datasets", json={"name": f"dataset_update_parser_{name}"})- assert create_res.status_code == 200- create_payload = create_res.json()- assert create_payload["code"] == 0, create_payload- dataset_id = create_payload["data"]["id"]-- if IS_GO_PROXY:- pytest.skip("Go does not accept legacy flat parser_config")- update_res = rest_client.put(- f"/datasets/{dataset_id}",- json={"parser_config": parser_config},- )- assert update_res.status_code == 200- update_payload = update_res.json()- assert update_payload["code"] == 0, update_payload-- list_res = rest_client.get("/datasets", params={"id": dataset_id})- assert list_res.status_code == 200- list_payload = list_res.json()- assert list_payload["code"] == 0, list_payload- actual_parser_config = list_payload["data"][0]["parser_config"]- for key, expected_value in parser_config.items():- if key in {"graphrag", "raptor"}:- assert key not in actual_parser_config, list_payload- continue- if isinstance(expected_value, dict):- for nested_key, nested_expected in expected_value.items():- assert actual_parser_config[key][nested_key] == nested_expected, list_payload- else:- assert actual_parser_config[key] == expected_value, list_payload--@pytest.mark.p3@pytest.mark.parametrize("name, update_payload",@@ -411,19 +262,10 @@ def test_dataset_update_parser_config_with_chunk_method_change_contract(rest_cliassert list_res.status_code == 200list_body = list_res.json()assert list_body["code"] == 0, list_body- expected_parser_config = {- "raptor": {"use_raptor": False},- "graphrag": {"use_graphrag": False},- "image_context_size": 0,- "table_context_size": 0,- }actual_parser_config = list_body["data"][0]["parser_config"]- if IS_GO_PROXY:- assert isinstance(actual_parser_config, dict) and actual_parser_config, list_body- assert "raptor" not in actual_parser_config, list_body- assert "graphrag" not in actual_parser_config, list_body- else:- assert actual_parser_config == expected_parser_config, list_body+ assert isinstance(actual_parser_config, dict) and actual_parser_config, list_body+ assert "raptor" not in actual_parser_config, list_body+ assert "graphrag" not in actual_parser_config, list_body@pytest.mark.p1@@ -481,8 +323,6 @@ def test_dataset_update_embedding_model_format_contract(rest_client, clear_datas)assert update_res.status_code == 200update_payload = update_res.json()- if IS_GO_PROXY and update_payload.get("code") == 0:- pytest.skip("Go dataset update accepts an invalid empty embedding model")assert update_payload["code"] == ARGUMENT_ERROR_CODE, update_payloadassert expected_fragment in update_payload["message"], update_payload@@ -731,7 +571,7 @@ def test_dataset_update_identifier_validation_contract(rest_client):@pytest.mark.p2-def test_dataset_update_avatar_invalid_and_none_contract(rest_client, clear_datasets, tmp_path):+def test_dataset_update_avatar_invalid_contract(rest_client, clear_datasets, tmp_path):create_res = rest_client.post("/datasets", json={"name": "dataset_update_avatar_invalid_contract"})assert create_res.status_code == 200create_payload = create_res.json()@@ -763,22 +603,10 @@ def test_dataset_update_avatar_invalid_and_none_contract(rest_client, clear_dataassert res.status_code == 200payload = res.json()assert payload["code"] == ARGUMENT_ERROR_CODE, payload- if IS_GO_PROXY and expected_message.startswith("Unsupported MIME type"):+ if expected_message.startswith("Unsupported MIME type"):expected_message = "unsupported MIME type. Allowed: [image/jpeg image/png]"assert expected_message in payload["message"], payload- none_res = rest_client.put(f"/datasets/{dataset_id}", json={"avatar": None})- assert none_res.status_code == 200- none_payload = none_res.json()- _skip_go_ignored_null(none_payload, "avatar")- assert none_payload["code"] == 0, none_payload-- list_res = rest_client.get("/datasets", params={"id": dataset_id})- assert list_res.status_code == 200- list_payload = list_res.json()- assert list_payload["code"] == 0, list_payload- assert list_payload["data"][0]["avatar"] is None, list_payload-@pytest.mark.p2def test_dataset_update_description_validation_contract(rest_client, clear_datasets):@@ -797,19 +625,6 @@ def test_dataset_update_description_validation_contract(rest_client, clear_datasassert exceeds_limit_payload["code"] == ARGUMENT_ERROR_CODE, exceeds_limit_payloadassert "String should have at most 65535 characters" in exceeds_limit_payload["message"], exceeds_limit_payload- none_res = rest_client.put(f"/datasets/{dataset_id}", json={"description": None})- assert none_res.status_code == 200- none_payload = none_res.json()- if IS_GO_PROXY and none_payload.get("message") == "no properties were modified":- pytest.skip("Go dataset update does not clear description with an explicit null")- assert none_payload["code"] == 0, none_payload-- list_res = rest_client.get("/datasets", params={"id": dataset_id})- assert list_res.status_code == 200- list_payload = list_res.json()- assert list_payload["code"] == 0, list_payload- assert list_payload["data"][0]["description"] is None, list_payload-@pytest.mark.p2def test_dataset_update_name_invalid_and_duplicate_contract(rest_client, clear_datasets):@@ -829,15 +644,13 @@ def test_dataset_update_name_invalid_and_duplicate_contract(rest_client, clear_d(" ", "String should have at least 1 character"),("a" * (DATASET_NAME_LIMIT + 1), f"String should have at most {DATASET_NAME_LIMIT} characters"),(0, "Input should be a valid string"),- (None, "Input should be a valid string"),]for name, expected_message in invalid_cases:res = rest_client.put(f"/datasets/{first_dataset_id}", json={"name": name})assert res.status_code == 200payload = res.json()- _skip_go_ignored_null(payload, "name")assert payload["code"] == ARGUMENT_ERROR_CODE, payload- if IS_GO_PROXY and not isinstance(name, str):+ if not isinstance(name, str):assert "cannot unmarshal" in payload["message"] and ".name" in payload["message"], payloadelse:assert expected_message in payload["message"], payload@@ -853,7 +666,7 @@ def test_dataset_update_name_invalid_and_duplicate_contract(rest_client, clear_d@pytest.mark.p2-def test_dataset_update_embedding_model_invalid_and_none_contract(rest_client, clear_datasets):+def test_dataset_update_embedding_model_invalid_contract(rest_client, clear_datasets):create_res = rest_client.post("/datasets", json={"name": "dataset_update_embedding_invalid_contract"})assert create_res.status_code == 200create_payload = create_res.json()@@ -866,7 +679,7 @@ def test_dataset_update_embedding_model_invalid_and_none_contract(rest_client, c("text-embedding-v3@Tongyi-Qianwen", "Provider Tongyi-Qianwen not found for model text-embedding-v3@Tongyi-Qianwen."),("text-embedding-3-small@OpenAI", "Provider OpenAI not found for model text-embedding-3-small@OpenAI."),]- for embedding_model, expected_message in invalid_cases:+ for embedding_model, _ in invalid_cases:res = rest_client.put(f"/datasets/{dataset_id}",json={"embedding_model": embedding_model},@@ -874,26 +687,11 @@ def test_dataset_update_embedding_model_invalid_and_none_contract(rest_client, cassert res.status_code == 200payload = res.json()assert payload["code"] == 102, payload- if IS_GO_PROXY:- assert "lookup failed: record not found" in payload["message"], payload- else:- assert payload["message"] == expected_message, payload-- none_res = rest_client.put(f"/datasets/{dataset_id}", json={"embedding_model": None})- assert none_res.status_code == 200- none_payload = none_res.json()- _skip_go_ignored_null(none_payload, "embedding_model")- assert none_payload["code"] == 0, none_payload-- list_res = rest_client.get("/datasets", params={"id": dataset_id})- assert list_res.status_code == 200- list_payload = list_res.json()- assert list_payload["code"] == 0, list_payload- assert list_payload["data"][0]["embedding_model"].startswith("BAAI/bge-small-en-v1.5"), list_payload+ assert "lookup failed: record not found" in payload["message"], payload@pytest.mark.p2-def test_dataset_update_permission_invalid_and_none_contract(rest_client, clear_datasets):+def test_dataset_update_permission_invalid_contract(rest_client, clear_datasets):create_res = rest_client.post("/datasets", json={"name": "dataset_update_permission_invalid_contract"})assert create_res.status_code == 200create_payload = create_res.json()@@ -906,18 +704,11 @@ def test_dataset_update_permission_invalid_and_none_contract(rest_client, clear_assert res.status_code == 200payload = res.json()assert payload["code"] == ARGUMENT_ERROR_CODE, payload- if IS_GO_PROXY and not isinstance(permission, str):+ if not isinstance(permission, str):assert "cannot unmarshal" in payload["message"] and ".permission" in payload["message"], payloadelse:assert "Input should be 'me' or 'team'" in payload["message"], payload- none_res = rest_client.put(f"/datasets/{dataset_id}", json={"permission": None})- assert none_res.status_code == 200- none_payload = none_res.json()- _skip_go_ignored_null(none_payload, "permission")- assert none_payload["code"] == ARGUMENT_ERROR_CODE, none_payload- assert "Input should be 'me' or 'team'" in none_payload["message"], none_payload-@pytest.mark.p2def test_dataset_update_chunk_method_invalid_contract(rest_client, clear_datasets):@@ -927,54 +718,17 @@ def test_dataset_update_chunk_method_invalid_contract(rest_client, clear_datasetassert create_payload["code"] == 0, create_payloaddataset_id = create_payload["data"]["id"]- expected_chunk_message = "Input should be 'naive', 'book', 'email', 'laws', 'manual', 'one', 'paper', 'picture', 'presentation', 'qa', 'table', 'tag' or 'resume'"for chunk_method in ("", "unknown", []):res = rest_client.put(f"/datasets/{dataset_id}", json=_parser_id_fields(chunk_method))assert res.status_code == 200payload = res.json()assert payload["code"] == ARGUMENT_ERROR_CODE, payload- if IS_GO_PROXY and not isinstance(chunk_method, str):+ if not isinstance(chunk_method, str):assert "cannot unmarshal" in payload["message"] and f".{PARSER_ID_FIELD}" in payload["message"], payload- elif IS_GO_PROXY and chunk_method == "":+ elif chunk_method == "":assert payload["message"] == "parser_id is required when parse_type is BuiltIn", payload- elif IS_GO_PROXY:- assert payload["message"].startswith("input should be 'general', 'qa'") and payload["message"].endswith("or 'email'"), payloadelse:- assert expected_chunk_message in payload["message"], payload-- none_res = rest_client.put(f"/datasets/{dataset_id}", json={PARSER_ID_FIELD: None})- assert none_res.status_code == 200- none_payload = none_res.json()- _skip_go_ignored_null(none_payload, PARSER_ID_FIELD)- assert none_payload["code"] == ARGUMENT_ERROR_CODE, none_payload- if IS_GO_PROXY:- assert none_payload["message"].startswith("input should be 'general', 'qa'") and none_payload["message"].endswith("or 'email'"), none_payload- else:- assert expected_chunk_message in none_payload["message"], none_payload---def test_dataset_update_pagerank_invalid_and_none_contract(rest_client, clear_datasets):- create_res = rest_client.post("/datasets", json={"name": "dataset_update_pagerank_invalid_contract"})- assert create_res.status_code == 200- create_payload = create_res.json()- assert create_payload["code"] == 0, create_payload- dataset_id = create_payload["data"]["id"]-- for pagerank, expected_message in ((-1, "Input should be greater than or equal to 0"), (101, "Input should be less than or equal to 100")):- res = rest_client.put(f"/datasets/{dataset_id}", json={"pagerank": pagerank})- assert res.status_code == 200- payload = res.json()- assert payload["code"] == ARGUMENT_ERROR_CODE, payload- if IS_GO_PROXY and pagerank == -1 and "less than or equal to 100" in payload["message"]:- pytest.skip("Go dataset update applies the wrong pagerank bound error for negative values")- assert expected_message in payload["message"], payload-- none_res = rest_client.put(f"/datasets/{dataset_id}", json={"pagerank": None})- assert none_res.status_code == 200- none_payload = none_res.json()- assert none_payload["code"] == ARGUMENT_ERROR_CODE, none_payload- assert "Input should be a valid integer" in none_payload["message"], none_payload+ assert payload["message"].startswith("input should be 'general', 'qa'") and payload["message"].endswith("or 'email'"), payload@pytest.mark.p2@@ -1000,87 +754,9 @@ def test_dataset_update_parser_config_defaults_contract(rest_client, clear_dataslist_payload = list_res.json()assert list_payload["code"] == 0, list_payloadparser_config = list_payload["data"][0]["parser_config"]- if IS_GO_PROXY:- assert isinstance(parser_config, dict) and parser_config, list_payload- assert "raptor" not in parser_config, list_payload- assert "graphrag" not in parser_config, list_payload- else:- assert parser_config == DEFAULT_PARSER_CONFIG, list_payload---def test_dataset_update_parser_config_invalid_contract(rest_client, clear_datasets):- create_res = rest_client.post("/datasets", json={"name": "dataset_update_parser_invalid_contract"})- assert create_res.status_code == 200- create_payload = create_res.json()- assert create_payload["code"] == 0, create_payload- dataset_id = create_payload["data"]["id"]-- invalid_cases = [- ({"auto_keywords": -1}, "Input should be greater than or equal to 0"),- ({"auto_keywords": 33}, "Input should be less than or equal to 32"),- ({"auto_keywords": 3.14}, "Input should be a valid integer"),- ({"auto_keywords": "string"}, "Input should be a valid integer"),- ({"auto_questions": -1}, "Input should be greater than or equal to 0"),- ({"auto_questions": 11}, "Input should be less than or equal to 10"),- ({"auto_questions": 3.14}, "Input should be a valid integer"),- ({"auto_questions": "string"}, "Input should be a valid integer"),- ({"chunk_token_num": 0}, "Input should be greater than or equal to 1"),- ({"chunk_token_num": 2049}, "Input should be less than or equal to 2048"),- ({"chunk_token_num": 3.14}, "Input should be a valid integer"),- ({"chunk_token_num": "string"}, "Input should be a valid integer"),- ({"delimiter": ""}, "String should have at least 1 character"),- ({"html4excel": "string"}, "Input should be a valid boolean"),- ({"tag_kb_ids": "1,2"}, "Input should be a valid list"),- ({"tag_kb_ids": [1, 2]}, "Input should be a valid string"),- ({"topn_tags": 0}, "Input should be greater than or equal to 1"),- ({"topn_tags": 11}, "Input should be less than or equal to 10"),- ({"topn_tags": 3.14}, "Input should be a valid integer"),- ({"topn_tags": "string"}, "Input should be a valid integer"),- ({"filename_embd_weight": -1}, "Input should be greater than or equal to 0"),- ({"filename_embd_weight": 1.1}, "Input should be less than or equal to 1"),- ({"filename_embd_weight": "string"}, "Input should be a valid number"),- ({"task_page_size": 0}, "Input should be greater than or equal to 1"),- ({"task_page_size": 3.14}, "Input should be a valid integer"),- ({"task_page_size": "string"}, "Input should be a valid integer"),- ({"pages": "1,2"}, "Input should be a valid list"),- ({"pages": ["1,2"]}, "Input should be a valid list"),- ({"pages": [["string1", "string2"]]}, "Input should be a valid integer"),- ({"graphrag": {"use_graphrag": "string"}}, "Input should be a valid boolean"),- ({"graphrag": {"entity_types": "1,2"}}, "Input should be a valid list"),- ({"graphrag": {"entity_types": [1, 2]}}, "nput should be a valid string"),- ({"graphrag": {"method": "unknown"}}, "Input should be 'light', 'general' or 'ner'"),- ({"graphrag": {"method": None}}, "Input should be 'light', 'general' or 'ner'"),- ({"graphrag": {"community": "string"}}, "Input should be a valid boolean"),- ({"graphrag": {"resolution": "string"}}, "Input should be a valid boolean"),- ({"raptor": {"use_raptor": "string"}}, "Input should be a valid boolean"),- ({"raptor": {"prompt": ""}}, "String should have at least 1 character"),- ({"raptor": {"prompt": " "}}, "String should have at least 1 character"),- ({"raptor": {"max_token": 2049}}, "Input should be less than or equal to 2048"),- ({"raptor": {"max_token": "string"}}, "Input should be a valid integer"),- ({"raptor": {"clustering_threshold": -0.1}}, "Input should be greater than or equal to 0"),- ({"raptor": {"clustering_threshold": 1.1}}, "Input should be less than or equal to 1"),- ({"raptor": {"clustering_threshold": "string"}}, "Input should be a valid number"),- ({"raptor": {"max_cluster": 0}}, "Input should be greater than or equal to 1"),- ({"raptor": {"max_cluster": 1025}}, "Input should be less than or equal to 1024"),- ({"raptor": {"max_cluster": 3.14}}, "Input should be a valid integer"),- ({"raptor": {"max_cluster": "string"}}, "Input should be a valid integer"),- ({"raptor": {"random_seed": -1}}, "Input should be greater than or equal to 0"),- ({"raptor": {"random_seed": 3.14}}, "Input should be a valid integer"),- ({"raptor": {"random_seed": "string"}}, "Input should be a valid integer"),- ({"delimiter": "a" * 65536}, "Parser config exceeds size limit (max 65,535 characters)"),- ]- if IS_GO_PROXY:- pytest.skip("Go does not accept legacy flat parser_config")- for parser_config, expected_message in invalid_cases:- res = rest_client.put(- f"/datasets/{dataset_id}",- json={"parser_config": parser_config},- )- assert res.status_code == 200- payload = res.json()- assert payload["code"] == 101, payload- assert expected_message in payload["message"], payload+ assert isinstance(parser_config, dict) and parser_config, list_payload+ assert "raptor" not in parser_config, list_payload+ assert "graphrag" not in parser_config, list_payload@pytest.mark.p3@@ -1223,13 +899,12 @@ def test_dataset_create_name_validation(rest_client, clear_datasets, name, expecassert res.status_code == 200payload = res.json()assert payload["code"] == ARGUMENT_ERROR_CODE, payload- if IS_GO_PROXY:- if not name:- expected_fragment = "failed on the 'required' tag"- elif not name.strip():- expected_fragment = "dataset name can't be empty"- else:- expected_fragment = f"Dataset name length is {len(name)} which is large than {DATASET_NAME_LIMIT}"+ if not name:+ expected_fragment = "failed on the 'required' tag"+ elif not name.strip():+ expected_fragment = "dataset name can't be empty"+ else:+ expected_fragment = f"Dataset name length is {len(name)} which is large than {DATASET_NAME_LIMIT}"assert expected_fragment in payload["message"], payload@@ -1250,24 +925,6 @@ def test_dataset_create_name_and_case_insensitive_contract(rest_client, clear_daassert second_payload["data"]["name"] == f"{name.lower()}(1)", second_payload-def test_dataset_create_avatar_and_description_contract(rest_client, clear_datasets):- if IS_GO_PROXY:- pytest.skip("Go CreateDataset does not accept avatar/description")- avatar = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/w8AAgMBgN6J1tQAAAAASUVORK5CYII="- payload = {- "name": "dataset_avatar_description",- "avatar": avatar,- "description": "description",- }- res = rest_client.post("/datasets", json=payload)- assert res.status_code == 200- body = res.json()- assert body["code"] == 0, body- assert body["data"]["avatar"] == avatar, body- assert body["data"]["description"] == "description", body--@pytest.mark.p2@pytest.mark.parametrize("name, chunk_method",@@ -1358,10 +1015,7 @@ def test_dataset_create_embedding_model_contract(rest_client, clear_datasets, naelse:assert payload["data"]["embedding_model"] == expected_embedding_model, payloadif expected_message is not None:- if IS_GO_PROXY:- assert "lookup failed: record not found" in payload["message"], payload- else:- assert payload["message"] == expected_message, payload+ assert "lookup failed: record not found" in payload["message"], payload@pytest.mark.p2@@ -1386,27 +1040,6 @@ def test_dataset_create_embedding_model_format_contract(rest_client, clear_datasassert expected_fragment in payload["message"], payload-def test_dataset_create_parser_config_missing_raptor_and_graphrag(rest_client, clear_datasets):- if IS_GO_PROXY:- pytest.skip("Go CreateDataset does not accept legacy flat parser_config")- payload = {- "name": "test_parser_config_missing_fields",- "parser_config": {"chunk_token_num": 1024},- }- res = rest_client.post("/datasets", json=payload)- assert res.status_code == 200- body = res.json()- assert body["code"] == 0, body- parser_config = body["data"]["parser_config"]- if IS_GO_PROXY:- _assert_go_pipeline_parser_config(parser_config)- else:- assert "raptor" not in parser_config, body- assert "graphrag" not in parser_config, body- assert parser_config["chunk_token_num"] == 1024, body--@pytest.mark.p3def test_dataset_create_1k_contract(rest_client, clear_datasets):for i in range(1_000):@@ -1430,202 +1063,6 @@ def test_dataset_create_concurrent_contract(rest_client, clear_datasets):assert payload["code"] == 0, (index, payload)- "name, parser_config",- [- ("auto_keywords_min", {"auto_keywords": 0}),- ("auto_keywords_mid", {"auto_keywords": 16}),- ("auto_keywords_max", {"auto_keywords": 32}),- ("auto_questions_min", {"auto_questions": 0}),- ("auto_questions_mid", {"auto_questions": 5}),- ("auto_questions_max", {"auto_questions": 10}),- ("chunk_token_num_min", {"chunk_token_num": 1}),- ("chunk_token_num_mid", {"chunk_token_num": 1024}),- ("chunk_token_num_max", {"chunk_token_num": 2048}),- ("delimiter", {"delimiter": "\n"}),- ("delimiter_space", {"delimiter": " "}),- ("html4excel_true", {"html4excel": True}),- ("html4excel_false", {"html4excel": False}),- ("layout_recognize_DeepDOC", {"layout_recognize": "DeepDOC"}),- ("layout_recognize_navie", {"layout_recognize": "Plain Text"}),- ("tag_kb_ids", {"tag_kb_ids": ["1", "2"]}),- ("topn_tags_min", {"topn_tags": 1}),- ("topn_tags_mid", {"topn_tags": 5}),- ("topn_tags_max", {"topn_tags": 10}),- ("filename_embd_weight_min", {"filename_embd_weight": 0.1}),- ("filename_embd_weight_mid", {"filename_embd_weight": 0.5}),- ("filename_embd_weight_max", {"filename_embd_weight": 1.0}),- ("task_page_size_min", {"task_page_size": 1}),- ("task_page_size_None", {"task_page_size": None}),- ("pages", {"pages": [[1, 100]]}),- ("pages_none", {"pages": None}),- ("graphrag_true", {"graphrag": {"use_graphrag": True}}),- ("graphrag_false", {"graphrag": {"use_graphrag": False}}),- ("graphrag_entity_types", {"graphrag": {"entity_types": ["age", "sex", "height", "weight"]}}),- ("graphrag_method_general", {"graphrag": {"method": "general"}}),- ("graphrag_method_light", {"graphrag": {"method": "light"}}),- ("graphrag_community_true", {"graphrag": {"community": True}}),- ("graphrag_community_false", {"graphrag": {"community": False}}),- ("graphrag_resolution_true", {"graphrag": {"resolution": True}}),- ("graphrag_resolution_false", {"graphrag": {"resolution": False}}),- ("raptor_true", {"raptor": {"use_raptor": True}}),- ("raptor_false", {"raptor": {"use_raptor": False}}),- ("raptor_prompt", {"raptor": {"prompt": "Who are you?"}}),- ("raptor_max_token_min", {"raptor": {"max_token": 512}}),- ("raptor_max_token_mid", {"raptor": {"max_token": 1024}}),- ("raptor_max_token_max", {"raptor": {"max_token": 2048}}),- ("raptor_clustering_threshold_min", {"raptor": {"clustering_threshold": 0.0}}),- ("raptor_clustering_threshold_mid", {"raptor": {"clustering_threshold": 0.5}}),- ("raptor_clustering_threshold_max", {"raptor": {"clustering_threshold": 1.0}}),- ("raptor_max_cluster_min", {"raptor": {"max_cluster": 1}}),- ("raptor_max_cluster_mid", {"raptor": {"max_cluster": 512}}),- ("raptor_max_cluster_max", {"raptor": {"max_cluster": 1024}}),- ("raptor_random_seed_min", {"raptor": {"random_seed": 0}}),- ("parent_child_true", {"parent_child": {"use_parent_child": True}}),- ("parent_child_false", {"parent_child": {"use_parent_child": False}}),- ("parent_child_delimiter", {"parent_child": {"children_delimiter": "\n\n"}}),- ("parent_child_delimiter_custom", {"parent_child": {"use_parent_child": True, "children_delimiter": "。"}}),- ],- ids=[- "auto_keywords_min",- "auto_keywords_mid",- "auto_keywords_max",- "auto_questions_min",- "auto_questions_mid",- "auto_questions_max",- "chunk_token_num_min",- "chunk_token_num_mid",- "chunk_token_num_max",- "delimiter",- "delimiter_space",- "html4excel_true",- "html4excel_false",- "layout_recognize_DeepDOC",- "layout_recognize_navie",- "tag_kb_ids",- "topn_tags_min",- "topn_tags_mid",- "topn_tags_max",- "filename_embd_weight_min",- "filename_embd_weight_mid",- "filename_embd_weight_max",- "task_page_size_min",- "task_page_size_None",- "pages",- "pages_none",- "graphrag_true",- "graphrag_false",- "graphrag_entity_types",- "graphrag_method_general",- "graphrag_method_light",- "graphrag_community_true",- "graphrag_community_false",- "graphrag_resolution_true",- "graphrag_resolution_false",- "raptor_true",- "raptor_false",- "raptor_prompt",- "raptor_max_token_min",- "raptor_max_token_mid",- "raptor_max_token_max",- "raptor_clustering_threshold_min",- "raptor_clustering_threshold_mid",- "raptor_clustering_threshold_max",- "raptor_max_cluster_min",- "raptor_max_cluster_mid",- "raptor_max_cluster_max",- "raptor_random_seed_min",- "parent_child_true",- "parent_child_false",- "parent_child_delimiter",- "parent_child_delimiter_custom",- ],-)-def test_dataset_create_parser_config_valid_matrix_contract(rest_client, clear_datasets, name, parser_config):- if IS_GO_PROXY:- pytest.skip("Go CreateDataset does not accept legacy flat parser_config")- payload = {"name": name, "parser_config": parser_config}- res = rest_client.post("/datasets", json=payload)- assert res.status_code == 200- body = res.json()- assert body["code"] == 0, body- actual_parser_config = body["data"]["parser_config"]- for key, expected_value in parser_config.items():- if key in {"graphrag", "raptor"}:- assert key not in actual_parser_config, body- continue- if isinstance(expected_value, dict):- for nested_key, nested_expected in expected_value.items():- assert actual_parser_config[key][nested_key] == nested_expected, body- else:- assert actual_parser_config[key] == expected_value, body--- "name, parser_config",- [- ("test_parser_config_only_raptor", {"chunk_token_num": 1024, "raptor": {"use_raptor": True}}),- ("test_parser_config_only_graphrag", {"chunk_token_num": 1024, "graphrag": {"use_graphrag": True}}),- (- "test_parser_config_both_fields",- {"chunk_token_num": 1024, "raptor": {"use_raptor": True}, "graphrag": {"use_graphrag": True}},- ),- ],- ids=["only_raptor", "only_graphrag", "both_fields"],-)-def test_dataset_create_parser_config_bugfix_contract(rest_client, clear_datasets, name, parser_config):- if IS_GO_PROXY:- pytest.skip("Go CreateDataset does not accept legacy flat parser_config")- res = rest_client.post("/datasets", json={"name": name, "parser_config": parser_config})- assert res.status_code == 200- body = res.json()- assert body["code"] == 0, body- actual_parser_config = body["data"]["parser_config"]- if IS_GO_PROXY:- _assert_go_pipeline_parser_config(actual_parser_config)- else:- assert "raptor" not in actual_parser_config, body- assert "graphrag" not in actual_parser_config, body- assert actual_parser_config["chunk_token_num"] == 1024, body--- "chunk_method",- ["qa", "manual", "paper", "book", "laws", "presentation"],- ids=["qa", "manual", "paper", "book", "laws", "presentation"],-)-def test_dataset_create_parser_config_different_chunk_methods_contract(rest_client, clear_datasets, chunk_method):- if IS_GO_PROXY:- pytest.skip("Go CreateDataset does not accept legacy flat parser_config")- payload = {- "name": f"test_parser_config_{chunk_method}",- PARSER_ID_FIELD: chunk_method,- "parser_config": {"chunk_token_num": 512},- }- res = rest_client.post("/datasets", json=payload)- assert res.status_code == 200- body = res.json()- assert body["code"] == 0, body- parser_config = body["data"]["parser_config"]- if IS_GO_PROXY:- chunker_prefix = {- "qa": "QAChunker:",- "manual": "ManualChunker:",- "paper": "TitleChunker:",- "book": "TitleChunker:",- "laws": "TitleChunker:",- "presentation": "PageChunker:",- }[chunk_method]- _assert_go_pipeline_parser_config(parser_config, chunker_prefix)- else:- assert parser_config["chunk_token_num"] == 512, body- assert "raptor" not in parser_config, body- assert "graphrag" not in parser_config, body--def test_dataset_create_name_invalid_and_duplicate_contract(rest_client, clear_datasets):invalid_cases = [("", "String should have at least 1 character"),@@ -1679,78 +1116,6 @@ def test_dataset_create_content_type_and_payload_bad_contract(rest_client):assert "Invalid request payload: expected object, got str" in invalid_payload_type_payload["message"], invalid_payload_type_payload-def test_dataset_create_avatar_contract(rest_client, clear_datasets, tmp_path):- if IS_GO_PROXY:- pytest.skip("Go CreateDataset does not accept avatar/description")- exceed_res = rest_client.post(- "/datasets",- json={"name": "avatar_exceeds_limit_length", "avatar": "a" * 65536},- )- assert exceed_res.status_code == 200- exceed_payload = exceed_res.json()- assert exceed_payload["code"] == ARGUMENT_ERROR_CODE, exceed_payload- assert "String should have at most 65535 characters" in exceed_payload["message"], exceed_payload-- image_path = create_image_file(tmp_path / "ragflow_test.png")- encoded_avatar = encode_avatar(image_path)- invalid_prefix_cases = [- ("empty_prefix", "", "missing MIME prefix. Expected format: data:<mime>;base64,<data>"),- ("missing_comma", "data:image/png;base64", "missing MIME prefix. Expected format: data:<mime>;base64,<data>"),- ("unsupported_mine_type", "invalid_mine_prefix:image/png;base64,", "invalid MIME prefix format. Must start with 'data:'"),- ("invalid_mine_type", "data:unsupported_mine_type;base64,", "Unsupported MIME type. Allowed: ['image/jpeg', 'image/png']"),- ]- for name, prefix, expected_message in invalid_prefix_cases:- res = rest_client.post(- "/datasets",- json={"name": name, "avatar": f"{prefix}{encoded_avatar}"},- )- assert res.status_code == 200- payload = res.json()- assert payload["code"] == ARGUMENT_ERROR_CODE, payload- if IS_GO_PROXY and expected_message.startswith("Unsupported MIME type"):- expected_message = "unsupported MIME type. Allowed: [image/jpeg image/png]"- assert expected_message in payload["message"], payload-- unset_res = rest_client.post("/datasets", json={"name": "avatar_unset"})- assert unset_res.status_code == 200- unset_payload = unset_res.json()- assert unset_payload["code"] == 0, unset_payload- assert unset_payload["data"].get("avatar") is None, unset_payload-- none_res = rest_client.post("/datasets", json={"name": "avatar_none", "avatar": None})- assert none_res.status_code == 200- none_payload = none_res.json()- assert none_payload["code"] == 0, none_payload- assert none_payload["data"].get("avatar") is None, none_payload---def test_dataset_create_description_contract(rest_client, clear_datasets):- if IS_GO_PROXY:- pytest.skip("Go CreateDataset does not accept avatar/description")- exceeds_limit_res = rest_client.post(- "/datasets",- json={"name": "description_exceeds_limit_length", "description": "a" * 65536},- )- assert exceeds_limit_res.status_code == 200- exceeds_limit_payload = exceeds_limit_res.json()- assert exceeds_limit_payload["code"] == ARGUMENT_ERROR_CODE, exceeds_limit_payload- assert "String should have at most 65535 characters" in exceeds_limit_payload["message"], exceeds_limit_payload-- unset_res = rest_client.post("/datasets", json={"name": "description_unset"})- assert unset_res.status_code == 200- unset_payload = unset_res.json()- assert unset_payload["code"] == 0, unset_payload- assert unset_payload["data"].get("description") is None, unset_payload-- none_res = rest_client.post("/datasets", json={"name": "description_none", "description": None})- assert none_res.status_code == 200- none_payload = none_res.json()- assert none_payload["code"] == 0, none_payload- assert none_payload["data"].get("description") is None, none_payload--@pytest.mark.p2def test_dataset_create_permission_and_chunk_method_contract(rest_client, clear_datasets):permission_invalid_cases = [@@ -1766,19 +1131,11 @@ def test_dataset_create_permission_and_chunk_method_contract(rest_client, clear_assert res.status_code == 200payload = res.json()assert payload["code"] == ARGUMENT_ERROR_CODE, payload- if IS_GO_PROXY and not isinstance(permission, str):+ if not isinstance(permission, str):assert "cannot unmarshal" in payload["message"] and ".permission" in payload["message"], payloadelse:assert "Input should be 'me' or 'team'" in payload["message"], payload- permission_none_res = rest_client.post("/datasets", json={"name": "permission_none", "permission": None})- assert permission_none_res.status_code == 200- permission_none_payload = permission_none_res.json()- if IS_GO_PROXY and permission_none_payload.get("code") == 0:- pytest.skip("Go dataset create accepts a null permission as the default")- assert permission_none_payload["code"] == ARGUMENT_ERROR_CODE, permission_none_payload- assert "Input should be 'me' or 'team'" in permission_none_payload["message"], permission_none_payload-permission_unset_res = rest_client.post("/datasets", json={"name": "permission_unset"})assert permission_unset_res.status_code == 200permission_unset_payload = permission_unset_res.json()@@ -1790,29 +1147,23 @@ def test_dataset_create_permission_and_chunk_method_contract(rest_client, clear_("chunk_unknown", "unknown"),("chunk_type_error", []),]- expected_chunk_message = "Input should be 'naive', 'book', 'email', 'laws', 'manual', 'one', 'paper', 'picture', 'presentation', 'qa', 'table', 'tag' or 'resume'"for name, chunk_method in chunk_method_invalid_cases:res = rest_client.post("/datasets", json={"name": name, **_parser_id_fields(chunk_method)})assert res.status_code == 200payload = res.json()assert payload["code"] == ARGUMENT_ERROR_CODE, payload- if IS_GO_PROXY and not isinstance(chunk_method, str):+ if not isinstance(chunk_method, str):assert "cannot unmarshal" in payload["message"] and f".{PARSER_ID_FIELD}" in payload["message"], payload- elif IS_GO_PROXY and chunk_method == "":+ elif chunk_method == "":assert payload["message"] == "parser_id is required when parse_type is BuiltIn", payload- elif IS_GO_PROXY:- assert payload["message"].startswith("input should be 'general', 'qa'") and payload["message"].endswith("or 'email'"), payloadelse:- assert expected_chunk_message in payload["message"], payload+ assert payload["message"].startswith("input should be 'general', 'qa'") and payload["message"].endswith("or 'email'"), payloadchunk_method_none_res = rest_client.post("/datasets", json={"name": "chunk_method_none", **_parser_id_fields(None)})assert chunk_method_none_res.status_code == 200chunk_method_none_payload = chunk_method_none_res.json()assert chunk_method_none_payload["code"] == ARGUMENT_ERROR_CODE, chunk_method_none_payload- if IS_GO_PROXY:- assert chunk_method_none_payload["message"] == "parser_id is required when parse_type is BuiltIn", chunk_method_none_payload- else:- assert expected_chunk_message in chunk_method_none_payload["message"], chunk_method_none_payload+ assert chunk_method_none_payload["message"] == "parser_id is required when parse_type is BuiltIn", chunk_method_none_payloadchunk_method_unset_res = rest_client.post("/datasets", json={"name": "chunk_method_unset"})assert chunk_method_unset_res.status_code == 200@@ -1821,74 +1172,6 @@ def test_dataset_create_permission_and_chunk_method_contract(rest_client, clear_assert chunk_method_unset_payload["data"][PARSER_ID_FIELD] == _expected_chunk_method("naive"), chunk_method_unset_payload-def test_dataset_create_parser_config_invalid_contract(rest_client, clear_datasets):- if IS_GO_PROXY:- pytest.skip("Go CreateDataset does not accept legacy flat parser_config")- invalid_cases = [- ("auto_keywords_min_limit", {"auto_keywords": -1}, "Input should be greater than or equal to 0"),- ("auto_keywords_max_limit", {"auto_keywords": 33}, "Input should be less than or equal to 32"),- ("auto_keywords_float_not_allowed", {"auto_keywords": 3.14}, "Input should be a valid integer"),- ("auto_keywords_type_invalid", {"auto_keywords": "string"}, "Input should be a valid integer"),- ("auto_questions_min_limit", {"auto_questions": -1}, "Input should be greater than or equal to 0"),- ("auto_questions_max_limit", {"auto_questions": 11}, "Input should be less than or equal to 10"),- ("auto_questions_float_not_allowed", {"auto_questions": 3.14}, "Input should be a valid integer"),- ("auto_questions_type_invalid", {"auto_questions": "string"}, "Input should be a valid integer"),- ("chunk_token_num_min_limit", {"chunk_token_num": 0}, "Input should be greater than or equal to 1"),- ("chunk_token_num_max_limit", {"chunk_token_num": 2049}, "Input should be less than or equal to 2048"),- ("chunk_token_num_float_not_allowed", {"chunk_token_num": 3.14}, "Input should be a valid integer"),- ("chunk_token_num_type_invalid", {"chunk_token_num": "string"}, "Input should be a valid integer"),- ("delimiter_empty", {"delimiter": ""}, "String should have at least 1 character"),- ("html4excel_type_invalid", {"html4excel": "string"}, "Input should be a valid boolean"),- ("tag_kb_ids_not_list", {"tag_kb_ids": "1,2"}, "Input should be a valid list"),- ("tag_kb_ids_int_in_list", {"tag_kb_ids": [1, 2]}, "Input should be a valid string"),- ("topn_tags_min_limit", {"topn_tags": 0}, "Input should be greater than or equal to 1"),- ("topn_tags_max_limit", {"topn_tags": 11}, "Input should be less than or equal to 10"),- ("topn_tags_float_not_allowed", {"topn_tags": 3.14}, "Input should be a valid integer"),- ("topn_tags_type_invalid", {"topn_tags": "string"}, "Input should be a valid integer"),- ("filename_embd_weight_min_limit", {"filename_embd_weight": -1}, "Input should be greater than or equal to 0"),- ("filename_embd_weight_max_limit", {"filename_embd_weight": 1.1}, "Input should be less than or equal to 1"),- ("filename_embd_weight_type_invalid", {"filename_embd_weight": "string"}, "Input should be a valid number"),- ("task_page_size_min_limit", {"task_page_size": 0}, "Input should be greater than or equal to 1"),- ("task_page_size_float_not_allowed", {"task_page_size": 3.14}, "Input should be a valid integer"),- ("task_page_size_type_invalid", {"task_page_size": "string"}, "Input should be a valid integer"),- ("pages_not_list", {"pages": "1,2"}, "Input should be a valid list"),- ("pages_not_list_in_list", {"pages": ["1,2"]}, "Input should be a valid list"),- ("pages_not_int_list", {"pages": [["string1", "string2"]]}, "Input should be a valid integer"),- ("graphrag_type_invalid", {"graphrag": {"use_graphrag": "string"}}, "Input should be a valid boolean"),- ("graphrag_entity_types_not_list", {"graphrag": {"entity_types": "1,2"}}, "Input should be a valid list"),- ("graphrag_entity_types_not_str_in_list", {"graphrag": {"entity_types": [1, 2]}}, "nput should be a valid string"),- ("graphrag_method_unknown", {"graphrag": {"method": "unknown"}}, "Input should be 'light', 'general' or 'ner'"),- ("graphrag_method_none", {"graphrag": {"method": None}}, "Input should be 'light', 'general' or 'ner'"),- ("graphrag_community_type_invalid", {"graphrag": {"community": "string"}}, "Input should be a valid boolean"),- ("graphrag_resolution_type_invalid", {"graphrag": {"resolution": "string"}}, "Input should be a valid boolean"),- ("raptor_type_invalid", {"raptor": {"use_raptor": "string"}}, "Input should be a valid boolean"),- ("raptor_prompt_empty", {"raptor": {"prompt": ""}}, "String should have at least 1 character"),- ("raptor_prompt_space", {"raptor": {"prompt": " "}}, "String should have at least 1 character"),- ("raptor_max_token_max_limit", {"raptor": {"max_token": 2049}}, "Input should be less than or equal to 2048"),- ("raptor_max_token_type_invalid", {"raptor": {"max_token": "string"}}, "Input should be a valid integer"),- ("raptor_clustering_threshold_min_limit", {"raptor": {"clustering_threshold": -0.1}}, "Input should be greater than or equal to 0"),- ("raptor_clustering_threshold_max_limit", {"raptor": {"clustering_threshold": 1.1}}, "Input should be less than or equal to 1"),- ("raptor_clustering_threshold_type_invalid", {"raptor": {"clustering_threshold": "string"}}, "Input should be a valid number"),- ("raptor_max_cluster_min_limit", {"raptor": {"max_cluster": 0}}, "Input should be greater than or equal to 1"),- ("raptor_max_cluster_max_limit", {"raptor": {"max_cluster": 1025}}, "Input should be less than or equal to 1024"),- ("raptor_max_cluster_float_not_allowed", {"raptor": {"max_cluster": 3.14}}, "Input should be a valid integer"),- ("raptor_max_cluster_type_invalid", {"raptor": {"max_cluster": "string"}}, "Input should be a valid integer"),- ("raptor_random_seed_min_limit", {"raptor": {"random_seed": -1}}, "Input should be greater than or equal to 0"),- ("raptor_random_seed_float_not_allowed", {"raptor": {"random_seed": 3.14}}, "Input should be a valid integer"),- ("raptor_random_seed_type_invalid", {"raptor": {"random_seed": "string"}}, "Input should be a valid integer"),- ("parser_config_type_invalid", {"delimiter": "a" * 65536}, "Parser config exceeds size limit (max 65,535 characters)"),- ("parent_child_type_invalid", {"parent_child": {"use_parent_child": "string"}}, "Input should be a valid boolean"),- ("parent_child_delimiter_empty", {"parent_child": {"children_delimiter": ""}}, "String should have at least 1 character"),- ]- for name, parser_config, expected_message in invalid_cases:- res = rest_client.post("/datasets", json={"name": name, "parser_config": parser_config})- assert res.status_code == 200- payload = res.json()- assert payload["code"] == 101, payload- assert expected_message in payload["message"], payload--@pytest.mark.p2def test_dataset_create_parser_config_defaults_and_extra_fields_contract(rest_client, clear_datasets):empty_res = rest_client.post("/datasets", json={"name": "parser_config_empty", "parser_config": {}})@@ -1910,11 +1193,7 @@ def test_dataset_create_parser_config_defaults_and_extra_fields_contract(rest_clunset_parser_config = unset_payload["data"]["parser_config"]none_parser_config = none_payload["data"]["parser_config"]assert empty_parser_config == unset_parser_config == none_parser_config- if IS_GO_PROXY:- _assert_go_pipeline_parser_config(empty_parser_config)- else:- for key in DEFAULT_PARSER_CONFIG:- assert key in empty_parser_config, empty_payload+ _assert_go_pipeline_parser_config(empty_parser_config)unsupported_field_payloads = [{"name": "id", "id": "id"},@@ -2410,7 +1689,7 @@ def test_dataset_metadata_config_get_and_update_contract(rest_client, create_datassert success_res.status_code == 200success_payload = success_res.json()assert success_payload["code"] == 0, success_payload- expected_empty = {"enabled": False, "metadata": [], "built_in_metadata": []} if IS_GO_PROXY else {"metadata": [], "built_in_metadata": []}+ expected_empty = {"enabled": False, "metadata": [], "built_in_metadata": []}assert success_payload["data"] == expected_empty, success_payloadfor scenario_name, client in (("missing token", RestClient(token=None)), ("invalid token", RestClient(token=INVALID_API_TOKEN))):@@ -2451,11 +1730,10 @@ def test_dataset_metadata_config_get_and_update_contract(rest_client, create_dat{"key": "size", "type": "number", "description": "File size", "enum": None},],}- if IS_GO_PROXY:- # Go keeps the dataset-level metadata.enabled flag: it is not derived- # from whether fields are present, so a fresh dataset (flag disabled)- # stays disabled until enabled explicitly.- normalized_update_payload["enabled"] = False+ # Go keeps the dataset-level metadata.enabled flag: it is not derived+ # from whether fields are present, so a fresh dataset (flag disabled)+ # stays disabled until enabled explicitly.+ normalized_update_payload["enabled"] = Falseupdate_res = rest_client.put(f"/datasets/{dataset_id}/metadata/config", json=update_payload)assert update_res.status_code == 200update_body = update_res.json()@@ -2593,8 +1871,8 @@ def test_dataset_tags_and_aggregation(rest_client, create_dataset):dataset_id = create_dataset("dataset_tags")second_dataset_id = create_dataset("dataset_tags_second")- # The aggregation route is served by both backends, so it is asserted- # before the backend-specific tag list contract below.+ # The aggregation route is asserted before the per-dataset tag routes,+ # which the Go API does not serve.aggregate_res = rest_client.get("/datasets/tags/aggregation",params={"dataset_ids": f"{dataset_id},{second_dataset_id}"},@@ -2608,73 +1886,24 @@ def test_dataset_tags_and_aggregation(rest_client, create_dataset):empty_aggregate_payload = empty_aggregate_res.json()assert empty_aggregate_payload["code"] != 0, empty_aggregate_payload- if IS_GO_PROXY:- # Go keeps no tag dataset, so the per-dataset tag routes are not served- # at all; tagging is driven by the dataset's tag source file and only- # the aggregation route survives. Assert the contract that replaced the- # old 200 responses instead of the route's payload.- assert rest_client.get(f"/datasets/{dataset_id}/tags").status_code == 404- assert rest_client.get("/datasets/invalid_id/tags").status_code == 404- return-- list_tags_res = rest_client.get(f"/datasets/{dataset_id}/tags")- assert list_tags_res.status_code == 200- list_tags_payload = list_tags_res.json()- # Known env/runtime behavior: this route can return 102 when retriever tag- # backend is unavailable for an empty dataset. Keep route-contract coverage.- assert list_tags_payload["code"] in (0, 102), list_tags_payload- if list_tags_payload["code"] == 0:- assert isinstance(list_tags_payload["data"], list), list_tags_payload-- invalid_list_tags_res = rest_client.get("/datasets/invalid_id/tags")- assert invalid_list_tags_res.status_code == 200- invalid_list_tags_payload = invalid_list_tags_res.json()- assert invalid_list_tags_payload["code"] != 0, invalid_list_tags_payload+ # Go keeps no tag dataset, so the per-dataset tag routes are not served+ # at all; tagging is driven by the dataset's tag source file and only+ # the aggregation route survives. The 404s below replace the old 200+ # responses.+ assert rest_client.get(f"/datasets/{dataset_id}/tags").status_code == 404+ assert rest_client.get("/datasets/invalid_id/tags").status_code == 404@pytest.mark.p2def test_dataset_tags_delete_and_rename_validation(rest_client, create_dataset):dataset_id = create_dataset("dataset_tag_mutation")- if IS_GO_PROXY:- # Same removal as above: with no tag dataset there is nothing to rename- # or delete, so both the validation cases and the invalid-dataset cases- # are now unrouted instead of argument errors.- for url in (f"/datasets/{dataset_id}/tags", "/datasets/invalid_id/tags"):- assert rest_client.delete(url, json={"tags": ["tag1"]}).status_code == 404- assert rest_client.put(url, json={"from_tag": "old", "to_tag": "new"}).status_code == 404- return-- delete_missing_tags = rest_client.delete(f"/datasets/{dataset_id}/tags", json={})- assert delete_missing_tags.status_code == 200- delete_missing_tags_payload = delete_missing_tags.json()- assert delete_missing_tags_payload["code"] != 0, delete_missing_tags_payload-- delete_invalid_tags_type = rest_client.delete(f"/datasets/{dataset_id}/tags", json={"tags": "wrong"})- assert delete_invalid_tags_type.status_code == 200- delete_invalid_tags_type_payload = delete_invalid_tags_type.json()- assert delete_invalid_tags_type_payload["code"] != 0, delete_invalid_tags_type_payload-- delete_invalid_dataset_tags = rest_client.delete("/datasets/invalid_id/tags", json={"tags": ["tag1"]})- assert delete_invalid_dataset_tags.status_code == 200- delete_invalid_dataset_tags_payload = delete_invalid_dataset_tags.json()- assert delete_invalid_dataset_tags_payload["code"] != 0, delete_invalid_dataset_tags_payload-- rename_empty = rest_client.put(- f"/datasets/{dataset_id}/tags",- json={"from_tag": "", "to_tag": ""},- )- assert rename_empty.status_code == 200- rename_empty_payload = rename_empty.json()- assert rename_empty_payload["code"] != 0, rename_empty_payload-- rename_invalid_dataset = rest_client.put(- "/datasets/invalid_id/tags",- json={"from_tag": "old", "to_tag": "new"},- )- assert rename_invalid_dataset.status_code == 200- rename_invalid_dataset_payload = rename_invalid_dataset.json()- assert rename_invalid_dataset_payload["code"] != 0, rename_invalid_dataset_payload+ # With no tag dataset there is nothing to rename or delete, so both the+ # validation cases and the invalid-dataset cases are unrouted instead of+ # argument errors.+ for url in (f"/datasets/{dataset_id}/tags", "/datasets/invalid_id/tags"):+ assert rest_client.delete(url, json={"tags": ["tag1"]}).status_code == 404+ assert rest_client.put(url, json={"from_tag": "old", "to_tag": "new"}).status_code == 404@pytest.mark.p2diff --git a/test/testcases/restful_api/test_document_raw_routes.py b/test/testcases/restful_api/test_document_raw_routes.pyindex a4c7d48c66..454251c04f 100644--- a/test/testcases/restful_api/test_document_raw_routes.py+++ b/test/testcases/restful_api/test_document_raw_routes.py@@ -16,7 +16,7 @@import pytest-from test.testcases.configs import INVALID_API_TOKEN, IS_GO_PROXY+from test.testcases.configs import INVALID_API_TOKENfrom test.testcases.restful_api.helpers.assertions import assert_auth_errorfrom test.testcases.restful_api.helpers.client import RestClient@@ -41,14 +41,10 @@ def test_document_image_invalid_id_contract(rest_client):)def test_private_document_images_require_auth(rest_client_noauth, path):res = rest_client_noauth.get(path)- if IS_GO_PROXY:- assert res.status_code == 200, res.text- payload = res.json()- assert payload["code"] == 102, payload- assert payload["message"] == "Authorization is not valid!", payload- return- assert res.status_code == 401, res.text- assert_auth_error(res.json(), "missing token")+ assert res.status_code == 200, res.text+ payload = res.json()+ assert payload["code"] == 102, payload+ assert payload["message"] == "Authorization is not valid!", payload@pytest.mark.p2diff --git a/test/testcases/restful_api/test_documents.py b/test/testcases/restful_api/test_documents.pyindex f1a6a36c1d..9d87fbbb3e 100644--- a/test/testcases/restful_api/test_documents.py+++ b/test/testcases/restful_api/test_documents.py@@ -27,7 +27,7 @@ from requests_toolbelt import MultipartEncoderfrom utils import wait_forfrom utils.file_utils import create_txt_file-from test.testcases.configs import DEFAULT_PARSER_CONFIG, DOCUMENT_NAME_LIMIT, HOST_ADDRESS, INVALID_API_TOKEN, INVALID_ID_32, IS_GO_PROXY, VERSION+from test.testcases.configs import DOCUMENT_NAME_LIMIT, HOST_ADDRESS, INVALID_API_TOKEN, INVALID_ID_32, VERSIONfrom test.testcases.restful_api.helpers.assertions import assert_auth_errorfrom test.testcases.restful_api.helpers.client import RestClientfrom test.testcases.utils import compare_by_hash@@ -492,7 +492,7 @@ def test_documents_upload_error_contract(rest_client, create_dataset, tmp_path):assert filename_empty_res.status_code == 200filename_empty_payload = filename_empty_res.json()assert filename_empty_payload["code"] == 101, filename_empty_payload- expected_message = "No file part!" if IS_GO_PROXY else "No file selected!"+ expected_message = "No file part!"assert filename_empty_payload["message"] == expected_message, filename_empty_payload@@ -821,28 +821,11 @@ def test_documents_update_parser_config_contract(rest_client, create_dataset, tmlist_body = list_res.json()assert list_body["code"] == 0, (parser_config, list_body)doc_parser_config = list_body["data"]["docs"][0]["parser_config"]- if IS_GO_PROXY:- assert isinstance(doc_parser_config, dict) and doc_parser_config, (parser_config, list_body)- assert "raptor" not in doc_parser_config, (parser_config, list_body)- assert "graphrag" not in doc_parser_config, (parser_config, list_body)- continue- if parser_config == {}:- assert doc_parser_config == DEFAULT_PARSER_CONFIG, (parser_config, list_body)- else:- for key, value in parser_config.items():- if key in {"graphrag", "raptor"}:- assert key not in doc_parser_config, (parser_config, list_body)- continue- if isinstance(value, dict):- for sub_key, sub_value in value.items():- assert doc_parser_config[key][sub_key] == sub_value, (parser_config, list_body)- else:- assert doc_parser_config[key] == value, (parser_config, list_body)+ assert isinstance(doc_parser_config, dict) and doc_parser_config, (parser_config, list_body)+ assert "raptor" not in doc_parser_config, (parser_config, list_body)+ assert "graphrag" not in doc_parser_config, (parser_config, list_body)else:- if IS_GO_PROXY:- assert body["message"] in expected_message, (parser_config, body)- else:- assert body["message"] == expected_message, (parser_config, body)+ assert body["message"] in expected_message, (parser_config, body)@pytest.mark.p2@@ -1045,12 +1028,9 @@ def test_document_metadata_config_contract(rest_client, create_document):update_body = update_res.json()assert update_body["code"] == 0, update_bodyparser_config = update_body["data"]["parser_config"]- if IS_GO_PROXY:- # Go scopes metadata onto the Extractor node rather than a flat key.- scoped = parser_config.get("Extractor:AutoExtractDefault", {})- assert scoped.get("metadata") == update_payload["metadata"], update_body- else:- assert parser_config["metadata"] == update_payload["metadata"], update_body+ # Go scopes metadata onto the Extractor node rather than a flat key.+ scoped = parser_config.get("Extractor:AutoExtractDefault", {})+ assert scoped.get("metadata") == update_payload["metadata"], update_body@pytest.mark.p2diff --git a/test/testcases/restful_api/test_memories_messages.py b/test/testcases/restful_api/test_memories_messages.pyindex d5acf0c8d7..69bde501f6 100644--- a/test/testcases/restful_api/test_memories_messages.py+++ b/test/testcases/restful_api/test_memories_messages.py@@ -19,8 +19,6 @@ import uuidimport pytest-from test.testcases.configs import IS_GO_PROXY-@pytest.fixturedef memory_cleanup(rest_client):@@ -130,7 +128,7 @@ def test_memory_create_missing_required_fields(rest_client):res = rest_client.post("/memories", json={"name": "missing_models", "memory_type": ["raw"]})assert res.status_code == 200payload = res.json()- assert payload["code"] == (400 if IS_GO_PROXY else 101), payload+ assert payload["code"] == 400, payload@pytest.mark.p1diff --git a/test/testcases/restful_api/test_openai_compatible.py b/test/testcases/restful_api/test_openai_compatible.pyindex 0f1ba0497a..d411f3bba1 100644--- a/test/testcases/restful_api/test_openai_compatible.py+++ b/test/testcases/restful_api/test_openai_compatible.py@@ -18,15 +18,13 @@ import jsonimport pytest-from test.testcases.configs import IS_GO_PROXY-def _sse_events(response_text: str) -> list[str]:return [line[5:] for line in response_text.splitlines() if line.startswith("data:")]def skip_if_go_proxy_upstream_error(choice_message: dict) -> None:- if IS_GO_PROXY and choice_message.get("reference") is None and choice_message.get("content", "").startswith("**ERROR**"):+ if choice_message.get("reference") is None and choice_message.get("content", "").startswith("**ERROR**"):pytest.skip("Go OpenAI-compatible completion could not reach the configured chat model")@@ -96,7 +94,7 @@ def test_openai_compatible_metadata_condition_requires_object(rest_client, creat)assert res.status_code == 200payload = res.json()- assert payload["code"] == (101 if IS_GO_PROXY else 102), payload+ assert payload["code"] == 101, payloadassert "metadata_condition must be an object." in payload["message"], payload@@ -113,7 +111,7 @@ def test_openai_compatible_invalid_chat(rest_client):assert res.status_code == 200payload = res.json()assert payload["code"] != 0, payload- expected_message = "no authorization" if IS_GO_PROXY else "don't own the chat"+ expected_message = "no authorization"assert expected_message in payload["message"], payloaddiff --git a/test/testcases/restful_api/test_searches.py b/test/testcases/restful_api/test_searches.pyindex afed81e328..4310c1352e 100644--- a/test/testcases/restful_api/test_searches.py+++ b/test/testcases/restful_api/test_searches.py@@ -18,8 +18,6 @@ import uuidimport pytest-from test.testcases.configs import IS_GO_PROXY-@pytest.fixturedef search_resource(rest_client):@@ -107,7 +105,7 @@ def test_search_update_invalid_search_id(rest_client):@pytest.mark.p2def test_search_completion_requires_question(rest_client, search_resource):search_id = search_resource- expected_message = "question is required" if IS_GO_PROXY else "required argument are missing: question"+ expected_message = "question is required"completion_res = rest_client.post(f"/searches/{search_id}/completion", json={})assert completion_res.status_code == 200diff --git a/test/testcases/restful_api/test_sessions.py b/test/testcases/restful_api/test_sessions.pyindex 4feec4a7a9..1fe55bd147 100644--- a/test/testcases/restful_api/test_sessions.py+++ b/test/testcases/restful_api/test_sessions.py@@ -19,7 +19,7 @@ from concurrent.futures import ThreadPoolExecutorimport pytest-from test.testcases.configs import INVALID_API_TOKEN, INVALID_ID_32, IS_GO_PROXY, SESSION_WITH_CHAT_NAME_LIMIT+from test.testcases.configs import INVALID_API_TOKEN, INVALID_ID_32, SESSION_WITH_CHAT_NAME_LIMITfrom test.testcases.restful_api.helpers.assertions import assert_auth_errorfrom test.testcases.restful_api.helpers.client import RestClientfrom test.testcases.utils import is_sorted@@ -423,7 +423,7 @@ def test_session_list_page_and_sort_contract(rest_client, create_chat):("page negative", {"page": -1, "page_size": 2}, 0, 2, ""),("page alpha", {"page": "a", "page_size": 2}, 0, 2, ""),("page_size none", {"page_size": None}, 0, 5, ""),- ("page_size zero", {"page_size": 0}, 0, 0 if IS_GO_PROXY else 5, ""),+ ("page_size zero", {"page_size": 0}, 0, 0, ""),("page_size one", {"page_size": 1}, 0, 1, ""),("page_size six", {"page_size": 6}, 0, 5, ""),("page_size negative", {"page_size": -1}, 0, 5, ""),@@ -587,7 +587,7 @@ def test_chat_recommendation_requires_question(rest_client):assert res.status_code == 200payload = res.json()assert payload["code"] == 101, payload- expected_message = "question is required" if IS_GO_PROXY else "required argument are missing: question"+ expected_message = "question is required"assert expected_message in payload["message"], payload@@ -601,16 +601,8 @@ def test_related_questions_compatibility_requires_auth(rest_client_noauth):)assert res.status_code == 200payload = res.json()- if IS_GO_PROXY:- assert payload["code"] == 102, payload- assert payload["message"] == "Authorization is not valid!", payload- else:- assert payload["code"] == 102, payload- assert payload["message"].strip() in {- "Authorization is not valid!",- 'Authentication error: API key is invalid!"',- "Authentication error: API key is invalid!",- }, payload+ assert payload["code"] == 102, payload+ assert payload["message"] == "Authorization is not valid!", payload@pytest.mark.p2