Skip to content

test: cover Claude stale symlink self-heal#5694

Open
vicksiyi wants to merge 2 commits into
multica-ai:mainfrom
vicksiyi:multica-fix/issue-5683-claude-stale-symlink
Open

test: cover Claude stale symlink self-heal#5694
vicksiyi wants to merge 2 commits into
multica-ai:mainfrom
vicksiyi:multica-fix/issue-5683-claude-stale-symlink

Conversation

@vicksiyi

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds regression coverage for GitHub #5683, where Claude Code's stable command symlink can be pinned to a versioned executable path at daemon startup and later disappear after Claude auto-updates and garbage-collects the old version directory.

The daemon's built-in resolveAgentEntry path already re-resolves vanished pinned executables for built-in providers. This PR makes the Claude native-installer shape explicit so future changes cannot accidentally leave this coverage Codex-only.

Related Issue

Closes #5683

Multica: ZIC-107

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Refactor / code improvement (no behavior change)
  • Documentation update
  • Tests (adding or improving test coverage)
  • CI / infrastructure

Changes Made

  • Added a Claude native-installer stale-symlink regression test in server/internal/daemon/agent_path_selfheal_test.go.
  • Verified the healed executable path and detected version move together after the old Claude version directory disappears.

How to Test

  1. cd server
  2. go test ./internal/daemon -run 'TestResolveAgentEntry'
  3. go test ./internal/daemon

Checklist

  • I have included a thinking path that traces from project context to this change
  • I have run tests locally and they pass
  • I have added or updated tests where applicable
  • If this change affects the UI, I have included before/after screenshots (N/A - no UI change)
  • I have updated relevant documentation to reflect my changes (N/A - regression test only)
  • If I added a new runtime / coding tool / UI tab, I synced the change to landing copy (apps/web/features/landing/i18n/) and relevant docs (apps/docs/content/docs/) (N/A)
  • If this PR touches Chinese product copy, I checked it against apps/docs/content/docs/developers/conventions.zh.mdx (terminology, mixed-rule for task / issue / skill) (N/A)
  • I have considered and documented any risks above
  • I will address all reviewer comments before requesting merge

AI Disclosure

AI tool used: Multica Agent

Prompt / approach:
Traced daemon executable resolution and self-heal behavior, then added focused regression coverage for the Claude native-installer symlink/update layout described in GitHub #5683.

Screenshots (optional)

N/A

Co-authored-by: multica-agent <github@multica.ai>
@vercel

vercel Bot commented Jul 20, 2026

Copy link
Copy Markdown

@vicksiyi is attempting to deploy a commit to the IndexLabs Team on Vercel.

A member of the Team first needs to authorize it.

@multica-eve multica-eve left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

当用户安装的命令自行升级并清理旧版本后,后续工作仍应继续完成,无需重启或手工修复。这个行为值得保障,也符合产品预期。

Must-fix

server/internal/daemon/agent_path_selfheal_test.go:73 构造的是 ~/.local/share/claude/versions/<version>/bin/claude,但 #5683 的现场路径和复现步骤都是稳定链接直接指向可执行文件 ~/.local/share/claude/versions/<version>。当前夹具仍是“版本目录下再嵌套 bin/claude”的通用版本管理器形状,与已有 Codex 回归测试高度重叠;这个 PR 只新增测试,因此必须精确覆盖 Claude 原生安装器的真实布局,才能锁住报告中的回归。

请把 Claude 版本文件直接创建在 versions/<version>,并相应调整版本探测 stub(或让测试可执行文件真实输出 --version);保留旧目标删除、稳定链接重指向,以及 healed path / returned version / version cache 同步更新的断言。

定向测试与完整 go test ./internal/daemon -count=1 均通过;这说明当前夹具自洽,但不能替代对真实布局的覆盖。

🔄 Request changes:产品方向正确,但上述测试夹具必须先修正。

@chuanskqi

Copy link
Copy Markdown

up

Co-authored-by: multica-agent <github@multica.ai>
@vicksiyi

vicksiyi commented Jul 24, 2026

Copy link
Copy Markdown
Contributor Author

Addressed the requested Claude native installer fixture correction in b5b25bb.

  • The Claude fixture now creates the executable directly at ~/.local/share/claude/versions/<version> and repoints the stable claude symlink to that file.
  • The version-detection stub now handles that direct executable layout while preserving the existing Codex fixture behavior.
  • The test keeps the stale target deletion, stable symlink repoint, healed path, returned version, and version-cache assertions, and now also asserts the healed path is runnable.

Validation:

  • go test ./internal/daemon -run 'TestResolveAgentEntry_' -count=1
  • go test ./internal/daemon -count=1

GitHub CI is green on the pushed commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants