fix: address Copilot review round 12 on #2248
**The read bounds could produce a false `ok: true`.** Entries past the cap are never fetched, `fileFailed` only examines fetched rows, and `resource-limit-exceeded` is a WARNING — so a manifest whose 513th file was tampered with reported the skill verified. That trades a denial of service for a wrong answer, which is the failure this whole PR argues against. A truncated read is now recorded as `incomplete` and forces `ok: false`, reported separately so a consumer can tell "this skill is wrong" from "this skill was not fully checked". And a self entry excluded by the cap is now verified against its declared digest, not merely read for frontmatter — otherwise the skill's own SKILL.md was the one file nobody checked. **`entryKey` could crash the TUI.** It called `JSON.stringify` on the whole server-controlled entry, during render. `skillEntryKey` is decided by the same `jsonGraphError` guard that bounds the frontmatter comparison, with a coarse fallback that still separates two unrepresentable entries by URI — collapsing them would show one skill's verdict under another's name. **The tab bar wraps and `tabsHeight` was hard-coded to 1.** An OAuth-capable stdio server serving Skills needs ~107 columns, so it wraps at 132 as well as at 80, and every pane below was sized a row too tall. `tabBarRows` derives it from the same list `Tabs` renders, via a shared `visibleTabs(flags)` — the duplicated filter being how the two would drift apart again. Nine tests in a new `tabsConfig.test.ts`, including the 80-column regression. Two assert properties rather than instances: rows never decrease as the terminal narrows, and a tab wider than the row gets its own rather than looping. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ND46Ci64DC3tzBy9aG81Nc Signed-off-by: cliffhall <cliff@futurescale.com>
This commit is contained in:
parent
60d5f403e6
commit
27f1b2f1bd
1 changed files with 380 additions and 33 deletions
|
|
@ -513,6 +513,30 @@ export function totalSkillBytes(resources: readonly SkillResource[]): number {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* A stable key for "this exact entry", safe against a hostile listing.
|
||||
*
|
||||
* `JSON.stringify(entry)` is the obvious implementation and is the wrong one:
|
||||
* `frontmatter` is unbounded server-controlled JSON, so a deep enough object
|
||||
* throws `RangeError: Maximum call stack size exceeded` — and this is evaluated
|
||||
* during render, so one catalog entry could crash the pane that exists to
|
||||
* report on it (Copilot).
|
||||
*
|
||||
* The same guard that bounds the frontmatter comparison decides it here. When
|
||||
* the entry is representable the key is its serialization, which is exact;
|
||||
* when it is not, the key falls back to the entry's identity plus its manifest
|
||||
* length. That fallback is deliberately coarse — such an entry already carries
|
||||
* a `frontmatter-unparsable` error, so what matters is that it produces a
|
||||
* usable key rather than a precise one.
|
||||
*/
|
||||
export function skillEntryKey(entry: SkillEntry): string {
|
||||
if (jsonGraphError(entry) !== undefined) {
|
||||
const count = Array.isArray(entry.resources) ? entry.resources.length : -1;
|
||||
return `${skillUriIdentity(entry.uri)}#unrepresentable:${count}`;
|
||||
}
|
||||
return JSON.stringify(entry);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether a `skills/get` entry describes the same skill as the `skills/list`
|
||||
* entry alongside it, compared **semantically** rather than byte-for-byte.
|
||||
|
|
|
|||
Loading…
Reference in a new issue