Skip to content

[WIP] feat: regex correction rules (#1515) - #1522

Draft
HKLHaoBin wants to merge 6 commits into
Open-Less:betafrom
HKLHaoBin:feat/issue-1515-correction-expressions
Draft

HKLHaoBin wants to merge 6 commits into
Open-Less:betafrom
HKLHaoBin:feat/issue-1515-correction-expressions

Conversation

@HKLHaoBin

@HKLHaoBin HKLHaoBin commented Dec 1, 2026 •

Copy link
Copy Markdown
Collaborator

状态

Draft / WIP:仍在开发中。 当前用于让维护者和 Issue 提出者提前查看实现;尚未宣称 CI 全部通过或完成设备测试。

概要

为 Issue #1515 增加可选的正则纠正规则,同时保持已有规则兼容:

  • 新增显式 Regex 模式,不自动把旧规则解释为正则。
  • 支持 Rust regex 的全局、非重叠匹配。
  • 支持 $1、${name} 捕获组替换。
  • 保留旧的字面替换和 {num} 数字通配规则。
  • 在本地保存、云同步、加密同步、Tauri/React、Harmony 和 Linux egui 路径中传递并校验模式。
  • 对模式、替换文本和展开结果设置边界,避免无界分配。
  • 设置界面在异步保存失败时保留可重试草稿,并防止过期成功结果清除新编辑内容。
  • 补充英文、中文帮助文档和对应回归覆盖。

示例:([0-9]+)粒 → $1例,可将 3粒 转换为 3例。

当前候选

  • Base:上游 beta
  • Head:ee5042c48e91150cd352b11c0c582d9dc184f363
  • Fork branch:HKLHaoBin:feat/issue-1515-correction-expressions
  • Worktree:D:/Dev/worktrees/openless/issue-1515-correction-expressions

已完成验证

  • 独立 Hermes review-diff-bugs 审查:针对当前候选 ee5042c48e91150cd352b11c0c582d9dc184f363 返回 no bug found。
  • git diff --check:通过。
  • 分支已推送到用户 fork,远端 head 与当前 SHA 一致。
  • Android APK Actions run 46444957805 与桌面 Actions run 46444932499 attempt 2 属于此前候选,不作为当前 head 的构建证据;当前 head 的 Actions 验证待启动。

当前 CI 状态

CI run 46768224643(head 9cb04771bed1bcd61eccb558136f3f325516df47)已完成但失败,不能作为当前 head 的结论。归档日志显示:

  • test job 的 2 个 Core 测试使用了已被当前 schema v2 占用的版本号 2 作为“非法版本”夹具;已在当前 head ee5042c48e91150cd352b11c0c582d9dc184f363 改为 3,并完成独立审查。
  • UI motion 的 Chromium/WebKit job 失败于 navigation-polish.spec.ts、notifications.spec.ts 等本分支未修改的测试路径;macOS job 另有取消项。
  • 这些失败文件和测试不在 Issue [style] 纠正规则支持正则表达式和动态替换 #1515 的功能改动中;当前 head 的 Actions 需重新执行。

尚未完成

  • Issue [style] 纠正规则支持正则表达式和动态替换 #1515 功能本身的实际设备安装与行为验收:待测试。
  • 当前 head 的 CI、桌面和 Android Actions 运行及产物验证:待启动。
  • 旧 CI 仍未达到全绿;失败集中在与正则规则无关的 beta 基线路径,是否扩大范围由维护者决定。
  • 本地未执行构建、测试或打包;本任务按约定仅通过 GitHub Actions 验证。

请将本 PR 视为 WIP Draft,不要在当前状态下合并。

Refs #1515

Add Rust regex correction mode with capture-group replacements while preserving literal and {num} behavior. Validate rules across local, cloud, and encrypted sync paths, and keep Linux/Tauri/Harmony UI writes retryable.

Refs Open-Less#1515
Preserve the issue Open-Less#1515 correction-rule implementation while integrating the current upstream beta base.

Refs Open-Less#1515
Allow explicit literal modes through local and encrypted-sync lossless validation, fence frontend write errors by generation, and preserve raw Linux drafts across async correction failures.

Refs Open-Less#1515
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.

1 participant