Mapping filters: export and pull disagree on package boundaries, so a pulled deletion can't remove the class

未关闭
#1,014 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
1-2 天
新手友好度
55/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
领域
backend

调研方向

Read the export and reverse mapping logic in Utils.cls around lines 2637 and 2795, then trace how IncrementalLoad.cls handles deletions around line 48. Compare how both paths interpret filters with and without a trailing dot, and reproduce the reported pull deletion. Done means export and reverse mapping agree on package boundaries and a pulled deletion removes the matching class without over-matching neighboring package names.

由索引模型根据 Issue 内容生成。

描述

Summary

Utils.Name() (export) and Utils.NameToInternalName() (reverse mapping, used when a pulled change deletes a file) treat a mapping filter differently:

  • Name() matches the filter as a plain name prefix:
    Utils.cls#L2637
    if ($extract(nam,1,$length(p))=p) && ...
  • NameToInternalName() treats the filter as a package name and appends the . itself:
    Utils.cls#L2795
    $extract($translate(nam, "/", "."), 1, ($length(coverage)+1)) = (coverage_".")

No filter works in both directions:

  • With a trailing dot (MyApp., the only way to make export respect the package boundary), the reverse mapping compares against MyApp.., which never matches. A pulled deletion gets no internal name, and IncrementalLoad prints "was not in the database. Nothing to delete." (IncrementalLoad.cls#L48), while the class stays in IRIS.
  • Without it (MyApp, MyApp.Test), deletions map correctly. But export over-matches: MyApp.TestData.Foo is exported under the MyApp.Test mapping, and MyAppOther.Foo under MyApp. Deleting either on a pull then fails the same way, since the reverse mapping (correctly) doesn't treat them as members of those packages.

Loading isn't affected, because it reads the class name from the file. Only deletions, where the file is gone, depend on the reverse mapping.

Steps to reproduce

  1. Mappings: CLS MyApp. → cls/, CLS MyApp.Test. → test/. Pull event handler: the default (Incremental Load).
  2. Create and compile MyApp.Foo; it's exported to cls/MyApp/Foo.cls. Commit and push.
  3. Delete cls/MyApp/Foo.cls on the remote (in another clone or the web UI), and push.
  4. In IRIS, pull from the Git menu.

Expected: MyApp.Foo is deleted from IRIS.
Actual: cls/MyApp/Foo.cls was not in the database. Nothing to delete., and MyApp.Foo remains.

Environment

git-source-control 2.17.1 on IRIS 2026.3 (preview build). Also verified against main at dfd8441 (2.18.0) (the offending code is the same).

Suggested fix

Make both directions use the same rule. For example, either:

  • treat a filter as a package name in Name() too: match when the name equals the filter or starts with filter + .; or
  • in NameToInternalName(), don't append a . when the filter already ends with one.

Normalising a trailing dot in the filter when settings are saved would also cover existing configurations. Other item types that use the same matching (MAC, INC) may have the same issue; we've only tested CLS.

Workaround

We use filters without the dot (MyApp, MyApp.Test) and forbid names that would over-match: nothing directly under MyApp starting with Test other than the MyApp.Test package, and no package starting with MyApp other than MyApp itself. This isn't a very strong check, though, since it relies solely on the honor system.

主要语言
ObjectScript
星标
22
派生
15
PR 合并指标
30 天内没有已合并 PR

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

intersystems/git-source-control 的其他 Issue

查看 intersystems/git-source-control 的全部 Issue

相似的 Issue

更多 Backend & API Design Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。