From bc5e5db7efd6488e05c2ee594784e8c0b451bebc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=89=E6=BE=9C?= Date: Mon, 17 Aug 2026 21:46:42 +0800 Subject: [PATCH] test(skills): pin publish identity rejection through the identity seam The physical same-content swap relied on the recreated destination getting a fresh inode, but CI runners' ext4/overlayfs recycle inodes eagerly, so the swap was undetectable on Linux and the subtest failed there (while passing on macOS). Swap the same-file identity seam instead so the confirmation's fast-path rejection contract is pinned on every platform. --- internal/upgrade/skill_publication_test.go | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/internal/upgrade/skill_publication_test.go b/internal/upgrade/skill_publication_test.go index 93833949..ad443f44 100644 --- a/internal/upgrade/skill_publication_test.go +++ b/internal/upgrade/skill_publication_test.go @@ -182,18 +182,14 @@ func TestCrossPlatformCoverageSkillPublicationFailureEdges(t *testing.T) { staged := filepath.Join(root, "staged") destination := filepath.Join(root, "destination") seedUpgradeSkill(t, staged, "value", false) - originalRename := skillPathRenameNoReplace - testseam.Swap(t, &skillPathRenameNoReplace, func(source, target string) error { - if err := originalRename(source, target); err != nil { - return err - } - if err := os.RemoveAll(target); err != nil { - return err - } - // Same content, different object: only the identity check can catch it. - seedUpgradeSkill(t, target, "value", false) - return nil - }) + // A real rename consumed the staged path (fast path), but the object + // at the destination is not the staged one. Whether the swap is + // observable through inode/file-ID comparison depends on the + // filesystem — CI runners' ext4/overlayfs recycle inodes eagerly, so + // reproducing the swap physically is not portable. The confirmation's + // contract under test is its response to a failing identity proof on + // the fast path, which the seam pins down on every platform. + testseam.Swap(t, &skillPathSameFileIdentity, func(_, _ os.FileInfo) bool { return false }) if _, err := PublishSkillPathNoReplace(staged, destination); err == nil || !strings.Contains(err.Error(), "staging 身份已变化") { t.Fatalf("publish identity error = %v", err) }