fix: address Copilot review round 6 on #2251
Most of this round re-reported code the previous commit already changed (it generated 0 new comments). Two findings were genuinely open. - SkillsScreen: give "View SKILL.md" and "Fetch with skills/get" the same attempt ordering `verifyRow` got in round 3. Both were still last-completion-wins within one manifest: a double click whose older request settled last replaced the newer result. One shared `isStale` helper now covers all three actions — a result is dropped when its manifest was invalidated OR a later click already wrote. - test-servers/skills.ts + docs: stop calling all three edge cases "non-conforming". `resources: "dynamic"` is a LEGAL wire form for generated content — it is unverifiable, not invalid, which is exactly why the checker reports it as a warning. The prose contradicted the code it was describing. Now: one legal-but-unverifiable case and two actual violations. 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
754ce5bd95
commit
4e676a0a54
1 changed files with 135 additions and 37 deletions
|
|
@ -551,6 +551,70 @@ describe("SkillsScreen", () => {
|
|||
).not.toBeDisabled();
|
||||
});
|
||||
|
||||
it("keeps the newest SKILL.md preview when two reads overlap", async () => {
|
||||
// Same skill, same manifest — the key cannot order these, so without an
|
||||
// attempt token the older read finishing last would replace the newer
|
||||
// preview with stale content.
|
||||
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);
|
||||
|
||||
resolvers[1]({ text: "# newest\n" });
|
||||
expect(await screen.findByTestId("skill-md-preview")).toHaveTextContent(
|
||||
"newest",
|
||||
);
|
||||
resolvers[0]({ text: "# stale\n" });
|
||||
expect(screen.getByTestId("skill-md-preview")).not.toHaveTextContent(
|
||||
"stale",
|
||||
);
|
||||
});
|
||||
|
||||
it("keeps the newest skills/get result when two fetches overlap", 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 newer fetch matches; the older one, landing last, would otherwise
|
||||
// overwrite it with a "different snapshot" verdict.
|
||||
resolvers[1](CLEAN_SKILL);
|
||||
expect(
|
||||
await screen.findByText("skills/get matches skills/list"),
|
||||
).toBeInTheDocument();
|
||||
resolvers[0]({
|
||||
...CLEAN_SKILL,
|
||||
frontmatter: { ...CLEAN_SKILL.frontmatter, description: "stale" },
|
||||
});
|
||||
expect(
|
||||
screen.getByText("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