alireza0:3x-ui externalProxy 主机同步仍缺少删除前项的回归测试
alireza0 在 3x-ui PR #6831 评论中确认修复方向和多数测试有效,但指出 changedImports 先保留未变条目的步骤没有被测试覆盖;禁用该步骤时整套测试仍通过,并可能在删除 A、保留管理员编辑过的 B 时把 B 的主机重复写入。作者要求补充能让 mutation 失败的回归测试,PR 已合并。
作者原文@alireza0Thanks, the fix is sound and the tests are mostly strong. I mutation-checked them:
- Removing the
UpdateInboundcall turns the retarget, admin-hosts and unchanged-entries tests red.- Dropping the single-row-group check turns
KeepsSharedHostGroupred.- Treating a missing
externalProxykey as an empty list turnsStreamWithoutExternalProxyKeepsImportedHostsred.One gap: the "set unchanged entries aside first" step in
changedImportsis untested. If I disable it (if false && !kept[i] && …), so every old entry counts as gone and pairing falls back to list position, the whole suite stays green. It matters in this case:
- old
externalProxy=[A, B], and the admin edited B's host- new
externalProxy=[B](A removed)With set-aside, B is kept and A's untouched host is deleted, which is correct. With positional pairing, A's host is overwritten with B's content next to the admin's edited B, so B shows up twice in every subscription. Please add a test for this case, or for a similar one such as removing or inserting an entry ahead of an admin-owned host, that fails when the set-aside is disabled.
On your question 1: matching on content is fine. The rule is easy to state: an untouched import follows
externalProxy, anything the admin touched is theirs. A provenance column would need the same content match for its backfill.externalProxyis also legacy now (the form no longer edits it), so it isn't worth a new column and migration.