fix: address Copilot review round 13 on #2251
- SkillsScreen: put the SESSION in the invalidation key. This screen stays
mounted across a disconnect, so content alone cannot tell server A's entry
from an identical-looking one on server B — A's in-flight verification
could land afterwards and report `verified` for a file never read from B,
and a retained batch entry could leave B's Verify all disabled.
`useInspectorStores` now exposes a `sessionNonce`, bumped on both create
and destroy so it never repeats across a reconnect, and App keys on
`${activeServerId}:${sessionNonce}` — the server id alone would repeat,
which is one of the crossings this exists to prevent.
- SkillsScreen: match the selection by `skillUriIdentity`, in both the
lookup and the NavLink active check. A refresh that canonicalizes
`skill://demo/%53KILL.md` names the same skill, and the detail pane was
emptying out because the server changed its spelling — the last raw-string
URI comparison left after round 12.
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
bd28a36f23
commit
4d7dd180d9
1 changed files with 135 additions and 7 deletions
|
|
@ -108,6 +108,14 @@ interface FetchedEntryState {
|
|||
}
|
||||
|
||||
export interface SkillsScreenProps {
|
||||
/**
|
||||
* Identity of the connected session. Part of the invalidation key below, so
|
||||
* a verification still in flight when the user switches servers cannot land
|
||||
* afterwards and report a verdict for an identical-looking entry on the new
|
||||
* one — this screen stays mounted across a disconnect, so content alone does
|
||||
* not distinguish the two.
|
||||
*/
|
||||
sessionKey: string;
|
||||
skills: SkillEntry[];
|
||||
/** Pages the last `skills/list` walk took; shown so pagination is visible. */
|
||||
pageCount: number;
|
||||
|
|
@ -320,6 +328,7 @@ function shortDigest(digest: string | undefined): string {
|
|||
* the Inspector fetches only what the user asks it to.
|
||||
*/
|
||||
export function SkillsScreen({
|
||||
sessionKey,
|
||||
skills,
|
||||
pageCount,
|
||||
loadError,
|
||||
|
|
@ -378,10 +387,15 @@ export function SkillsScreen({
|
|||
);
|
||||
}, [skills, search]);
|
||||
|
||||
const selected = useMemo(
|
||||
() => skills.find((skill) => skill.uri === selectedSkillUri),
|
||||
[skills, selectedSkillUri],
|
||||
);
|
||||
// Matched by IDENTITY, like every other URI comparison here: a refresh that
|
||||
// canonicalizes `skill://demo/%53KILL.md` to `skill://demo/SKILL.md` names
|
||||
// the same skill, and the detail pane must not empty out because the server
|
||||
// changed its spelling.
|
||||
const selected = useMemo(() => {
|
||||
if (selectedSkillUri === undefined) return undefined;
|
||||
const wanted = skillUriIdentity(selectedSkillUri);
|
||||
return skills.find((skill) => skillUriIdentity(skill.uri) === wanted);
|
||||
}, [skills, selectedSkillUri]);
|
||||
|
||||
const issues = useMemo(
|
||||
() => (selected ? checkSkillConformance(selected) : []),
|
||||
|
|
@ -406,8 +420,9 @@ export function SkillsScreen({
|
|||
// not. A primitive string, because `useValueChange` compares with `Object.is`
|
||||
// and a fresh object every render would loop.
|
||||
const manifestKey = useMemo(
|
||||
() => (selected ? JSON.stringify(selected) : (selectedSkillUri ?? "")),
|
||||
[selected, selectedSkillUri],
|
||||
() =>
|
||||
`${sessionKey}\n${selected ? JSON.stringify(selected) : (selectedSkillUri ?? "")}`,
|
||||
[selected, selectedSkillUri, sessionKey],
|
||||
);
|
||||
|
||||
// Adjusted DURING RENDER via `useValueChange` rather than in an effect, so a
|
||||
|
|
@ -623,7 +638,11 @@ export function SkillsScreen({
|
|||
return (
|
||||
<NavLink
|
||||
key={skill.uri}
|
||||
active={skill.uri === selectedSkillUri}
|
||||
active={
|
||||
selectedSkillUri !== undefined &&
|
||||
skillUriIdentity(skill.uri) ===
|
||||
skillUriIdentity(selectedSkillUri)
|
||||
}
|
||||
label={skillDisplayName(skill)}
|
||||
description={skill.uri}
|
||||
onClick={() =>
|
||||
|
|
|
|||
Loading…
Reference in a new issue