magpie icon indicating copy to clipboard operation
magpie copied to clipboard

library: TestPluginUpgradesToNewerTag red on Windows (git tag in '\C:\…\skills.git')

Open yetone opened this issue 1 week ago • 4 comments

Red on Windows (xiaomi-gpu, Windows 11, Go 1.26.8) at origin/main 6d00d98f8, via win-run go test -count=1 -run 'TestPluginUpgradesToNewerTag' ./internal/library. Windows CI only compiles the tests, so it shows nowhere else.

--- FAIL: TestPluginUpgradesToNewerTag (0.88s)
    plugin_tags_test.go:31: git tag v1.0.0: exit status 128
        fatal: not a git repository: '\C:\Users\yeton\AppData\Local\Temp\magpie-library-test-2710577928\TestPluginUpgradesToNewerTag2859188680\003\skills.git'

The leading \ before C: suggests the test builds a git path from a URL-style path (/C:/…) and hands it to git as a Windows path. Seen while verifying the artifacts stack on Windows; not caused by it (same red at origin/main).

yetone avatar Nov 26 '26 03:11 yetone

Fix branch: https://github.com/qq01-hub/magpie/tree/fix/windows-file-url-plugin-tags (52ffe3552) Compare: https://github.com/yetone/magpie/compare/main...qq01-hub:magpie:fix/windows-file-url-plugin-tags

Root cause: gitRepo (internal/library/skillgit_test.go:113-117) returns file:///C:/... on Windows. In TestPluginUpgradesToNewerTag (internal/library/plugin_tags_test.go:24), strings.TrimPrefix(addr, "file://") left /C:/..., which filepath.FromSlash converted into \C:\... and git --git-dir rejected with fatal: not a git repository.

Changes:

  • Strip the leading / before a Windows drive prefix (runtime.GOOS == "windows" && len(bare) > 2 && bare[0] == '/' && bare[2] == ':') in TestPluginUpgradesToNewerTag (internal/library/plugin_tags_test.go), matching internal/fasttools/session.go:84-86.

Verification (Windows 11 amd64, Go 1.26.8):

  • Before fix: TestPluginUpgradesToNewerTag failed at plugin_tags_test.go:31 with fatal: not a git repository: '\C:\...\skills.git'.
  • After fix: go test -count=5 ./internal/library -run 'TestPluginUpgradesToNewerTag|TestRetagSource' passed (10/10); go vet ./internal/library passed on Windows, Linux (-tags nogui), and macOS (-tags nogui).

qq01-hub avatar Nov 26 '26 04:11 qq01-hub

Fixed in v0.1.4845 (b23590f87), @qq01-hub's commit as it was, thanks! TestPluginUpgradesToNewerTag was red on the Windows box at main (\C:\…\skills.git) and is green with it.

Leaving this open until it is confirmed green on a real Windows run.

yetone avatar Nov 26 '26 10:11 yetone

Reopened: the commit's "Fixes" line closed this on push. It stays open until it's confirmed.

yetone avatar Nov 26 '26 10:11 yetone

@yetone 佬,这个 issue 的修复分支在 qq01-hub/magpie 上仍是 fix/windows-file-url-plugin-tags(52ffe3552),v0.1.4845 已从它移植;issue 是提交里 Fixes 行自动关又手工 reopen 的,确认没问题就可以关了。

qq01-hub avatar Nov 27 '26 05:11 qq01-hub