Commit Graph
91 Commits
Author SHA1 Message Date
tao.chen 02c25fcc8e feat(scripts): listScripts parent_path filter + lazy load by directory
Backend — backend/src/backend/scripts.py
- list_scripts accepts optional parent_path Query (default "").
- Extracts _build_list_scripts_descendant_prefix helper for the
  "direct children of parent_path" prefix.
- WHERE clause now adds:
    StorageObjects.relative_path LIKE '<prefix>/%'
    AND NOT LIKE '<prefix>/%/%'
  so deeper descendants and prefix-siblings (foo/bar vs foo/bar2)
  are excluded. Empty parent_path filters to root-level only —
  this is the symmetric, intent-aligned behavior the lazy-load
  frontend relies on.
- EXPLAIN confirms idx_scripts_workspace drives the scripts table;
  storage_objects PK lookup applies the LIKE filter per row.

Frontend — frontend/app/services/api.ts + scriptWorkspaceStore.ts
- listScripts accepts optional parentPath; built URL preserves
  the new filter param.
- Store gains loadedScriptPaths / loadingScriptPaths Sets and a
  loadScripts(parentPath) action: idempotent, in-flight dedupe,
  dedup-by-id when merging into the flat scripts array so existing
  find() callers keep working.
- load() now uses listScripts("") instead of bulk fetch — root
  only on first paint.
- toggleExpanded() triggers loadScripts(parentPath) in parallel
  with loadChildren(parentPath) so folder expansion loads both
  sub-directories and direct-child scripts.

Tests — backend/tests/test_list_scripts_parent_path.py
- 7 unit tests: prefix construction, normalization, traversal
  rejection, and SQL compilation contract (LIKE prefix + NOT LIKE
  prefix + scripts.status filter).

Verified:
- pytest backend/tests: 50 passed (43 existing + 7 new)
- pnpm typecheck: clean
- alembic: no schema changes (migration-less feature)
- EXPLAIN with real workspace: idx_scripts_workspace → PK lookup
2026-08-21 10:27:40 +08:00
tao.chen 3dc049f46e fix: optimize ArtifactListImpl 2026-08-20 20:29:22 +08:00
tao.chen 05c2157c4a fix: monaco-editor offline build error 2026-08-20 20:22:11 +08:00
tao.chen 3dfa055698 fix: monaco-editor offline build error 2026-08-20 20:16:03 +08:00
tao.chen 6a8bdf6b16 fix: monaco-editor offline 2026-08-20 20:11:06 +08:00
tao.chen d3259ba452 fix: monaco-editor offline 2026-08-20 19:30:23 +08:00
tao.chen 5c15e68a40 Merge branch 'feat/schedule-cleanup-handover' into develop 2026-08-20 19:27:32 +08:00
tao.chen e4d010ec76 fix: monaco-editor offline 2026-08-20 19:23:42 +08:00
Winnie bc62034241 feat: improve schedule cleanup and handover 2026-08-20 19:12:44 +08:00
tao.chen ae3b6d63e2 Merge remote-tracking branch 'aliyun/develop' into develop 2026-08-20 12:08:10 +08:00
tao.chen b600c6810b fix: P0-5 — upload-status rollback, streaming copy (LOCAL only), user re-verify, honest lock
B1: `_mark_upload_failed_and_raise` now commits on a separate session
  - Helper takes `request + upload_id`, opens a fresh session from
    `request.app.state.session_factory` and commits there before raising.
  - Closes the named-lock connection-pool leak Codex flagged: the old
    "commit-on-the-same-session" implementation could return the
    GET_LOCK connection to the pool before the enclosing
    `finally: release_named_lock` ran, leaking `mp:<hash>` for up to
    `pool_recycle` and re-opening the same-key upload race.
  - Same helper now used by `create_server_object_payload`'s put-failure
    branch — two failure paths have identical semantics.

B2: streaming copy for soft-delete + restore (`get_stream() + put()`)
  - LOCAL backend: zero-copy (aiofiles stream write). OOM fixed.
  - S3 backend: still OOMs on multi-GB objects — `put()` materializes
    the async iter via `b"".join(chunks)`. Multipart `put` is a
    follow-up; do NOT claim "OOM fixed on production" since production
    defaults to S3.

C1: worker re-verifies `Users.status='active' AND is_deleted=0`
  - `_assert_user_active` called from `_execution_context` after
    resolving `triggered_by`; skips `SYSTEM_CRON_USER_ID`.
  - `USER_DISABLED` error_code goes into the `NODE_FINISHED_EVENT`
    outbox payload — `schedule_node_runs` has no `error_code` column,
    the row only carries the `message` text. Docstrings corrected to
    say so explicitly (previous docstring falsely promised row-level
    observability).

F1: honest browser-local file lock
  - `api.ts` `acquireFileLock/heartbeatFileLock/releaseFileLock/
    releaseFileLockOnUnload` are now no-ops with comments stating they
    never call the network.
  - `scriptWorkspaceStore` dropped `tickHeartbeats`; `tickCleanup`
    simplified to just clear cache.
  - `useEditSessionLifecycle` dropped its 15s heartbeat `setInterval`.
  - `ScriptWorkspace.tsx` renders `.local-lock-banner` info bar when
    `isEditing`. Two tabs may still silently last-write — banner is the
    only guard (acceptable disclosure-only tradeoff).

Dead code: deleted the duplicate `upload_bytes_to_session` in
`backend/src/backend/storage_api.py`. The `services.storage` import
is now the only source of the function; `create_upload_record`'s
docstring updated to point at `backend.resources`.
2026-08-20 12:07:52 +08:00
tao.chen cc8ac220a5 perf(schedule): 减少重渲染与冗余动画
- useCanvasNodeDrag.moveDrag 改 ref 直改 DOM,松手才写 store,避免拖拽期间反复重渲染 SchedulePage
- runs 轮询改 setTimeout 链式 + 移除 runs 依赖,避免每 1.5s 重建 interval
- SchedulePage 拆 PositionDraftBadge / RunNowButton,删除冗余的 runs/runsLoading/positionDraftCount 订阅
- 拆 ScheduleEdge 组件 + React.memo + useMemo,切换 edge 选中时不再重算所有 edgePath
- 删除 schedule.css 中引用未定义 keyframes 的 modal-in/spin 死动画
- 删除 .schedule-edge-line transition、.schedule-run-result-backdrop backdrop-filter;补 .artifact-card transition

Refs: kaneo #19-#24
2026-08-20 11:27:45 +08:00
Winnie ff700d8db4 fix: stabilize cron scheduling and run history 2026-08-17 18:55:31 +08:00
xiaozhu 23823325e6 fix:writeText不可用问题 2026-08-17 17:31:12 +08:00
tao.chen 2e070fae78 fix: pre check 2026-08-14 19:13:17 +08:00
tao.chen 65d14b8610 update: dir tree 2026-08-14 15:02:55 +08:00
tao.chen 518853cbb0 fix 2026-08-14 12:40:36 +08:00
tao.chen 604e66ffe0 fix: DataResourceUploadModal.tsx 2026-08-14 12:28:22 +08:00
tao.chen 480e1cc638 update: data source 2026-08-14 11:59:06 +08:00
tao.chen 462617b66d feat: datasource 2026-08-13 20:13:37 +08:00
xiaozhu bcddaac083 fix:修复只读文件切换编辑文件时iframe重新加载问题 2026-08-13 17:24:55 +08:00
xiaozhu 9160175d51 update:只读文件隐藏操作按钮 2026-08-13 16:05:16 +08:00
tao.chen 532f0d6c91 fix: dir tree 2026-08-13 12:12:58 +08:00
tao.chen 83d0e0adca fix: bug
1. Cannot find name 'PythonEditorBuffer'
2. Cannot find name 'PythonEditor'
2026-08-13 11:26:31 +08:00
xiaozhu a2f515cf87 fix:锁定文件只读 2026-08-13 10:26:01 +08:00
tao.chen 302bda2ee9 fix: directory tree 2026-08-12 20:45:29 +08:00
tao.chen d600d5dbb1 fix: directory cached 2026-08-12 20:41:44 +08:00
tao.chen 8abe505d17 fix: multi owner 2026-08-12 18:58:18 +08:00
tao.chen c6c2481b96 feat: workspace 目录树服务端懒加载
- api.ts: listWorkspaceDirectories 支持 parent_path 查询; WorkspaceDirectory 增加 has_children; 同步 WorkspaceBoundApi 签名
- AuthContext: 绑定透传 parentPath
- scriptWorkspaceStore: 新增 expandedPaths/loadingChildrenPaths/loadedChildPaths, loadChildren/toggleExpanded, 局部刷新 createFolder/deleteDirectory
- WorkspaceTree: 移除 useState, 改为受控展开/加载状态
- ScriptExplorer: 从 store 读取并透传展开状态与 toggle
2026-08-12 18:06:35 +08:00
tao.chen a09551bd3c update: workspace members 403 2026-08-12 17:14:47 +08:00
tao.chen a86432b102 update: PythonEditor.tsx 2026-08-12 16:58:00 +08:00
xiaozhu e4b8c320a3 fix:css报错 2026-08-12 14:55:09 +08:00
xiaozhu fe65034aa8 feat:脚本只读 2026-08-12 14:34:31 +08:00
tao.chen dc4d190935 fix: python script 404 2026-08-12 13:45:15 +08:00
tao.chen 3981c32781 refactor: directory 2026-08-12 12:23:19 +08:00
tao.chen bff7b7f9a6 fix: bugs 2026-08-11 21:53:52 +08:00
tao.chen dd6f176ca8 fix: file lock 2026-08-11 21:26:55 +08:00
xiaozhu a8a54f1b78 fix:光标 2026-08-11 19:02:22 +08:00
tao.chen e80cbbd81c feat: execute node python version 2026-08-11 19:00:55 +08:00
xiaozhu 064403ad70 fix:新建项目更新项目选项 2026-08-11 18:53:11 +08:00
tao.chen ec9effc254 update: npm registry 2026-08-11 16:19:34 +08:00
tao.chen b44d057241 feat: preview components 2026-08-11 15:02:16 +08:00
xiaozhu 144d931f00 fix:禁工作台跳系统管理 2026-08-10 11:24:04 +08:00
tao.chen b00a0e9ae1 fix: hook 2026-08-07 20:42:36 +08:00
tao.chen 567786215e refactor: SchedulePage.tsx 2026-08-07 20:40:41 +08:00
tao.chen 45808192e0 refactor: SchedulePage.tsx 2026-08-07 19:19:37 +08:00
tao.chen ed517c488b Merge remote-tracking branch 'aliyun/develop' into develop 2026-08-07 18:50:57 +08:00
xiaozhu 646c809c65 feat:菜单 2026-08-07 18:43:10 +08:00
tao.chen 37d89c74d6 Merge remote-tracking branch 'aliyun/develop' into develop 2026-08-07 18:22:08 +08:00
xiaozhu f90d15bbe9 update:系统管理 2026-08-07 18:08:16 +08:00