Skip to content

A rule's set values split on the comma a Chinese input method types - #1283

Merged
WaylandYang merged 2 commits into
deeplethe:devfrom
Maya-Kid:fix/rule-set-splits-on-chinese-comma
Oct 16, 2026
Merged

WaylandYang merged 2 commits into
deeplethe:devfrom
Maya-Kid:fix/rule-set-splits-on-chinese-comma

Conversation

@Maya-Kid

Copy link
Copy Markdown
Contributor

A rule condition's set, typed with a Chinese input method, is saved as one member, because parseOperand splits it only on the ASCII comma.

Problem

In Chinese mode the comma key types , (U+FF0C). On dev 15fd7d5, the condition 解释 is one of 气测异常,气测异常后效 is saved as:

["气测异常,气测异常后效"]

No value equals that string, so is one of never holds, and is not one of holds for every entity that has a value. The rule list shows the operand as it was typed, so nothing looks wrong.

Change

  • parseOperand splits in and not_in operands on /[,,]/, as citations.ts does for [1,2]. operandText still joins with , , so a set the form now writes reopens and saves to the same members.

Verification

  • ruleSetOperands.test.ts: splits in members on the comma a Chinese input method types, and the same for not_in, on 气测异常,气测异常后效 (what the editor shows for that rule saved before this change) and 气测异常,气测异常后效, 气层 (the editor writes , back, so editing in Chinese mode mixes both commas). On dev with only the test added, both fail: expected [ '气测异常,气测异常后效' ] to deeply equal [ '气测异常', '气测异常后效' ].
  • Linux x86_64 container, Node 20.20.2, pnpm 10.2.1, at d0eb76a: pnpm test 40 files, 283 tests passed; pnpm build passes.

Limits

  • metadataOnly still locks members containing ,, not , (fix(web): preserve computed definitions during rule metadata edits #829). The next full-form save, even a rename, splits a , member: for a rule saved before this change that is the repair; a , member written through the API is split too.
  • 、 (U+3001) still does not separate members, since labels such as 砂岩、泥岩互层 contain it.
  • ruleOperandSetHint (en "comma separated", zh "逗号分隔") is defined in both locales but never rendered; this PR leaves it alone.

Signed-off-by: dada-yan <BinjunYann@gmail.com>

@WaylandYang WaylandYang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you. Splitting set operands on /[,,]/ matches what citations.ts already does, and since operandText still joins with , , a set the form writes reopens unchanged. Leaving 、 out is right, since labels like 砂岩、泥岩互层 contain it, and not locking , members in metadataOnly lets rules saved before this change repair themselves on the next save. Merging.

@WaylandYang
WaylandYang merged commit e6c75e5 into deeplethe:dev Oct 16, 2026
6 checks passed
@Maya-Kid
Maya-Kid deleted the fix/rule-set-splits-on-chinese-comma branch October 16, 2026 23:29
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.

2 participants