fix: update core.variables imports to core.workflow.variables after S2 merge

Made-with: Cursor
This commit is contained in:
Novice
2026-03-23 09:05:37 +08:00
parent cccff6768a
commit 66e67caa2b
8 changed files with 127 additions and 21 deletions

View File

@ -4,8 +4,8 @@
| Segment | Target Commit | Commits | Description | Status |
|---------|--------------|---------|-------------|--------|
| 1 | `657eeb65` | 50 | Early changes: deps, Switch组件, 基础重构 | |
| 2 | `9c339239` | 129 | Mid refactors: model_runtime | |
| 1 | `657eeb65` | 50 | Early changes: deps, Switch组件, 基础重构 | |
| 2 | `9c339239` | 129 | Mid refactors: model_runtime, prompt, storage | |
| 3 | `92bde350` | 56 | dify_graph 大迁移 | ⬚ |
| 4 | `fb41b215` | 165 | Post-backend refactors | ⬚ |
| 5 | `main HEAD` | 103 | Final changes | ⬚ |
@ -16,20 +16,37 @@
---
## Segment 1: Early Changes (50 commits → `657eeb65`)
## Segment 1: Early Changes (50 commits → `657eeb65`)
**Started**: <!-- will fill -->
### Conflicts: 33 files
- 2 modify/delete (agent runners → keep deletion)
- 10 backend content (memory, segments, file_manager, agent_node, llm_utils, etc.)
- 19 frontend content (Switch defaultValue→value, UnoCSS icons, data-testid)
- 2 lock files (pyproject.toml, uv.lock → regenerated)
### Merge Command
```bash
git merge 657eeb65
```
### Post-merge fixes
- Fixed `core.file``core.workflow.file` imports (18 files)
- Updated Switch `defaultValue``value` in 5 files
- Updated `ACCOUNT_SETTING_TAB.PROVIDER``SANDBOX_PROVIDER`/`MODEL_PROVIDER`
- Regenerated eslint-suppressions.json, added `--pass-on-unpruned-suppressions`
### Conflicts
<!-- will fill after merge attempt -->
### Test Results: ✅ All passed
### Resolution
<!-- will fill -->
---
### Test Results
<!-- will fill after tests -->
## Segment 2: Mid Refactors (129 commits → `9c339239`) ✅
### Conflicts: 43 files
- 2 modify/delete (agent runners → keep deletion)
- 14 backend content (advanced_chat, prompt, llm node, storage, variable_factory, etc.)
- 22 frontend content (chat components, citation, oauth, account-setting, hitl-input-block)
- 5 lock/config files (pyproject.toml, uv.lock, pnpm-lock, package.json, eslint-suppressions)
### Post-merge fixes
- Rewrote `post-login-redirect.spec.ts` for new in-memory API
- Added `nodeOutputVars` parameter to hitl-input-block tests
- Updated `UpdateWorkflowNodesMapPayload` usage in tests
- Added `enable_collaboration_mode`/`enable_creators_platform` to SystemFeatures mocks
- Fixed `UPDATE_WORKFLOW_NODES_MAP` import path
### Test Results: ⏳ Pending

View File

@ -2,7 +2,7 @@ from __future__ import annotations
from pydantic import BaseModel, ConfigDict, Field
from core.variables.types import SegmentType
from core.workflow.variables.types import SegmentType
class SuggestedQuestionsOutput(BaseModel):

View File

@ -10,7 +10,7 @@ This module provides utilities to:
from collections.abc import Callable, Mapping, Sequence
from typing import Any, cast
from core.variables.segments import ArrayFileSegment, FileSegment
from core.workflow.variables.segments import ArrayFileSegment, FileSegment
from core.workflow.file import File
FILE_PATH_FORMAT = "file-path"

View File

@ -360,7 +360,6 @@ class Node(Generic[NodeDataT]):
if not isinstance(event, NodeRunStreamChunkEvent):
yield event
def run(self) -> Generator[GraphNodeEventBase, None, None]:
execution_id = self.ensure_execution_id()
self._start_at = naive_utc_now()

View File

@ -6,8 +6,8 @@ from pathlib import PurePosixPath
from typing import Any, cast
from core.sandbox.bash.session import SANDBOX_READY_TIMEOUT
from core.variables import ArrayFileSegment
from core.variables.segments import ArrayStringSegment, FileSegment
from core.workflow.variables import ArrayFileSegment
from core.workflow.variables.segments import ArrayStringSegment, FileSegment
from core.virtual_environment.__base.command_future import CommandCancelledError, CommandTimeoutError
from core.virtual_environment.__base.helpers import pipeline
from core.workflow.enums import NodeType, WorkflowNodeExecutionStatus

View File

@ -2183,7 +2183,7 @@ class LLMNode(Node[LLMNodeData]):
def _extract_prompt_files(self, variable_pool: VariablePool) -> list[File]:
"""Extract files from prompt template variables."""
from core.variables import ArrayFileVariable, FileVariable
from core.workflow.variables import ArrayFileVariable, FileVariable
files: list[File] = []

View File

@ -12,7 +12,7 @@ from core.llm_generator.output_parser.file_ref import (
detect_file_path_fields,
is_file_path_property,
)
from core.variables.segments import ArrayFileSegment, FileSegment
from core.workflow.variables.segments import ArrayFileSegment, FileSegment
from core.workflow.file import File, FileTransferMethod, FileType

90
run_tests.sh Executable file
View File

@ -0,0 +1,90 @@
#!/bin/bash
set -e
ROOT_DIR="$(cd "$(dirname "$0")" && pwd)"
cd "$ROOT_DIR"
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m'
usage() {
echo "Usage: $0 [backend|frontend|all]"
echo ""
echo " backend - Run backend unit tests (pytest)"
echo " frontend - Run frontend unit tests (vitest)"
echo " all - Run both (default)"
exit 1
}
run_backend() {
echo -e "${YELLOW}====== Backend Unit Tests ======${NC}"
echo "Start: $(date '+%H:%M:%S')"
uv run --project api pytest api/tests/unit_tests/ \
-q \
--timeout=30 \
--tb=short \
-p no:cacheprovider \
"$@"
local exit_code=$?
echo "End: $(date '+%H:%M:%S')"
if [ $exit_code -eq 0 ]; then
echo -e "${GREEN}✓ Backend tests PASSED${NC}"
else
echo -e "${RED}✗ Backend tests FAILED (exit code: $exit_code)${NC}"
fi
return $exit_code
}
run_frontend() {
echo -e "${YELLOW}====== Frontend Unit Tests ======${NC}"
echo "Start: $(date '+%H:%M:%S')"
cd "$ROOT_DIR/web"
pnpm test -- --run "$@"
local exit_code=$?
cd "$ROOT_DIR"
echo "End: $(date '+%H:%M:%S')"
if [ $exit_code -eq 0 ]; then
echo -e "${GREEN}✓ Frontend tests PASSED${NC}"
else
echo -e "${RED}✗ Frontend tests FAILED (exit code: $exit_code)${NC}"
fi
return $exit_code
}
TARGET="${1:-all}"
shift 2>/dev/null || true
case "$TARGET" in
backend)
run_backend "$@"
;;
frontend)
run_frontend "$@"
;;
all)
backend_ok=0
frontend_ok=0
run_backend "$@" || backend_ok=1
echo ""
run_frontend "$@" || frontend_ok=1
echo ""
echo -e "${YELLOW}====== Summary ======${NC}"
[ $backend_ok -eq 0 ] && echo -e " Backend: ${GREEN}PASSED${NC}" || echo -e " Backend: ${RED}FAILED${NC}"
[ $frontend_ok -eq 0 ] && echo -e " Frontend: ${GREEN}PASSED${NC}" || echo -e " Frontend: ${RED}FAILED${NC}"
[ $backend_ok -eq 0 ] && [ $frontend_ok -eq 0 ] && exit 0 || exit 1
;;
*)
usage
;;
esac