FN-9118: Align skill tooltip tests with stored IDs

Validate AgentDetailView skill badges against stable persisted identifiers and discovery states.

- replace environment-sensitive skill path assertions with fixed stored-ID fixtures
- cover discovered path, discovered slug, and undiscovered skill badge states
- document that tooltips preserve persisted IDs while badge labels remain humanized

Files changed:
 .../dashboard/app/components/AgentDetailView.tsx   |  4 +++
 .../__tests__/AgentDetailView.core.test.tsx        | 39 ++++++++++++++++------
 2 files changed, 33 insertions(+), 10 deletions(-)

Fusion-Task-Id: FN-9118

Fusion-Task-Lineage: 1cbe21ad-5a3c-4131-9352-2138d892e88d

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
This commit is contained in:
gsxdsm
2026-08-15 23:49:13 -07:00
parent 9a9e591b72
commit 37daefed25
2 changed files with 33 additions and 10 deletions

View File

@@ -1563,6 +1563,10 @@ function DashboardTab({
{agentSkills.map((skillId) => {
const isSelected = selectedSkillId === skillId;
const classification = classifyAgentSkill(skillId, discoveredSkillsLoading || discoveredSkillsError ? null : discoveredSkills, { forced: true });
/*
* FNXC:AgentSkills 2026-08-16-06:34:
* Preserve the exact persisted agent.metadata.skills ID in the tooltip so operators can diagnose stale or undiscovered entries. Only the visible badge label is humanized by formatAgentSkillBadgeLabel.
*/
return (
<button
key={skillId}

View File

@@ -47,6 +47,15 @@ import {
} from "./AgentDetailView.test-helpers";
import { AgentDetailView } from "../AgentDetailView";
const STORED_PATH_SKILL_ID = "/Users/test/.agents/skills/fusion/SKILL.md";
const STORED_SLUG_SKILL_ID = "simple-skill";
const UNDISCOVERED_SKILL_ID = "missing-skill";
const AUTO_AVAILABLE_SKILL_TITLE = "Enabled skills are available automatically.";
/*
* FNXC:AgentSkills 2026-08-16-06:34:
* These fixture IDs are literals, never cwd- or home-directory-derived values. Summary badge markup is breakpoint-independent, so this contract covers desktop and mobile layouts.
*/
describe("AgentDetailView — core", () => {
beforeEach(() => {
setupAgentDetailMocks();
@@ -450,12 +459,13 @@ it("displays canonical role tags", async () => {
it("renders assigned skills as readable badges with full id tooltip", async () => {
mockFetchAgent.mockResolvedValue(createMockAgent({
metadata: {
skills: [
"/Users/test/.agents/skills/fusion/SKILL.md",
"simple-skill",
],
skills: [STORED_PATH_SKILL_ID, STORED_SLUG_SKILL_ID, UNDISCOVERED_SKILL_ID],
},
}));
mockFetchDiscoveredSkills.mockResolvedValue([
{ ...MOCK_SKILLS[0], id: STORED_PATH_SKILL_ID, name: "Fusion", path: STORED_PATH_SKILL_ID, relativePath: "skills/fusion" },
{ ...MOCK_SKILLS[1], id: STORED_SLUG_SKILL_ID, name: "Simple skill", path: STORED_SLUG_SKILL_ID, relativePath: "skills/simple-skill" },
]);
render(
<AgentDetailView
@@ -465,13 +475,22 @@ it("renders assigned skills as readable badges with full id tooltip", async () =
/>,
);
await waitFor(() => {
expect(screen.getByText("fusion")).toBeInTheDocument();
expect(screen.getByText("simple-skill")).toBeInTheDocument();
});
const fusionBadge = await screen.findByRole("button", { name: "View details for fusion" });
const simpleSkillBadge = screen.getByRole("button", { name: "View details for simple-skill" });
const missingSkillBadge = screen.getByRole("button", { name: "View details for missing-skill" });
const fusionBadge = screen.getByText("fusion").closest(".dashboard-summary-skill-badge");
expect(fusionBadge).toHaveAttribute("title", "/Users/test/.agents/skills/fusion/SKILL.md");
expect(fusionBadge).toHaveAttribute("data-skill-state", "auto-available");
expect(fusionBadge).toHaveTextContent("fusion");
const fusionTitle = fusionBadge.getAttribute("title");
expect(fusionTitle?.startsWith(`${STORED_PATH_SKILL_ID}: `)).toBe(true);
expect(fusionTitle).toContain(AUTO_AVAILABLE_SKILL_TITLE);
expect(simpleSkillBadge).toHaveAttribute("data-skill-state", "auto-available");
expect(simpleSkillBadge).toHaveTextContent(STORED_SLUG_SKILL_ID);
expect(simpleSkillBadge.getAttribute("title")?.startsWith(`${STORED_SLUG_SKILL_ID}: `)).toBe(true);
expect(missingSkillBadge).toHaveAttribute("data-skill-state", "unknown");
expect(missingSkillBadge.getAttribute("title")?.startsWith(`${UNDISCOVERED_SKILL_ID}: `)).toBe(true);
});
it("displays state badge", async () => {