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:
cliffhall 2026-09-05 01:40:28 -04:00
commit 4d7dd180d9

View file

@ -257,6 +257,21 @@ describe("useInspectorStores", () => {
expect(h.api().stores).not.toBe(first);
});
it("advances the session nonce on both create and destroy", () => {
// It names one connected session and must never repeat across a
// reconnect — `SkillsScreen` keys async verification state on it, and a
// repeated value would let one session's result land in another.
const h = harness();
const seen = new Set<number>([h.api().sessionNonce]);
h.run((api) => api.createStores(client(), fetchLogOptions));
seen.add(h.api().sessionNonce);
h.run((api) => api.destroyStores());
seen.add(h.api().sessionNonce);
h.run((api) => api.createStores(client(), fetchLogOptions));
seen.add(h.api().sessionNonce);
expect(seen.size).toBe(4);
});
it("destroys and clears on destroyStores", () => {
const h = harness();
h.run((api) => api.createStores(client(), fetchLogOptions));