Skip to content

Commit e4e790c

Browse files
anshul0713Isaac
andauthored
aitools: test that the install hint stays quiet after a project-scoped install (#7667)
## Changes Test-only: adds `TestMaybeHint_ProjectSkillsInstalledSilent` and `TestMaybeHint_ProjectSkillsInParentOfRepoSubdirSilent`. They lay out an install the way `databricks aitools install --scope project` does (a relative symlink from `.claude/skills/<skill>` to the project's `.databricks/aitools/skills/<skill>`). Then they check that the "Databricks skills are not installed" hint stays quiet, both from the project root and from a subdirectory of the repository. ## Why A coding agent in an AI Runtime trial ran `databricks aitools install --scope project`. The very next command, `databricks air list`, said skills were not installed and suggested reinstalling. This PR originally fixed that in `claudeToolingInstalled`. #7585 has since made the hint ask `DatabricksTooling`, which already walks Claude's project skills folders, so the fix is no longer needed. The hint tests cover project-scoped plugins and skills under HOME, but not a project-scoped skills install, so I kept the regression tests. Both fail on the commit before #7585. ## Tests `go test ./libs/aitools/...` passes. This pull request and its description were written by Isaac. --------- Co-authored-by: Isaac <no-reply@databricks.com>
1 parent 4c87e6a commit e4e790c

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

‎libs/aitools/agents/hint_test.go‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -769,3 +769,40 @@ func TestMaybeHint_InstalledLogsNothing(t *testing.T) {
769769
MaybeHint(ctx, regularCmd(), noPluginRecorded)
770770
assert.Empty(t, telemetry.BufferedEvents(ctx))
771771
}
772+
773+
// writeProjectSkill creates a project-scoped Claude skill symlink.
774+
func writeProjectSkill(t *testing.T, project, name string) {
775+
canonical := filepath.Join(project, ".databricks", "aitools", "skills", name)
776+
require.NoError(t, os.MkdirAll(canonical, 0o755))
777+
link := filepath.Join(project, ".claude", "skills", name)
778+
require.NoError(t, os.MkdirAll(filepath.Dir(link), 0o755))
779+
rel, err := filepath.Rel(filepath.Dir(link), canonical)
780+
require.NoError(t, err)
781+
require.NoError(t, os.Symlink(rel, link))
782+
}
783+
784+
func TestMaybeHint_ProjectSkillsInstalledSilent(t *testing.T) {
785+
for _, tc := range []struct {
786+
name string
787+
// subdir is where the command runs, relative to the project root.
788+
subdir string
789+
}{
790+
{name: "project root"},
791+
{name: "repo subdirectory", subdir: "train"},
792+
} {
793+
t.Run(tc.name, func(t *testing.T) {
794+
setClaudeAgent(t)
795+
home := t.TempDir()
796+
ctx, stderr := claudeCtx(t, home)
797+
project := t.TempDir()
798+
require.NoError(t, os.Mkdir(filepath.Join(project, ".git"), 0o755))
799+
writeProjectSkill(t, project, "databricks-ai-runtime")
800+
cwd := filepath.Join(project, tc.subdir)
801+
require.NoError(t, os.MkdirAll(cwd, 0o755))
802+
t.Chdir(cwd)
803+
804+
MaybeHint(ctx, regularCmd(), noPluginRecorded)
805+
assert.Empty(t, stderr.String())
806+
})
807+
}
808+
}

0 commit comments

Comments
 (0)