fix: address Copilot review round 6 (#2263)

Four findings — two inline, two in the review's suppressed block.

"Expand all" wrote `sectionIds` — the sections rendered at that instant — into
`openSections`, which outlives any one skill. Pressing it while the SKILL.md
read was still in flight dropped `frontmatter`, so the section arrived collapsed
with the control offering to expand all over again; a dynamic skill did the same
to `resources`. It now expands to the complete set, and `sectionIds` decides
only the toggle's label. The new test is verified to detect the defect: with
`sectionIds` restored it fails.

`inferMimeFromUri` matched the raw path, so a percent-encoded suffix such as
`reference%2Emd` produced no MIME at all — no markdown renderer and no
frontmatter split — even though `skillUriIdentity` already treats that spelling
as the same file. It now decodes defensively, falling back to the raw path on a
malformed escape rather than throwing inside what is only a guess.

Two comment fixes, both cases of a deliberate decision being contradicted by the
prose around it. `theme/Accordion.ts` still asserted "sized to content and never
shrink; overflow moves to the root" after round 5 moved the sections back to
`flex: 0 1 auto` with a floor — the exact stale rationale that makes a
load-bearing layout easy to regress. And the component doc, the
`onReadSkillFile` doc in `useServerCommands.tsx` and a `test-servers` fixture
comment all still said skill files are read only when the user asks to verify
them, one of them still naming the removed "View SKILL.md" button. All three now
separate reading (on selection, and not a load under SEP-2640) from verification
(strictly on demand).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R4441JdNLZerCVM7mDDSfB
Signed-off-by: cliffhall <cliff@futurescale.com>
This commit is contained in:
cliffhall 2026-09-06 01:21:54 -04:00
commit d78089892b

View file

@ -24,14 +24,21 @@ export const ThemeAccordion = Accordion.extend({
},
// `skillSections` is `disclosure` plus a scrolling root (#2263).
//
// The Skills pane holds sections whose content is a rendered document or a
// findings list, not a uniform row list, so they are sized to their content
// and never shrink. That removes the mid-content clipping a shrinking panel
// produced — the panel really was scrollable, but macOS overlay scrollbars
// are invisible until hover, so a Resources table cut off mid-alert read as
// broken rather than scrollable. Overflow moves up to the root, so in the
// rare case the sections genuinely exceed the pane it is the *stack* that
// scrolls, at a section boundary, instead of a panel slicing its own content.
// The Skills pane's metadata sections use `flex: 0 1 auto` with a `mih`
// floor: they give up space until they reach that floor and then scroll their
// own panels, which is what leaves the file viewer its share no matter how
// large a manifest or findings list gets.
//
// The scrolling root is the FALLBACK for when even the combined floors do not
// fit — with several sections open in a short window there is no arrangement
// that shows everything, and scrolling the stack at a section boundary beats
// crushing a panel below its floor.
//
// ⚠️ The floor is load-bearing, not decoration. Without it a section can be
// squeezed far below its content and slice it mid-line; with `flex-shrink: 0`
// instead, a 512-row manifest keeps its full height and pushes the viewer off
// the bottom of the pane. `SECTION_FLEX` in `SkillsScreen.tsx` records both
// failures — this variant only works in combination with it.
styles: (_theme, props) => {
if (props.variant === "skillSections") {
return {