Skip to content

fix(portfolio-import): 保留粘贴导入空列的位置 - #121

Merged
helsome merged 3 commits into
helsome:mainfrom
wxrbyte:codex/fix-paste-empty-columns
Sep 20, 2026
Merged

helsome merged 3 commits into
helsome:mainfrom
wxrbyte:codex/fix-paste-empty-columns

Conversation

@wxrbyte

@wxrbyte wxrbyte commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

问题与修复

粘贴 AAPL.US,100, 时,空列被过滤掉,原本的数量 100 被写成成本 100。中间空列会进一步导致成本、币种错位,缺少首列时还会把数量当作股票代码。

本 PR 保留逗号分隔字段的原始位置,将空白单元格映射为 undefined,使已有缺失字段提示和草稿代码检查生效。空格分隔格式及已有两列 symbol-cost 简写保持兼容。

Closes #120

验证范围

  • 尾部成本空列、空白数量列、空白成本列、缺失股票代码、两个数值列同时缺失。
  • 两列简写 AAPL.US,180.5 保持原有语义。
  • 粘贴 → 草稿审核 → 确认保存 → 新 repository 实例重新加载,持仓数量和成本保持正确位置。
  • 缺失首列股票代码时,草稿可识别代码检查仍返回 false。

无可见 UI 布局/样式/文案变化;仅修复导入解析及原有审核规则的输入,未修改 UI 文件。

可复现测试报告

环境:Windows 11(10.0.26200)/ Bun 1.4.2(744846f84),基于 main 8d0ac3a

bun test packages/shared/src/portfolio-import
→ 新增回归测试、修复前:66 pass / 7 fail
→ 修复后:73 pass / 0 fail,187 expect() calls

bun test packages/shared --isolate
→ 945 pass / 0 fail,3667 expect() calls,86 files

bun run typecheck
→ core / i18n / shared / ui / electron 全部 exit 0

git diff --check
→ exit 0

工作区测试在具有现有测试所需临时目录写权限的环境执行,无跳过项。未执行全仓 unit suite 或桌面 E2E;核心数据边界由持久化集成测试覆盖。

范围

本 PR 从 main 独立创建,不包含、不依赖 PR #119;两者分别修复字段位置丢失和格式字符被误解析成零的问题。不改变数值校验规则,也不自动改写历史持仓。

2026-09-20 类型检查修复复验

补齐 experiment-service.ts 配置应用失败返回值的 runtimeUnusable: false。此时尚未启动运行任务,因此不应标记运行时不可用。该主分支遗漏也是旧版 CI 的 TS2741 根因。本 PR 增加此最小修复以解除检查阻塞(与在审 #122 对此字段的修正一致,无需引入其余改动)。无可见 UI 变化。

环境:Windows / Bun 1.4.2。实际执行:

  • bun run typecheck:core / i18n / shared / ui / electron 全部退出码 0。
  • bun test packages/shared --isolate:

1003 pass
0 fail
3971 expect() calls
Ran 1003 tests across 91 files. [29.64s]

  • git diff --check:通过。

上述结果替代此前测试报告中类型检查失败的状态;远端检查以本次提交的 CI 为准。未额外运行桌面 E2E。

@helsome helsome left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

通过。保留逗号分隔输入的空列位置,修复数量/成本/币种错位,且保持既有两列 symbol-cost 简写。解析、缺失 symbol 审核、真实 draft→文件保存→新 repository 重载覆盖了核心数据边界;Bun/OS、73/0 focused、945/0 shared、typecheck 的报告足够,无需模型/Provider 或截图。#119 已先合入,两项不是竞争实现;如 GitHub 发现测试文件/import 冲突,只需保留两边回归测试后解决冲突、复跑 portfolio-import + 基础 CI,不要求扩大范围。

@wxrbyte

wxrbyte commented Sep 19, 2026

Copy link
Copy Markdown
Contributor Author

已按审核意见合并最新 main ff3ed3d,保留本 PR 和已合并 #119 的全部回归测试,解决测试文件及 import 冲突。

2026-09-19 验证(Windows 11 / Bun 1.4.2):

  • bun test packages/shared/src/portfolio-import:78 pass / 0 fail,218 expect() calls。
  • git diff --check:通过。
  • bun run typecheck:core/ui 通过;shared/i18n/electron 报同一个 TS2741:experiment-service.ts:534 的配置失败分支缺少 runtimeUnusable 字段。已核对 origin/main 相同代码,非本 PR 引入;在审 PR fix(eval): separate live execution validity from quality and propagat… #122 已包含 runtimeUnusable: false 修复,故未重复改动。

仅解决文本冲突,不扩大本 PR 范围。

@helsome helsome left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

复核当前 head 5e003516809c85df4c6bd8dc7abe957c83aea041:空列位置修复、缺失 symbol 拦截和真实临时存储重载测试均保持原验收范围;额外的 runtimeUnusable: false 与当前 main #142 已一致,不构成新的行为改动。#132 已作为重复实现关闭,因此继续采用更早的 #121

@helsome
helsome merged commit 7f2fb5b into helsome:main Sep 20, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Portfolio Import] 粘贴导入删除空列导致数量、成本和币种错位

2 participants