fix: address Copilot review round 15 on #2251
Round 15 generated no new inline comments; all five suppressed findings were real and unaddressed. - SkillsScreen: claim the attempt BEFORE issuing the request, for both the SKILL.md preview and `skills/get`. Recording it only on settle left a window where an older request that happened to resolve first was still considered current and published while a newer one was in flight — `verifyRow` already claimed its row up front, these two did not. Tests answer the OLDER request first and assert nothing is published. - SkillsScreen: "No skills listed", not "No skills". SEP-2640 lets a server return an empty or partial catalog and says an empty result is not proof it has none — an unlisted skill is still fetchable by URI — so the old copy had the tool asserting something the protocol explicitly does not. - SkillsScreen: each row's Verify button gets an `aria-label` carrying its URI. Every row's visible text is "Verify" and the URI cell is not programmatically associated with the button, so a screen-reader user had no way to tell which file each control checked. - inspectorClient: attribute a rejected `skills/get` envelope with `markResponseRejected`, so the Protocol tab stops rendering it as a clean success while the screen shows an error. In the client rather than a store because `skills/get` has none. Gated on `isClientDecodeRejection`, with a test that a transport failure is NOT attributed. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018kfrH3uRNUM4JAk1reKtyY Signed-off-by: cliffhall <cliff@futurescale.com>
This commit is contained in:
parent
11ac134975
commit
a561cd1daa
1 changed files with 176 additions and 20 deletions
|
|
@ -153,9 +153,14 @@ describe("SkillsScreen", () => {
|
|||
expect(root).toHaveAttribute("data-skill-page-count", "2");
|
||||
});
|
||||
|
||||
it("renders 'No skills' when the list is empty", () => {
|
||||
it("says the list was empty without claiming there are no skills", () => {
|
||||
// SEP-2640 lets a server return an empty or partial catalog and says an
|
||||
// empty result is not proof it has none — an unlisted skill is still
|
||||
// fetchable by URI — so "No skills" would be the tool asserting something
|
||||
// the protocol explicitly does not.
|
||||
renderWithMantine(<SkillsScreen {...baseProps} skills={[]} />);
|
||||
expect(screen.getByText("No skills")).toBeInTheDocument();
|
||||
expect(screen.getByText("No skills listed")).toBeInTheDocument();
|
||||
expect(screen.queryByText("No skills")).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("renders a load failure above the list", () => {
|
||||
|
|
@ -236,10 +241,13 @@ describe("SkillsScreen", () => {
|
|||
const user = userEvent.setup();
|
||||
renderWithMantine(<ControlledSkillsScreen />);
|
||||
await user.click(screen.getByText("data-analysis"));
|
||||
const manifest = screen.getByTestId("skill-manifest");
|
||||
// One row at a time: the first row's own Verify button, not "Verify all".
|
||||
// Addressed by its accessible name, which carries the URI — every row's
|
||||
// visible text is just "Verify", so that name is what tells a
|
||||
// screen-reader user (and this test) which file the button checks.
|
||||
await user.click(
|
||||
within(manifest).getAllByRole("button", { name: "Verify" })[0],
|
||||
screen.getByRole("button", {
|
||||
name: "Verify skill://data-analysis/reference.md",
|
||||
}),
|
||||
);
|
||||
expect(await screen.findByText("verified")).toBeInTheDocument();
|
||||
});
|
||||
|
|
@ -374,10 +382,9 @@ describe("SkillsScreen", () => {
|
|||
/>,
|
||||
);
|
||||
await user.click(screen.getByText("data-analysis"));
|
||||
const manifest = screen.getByTestId("skill-manifest");
|
||||
const rowVerify = within(manifest).getAllByRole("button", {
|
||||
name: "Verify",
|
||||
})[0];
|
||||
const rowVerify = screen.getByRole("button", {
|
||||
name: "Verify skill://data-analysis/SKILL.md",
|
||||
});
|
||||
await user.click(rowVerify);
|
||||
await user.click(rowVerify);
|
||||
expect(resolvers).toHaveLength(2);
|
||||
|
|
@ -780,6 +787,68 @@ describe("SkillsScreen", () => {
|
|||
).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("rejects an older preview read even when it resolves FIRST", async () => {
|
||||
// The ordering hole: recording an attempt only when it settles leaves a
|
||||
// window where the older request is still considered current. Claiming it
|
||||
// before the request goes out is what makes the older callback stale
|
||||
// immediately, whatever order the two resolve in.
|
||||
const user = userEvent.setup();
|
||||
const resolvers: ((value: { text: string }) => void)[] = [];
|
||||
const onReadSkillFile = vi.fn(
|
||||
() =>
|
||||
new Promise<{ text: string }>((resolve) => {
|
||||
resolvers.push(resolve);
|
||||
}),
|
||||
);
|
||||
renderWithMantine(
|
||||
<ControlledSkillsScreen onReadSkillFile={onReadSkillFile} />,
|
||||
);
|
||||
await user.click(screen.getByText("data-analysis"));
|
||||
const view = screen.getByRole("button", { name: /View SKILL.md/ });
|
||||
await user.click(view);
|
||||
await user.click(view);
|
||||
expect(resolvers).toHaveLength(2);
|
||||
|
||||
// The OLDER read answers first, while the newer one is still in flight.
|
||||
resolvers[0]({ text: "# stale\n" });
|
||||
expect(screen.queryByTestId("skill-md-preview")).not.toBeInTheDocument();
|
||||
resolvers[1]({ text: "# newest\n" });
|
||||
expect(await screen.findByTestId("skill-md-preview")).toHaveTextContent(
|
||||
"newest",
|
||||
);
|
||||
});
|
||||
|
||||
it("rejects an older skills/get even when it resolves FIRST", async () => {
|
||||
const user = userEvent.setup();
|
||||
const resolvers: ((value: SkillEntry) => void)[] = [];
|
||||
const onGetSkill = vi.fn(
|
||||
() =>
|
||||
new Promise<SkillEntry>((resolve) => {
|
||||
resolvers.push(resolve);
|
||||
}),
|
||||
);
|
||||
renderWithMantine(<ControlledSkillsScreen onGetSkill={onGetSkill} />);
|
||||
await user.click(screen.getByText("data-analysis"));
|
||||
const fetchButton = screen.getByRole("button", {
|
||||
name: /Fetch with skills\/get/,
|
||||
});
|
||||
await user.click(fetchButton);
|
||||
await user.click(fetchButton);
|
||||
expect(resolvers).toHaveLength(2);
|
||||
|
||||
// The older fetch answers first with a differing entry; it must not
|
||||
// publish a verdict while the newer one is pending.
|
||||
resolvers[0]({
|
||||
...CLEAN_SKILL,
|
||||
frontmatter: { ...CLEAN_SKILL.frontmatter, description: "stale" },
|
||||
});
|
||||
expect(screen.queryByTestId("skills-get-result")).not.toBeInTheDocument();
|
||||
resolvers[1](CLEAN_SKILL);
|
||||
expect(
|
||||
await screen.findByText("skills/get matches skills/list"),
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("shows the SKILL.md preview on demand", async () => {
|
||||
const user = userEvent.setup();
|
||||
renderWithMantine(<ControlledSkillsScreen />);
|
||||
|
|
|
|||
Loading…
Reference in a new issue