Conversation
importConfirm 的 IMPORT_EMPTY 守卫作用在过滤前的 rows 上,而真正落库的是 过滤掉 issues 后的 holdings:只要草稿有行就一定放行,holdings 为空时也会 创建一条 0 持仓的组合并返回成功。守卫改为作用在落库集合上;ImportDraftReview 的确认按钮同步改为「无可导入行即禁用」。 修复前 20 pass / 2 fail → 修复后 22 pass / 0 fail。 Closes helsome#243
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #243
问题
importConfirm的IMPORT_EMPTY守卫作用在过滤前的rows上,而真正落库的是过滤后的holdings:只要草稿有行守卫就放行;当每一行都还带着
issues时holdings是空数组,于是持久化一条 0 持仓的组合并返回成功。UI 侧同样放行 ——ImportDraftReview的确认按钮只在draft.rows.length === 0时禁用,所以用户在「每行都缺字段」的 CSV 上仍可点击确认,然后拿到一个空组合且没有任何提示。改动
apps/electron/src/main/kernelHost.tsimportable,importable.length === 0即抛IMPORT_EMPTY;holdings由同一个importable映射packages/ui/src/components/portfolio/ImportDraftReview.tsxapps/electron/src/main/kernelHost.test.tsimportConfirm必须 rejectIMPORT_EMPTYpackages/ui/src/components/portfolio/ImportDraftReview.test.tsx原
rows.length === 0分支被新守卫覆盖(空 rows 必然导致空importable),因此没有重复判断。验证
20 pass / 2 failexpect(promise).rejects.toMatchObject({ code: 'IMPORT_EMPTY' })→Received promise that resolved: Promise { <resolved> }disabled→Expected: true, Received: false22 pass / 0 failbun run typecheck:@finagent/core、@finagent/i18n、@finagent/shared、@finagent/ui、@finagent/electron全部Exited with code 0对合法导入(至少一行无 issue)行为完全不变:
holdings仍只包含无 issue 的行,name与仓库层未改动。重叠披露
apps/electron/src/main/kernelHost.ts同时被 5 个 open PR 触及(#97、#64、#56、#53、#4)。已逐个拉取各 PR 的 patch 与改动块标题比对:importConfirm或ImportDraftReview;@@ -2101,6 +2135,9 @@—— 行号与本次改动相邻,但它改的是另一个方法里的env: NodeJS.ProcessEnv构造块(新增FINAGENT_SKILLS_DIRS),与本次改动内容不相交。若上述任一 PR 先合入,本分支按需 rebase。