Skip to content

[216_26] 新增从旧版 .scm 存储向新版 .json 存储的兼容迁移层#3201

Merged
GatsbyUSTC merged 5 commits intomainfrom
hxh/216_25/json
Apr 22, 2026
Merged

[216_26] 新增从旧版 .scm 存储向新版 .json 存储的兼容迁移层#3201
GatsbyUSTC merged 5 commits intomainfrom
hxh/216_25/json

Conversation

@wumoin
Copy link
Copy Markdown
Contributor

@wumoin wumoin commented Apr 22, 2026

No description provided.

@wumoin wumoin linked an issue Apr 22, 2026 that may be closed by this pull request
@wumoin wumoin changed the title [216_25] 新增从旧版 .scm 存储向新版 .json 存储的兼容迁移层 [216_26] 新增从旧版 .scm 存储向新版 .json 存储的兼容迁移层 Apr 22, 2026
@GatsbyUSTC
Copy link
Copy Markdown
Collaborator

发现的问题

  1. 空列表处理边界情况
    legacy-rearrange-old 中的 (apply min (map length l)) 若 l
    为空列表会报错。虽然调用方已做检查,但函数本身防御性不足。
  2. 硬编码版本号
    v1 标记写死在多处,未来若需 v2 迁移需批量修改。
  3. 缺少换行符处理
    shortcut-edit.scm 第 175 行新增代码后无空行,与周围代码风格略有不一致。

建议改进

  1. 增加防御性检查
    (define (legacy-rearrange-old x)
    (with (form . l) x
    (if (null? l)
    (cons form '())
    (let* ((len (apply min (map length l))) ...)
    ...))))
  2. 提取常量
    将 v1 等版本标识提取为模块级常量,便于维护。
  3. 补充单元测试
    迁移逻辑涉及多种边界情况,建议补充自动化测试用例。

@GatsbyUSTC GatsbyUSTC merged commit 248121e into main Apr 22, 2026
@GatsbyUSTC GatsbyUSTC deleted the hxh/216_25/json branch April 22, 2026 09:08
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