fix: address Copilot review round 8 on #2248
**The depth guard covered only the YAML side.** The listing arrives over JSON-RPC so it cannot be cyclic, but it is just as unbounded in depth — and both `jsonLikeEqual` and its message formatter walk it, so a server advertising a deeply nested value crashed the tool exactly as a cyclic served one did. Reproduced first: 60,000 levels against a shallow served value gives `RangeError: Maximum call stack size exceeded`. `jsonGraphError` is shared now and runs over `entry.frontmatter` before the file is parsed — there is no point reading a SKILL.md if the thing to compare it against is unusable. **A frontmatter mismatch stayed behind a collapsed section.** Round 7 made the badge count these findings; the alerts explaining a mandatory verification failure were still one click away on a section that opens collapsed for a structurally clean entry. Conformance now reveals itself when they appear, keyed on the entry so it fires once rather than fighting a user who collapses it again. That reveal exposed three fixtures serving one skill's SKILL.md for every URI — a genuine frontmatter mismatch the check was right to report. The stale- batch invariant test and the Storybook fixtures now derive each file from the frontmatter its own entry advertises, with digests computed from those bytes rather than hard-coded, so the class of drift is closed rather than the instances patched. `SAMPLE_FM` is the single source for both halves. One story subtlety worth recording: only a skill's OWN SKILL.md is derived. Serving it for `notes.md` too made the tampered fixture fail its SIZE check first, which is a different finding from the digest mismatch that story exists to demonstrate. 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
d6b1e36e7e
commit
8ae1a1664d
1 changed files with 217 additions and 47 deletions
|
|
@ -1482,6 +1482,27 @@ export function SkillsScreen({
|
|||
* entry whose only finding is a banner one ended up showing an empty findings
|
||||
* container instead of "no structural issues".
|
||||
*/
|
||||
/**
|
||||
* Reveal Conformance when the frontmatter check finds something.
|
||||
*
|
||||
* A structurally clean entry opens with the section COLLAPSED — the header
|
||||
* badge carries the whole answer — but the frontmatter findings arrive later,
|
||||
* from the `SKILL.md` read, and land inside that collapsed section. The badge
|
||||
* now counts them, so the number changes; the alerts explaining a mandatory
|
||||
* verification failure were still a click away (Copilot).
|
||||
*
|
||||
* Keyed on the entry so it fires **once** per skill, when findings first
|
||||
* appear, rather than fighting a user who deliberately collapses it again.
|
||||
* `useValueChange` runs during render and does only `setState`, as that hook
|
||||
* requires; the key is a primitive so `Object.is` cannot loop.
|
||||
*/
|
||||
useValueChange(frontmatterIssues.length > 0 ? manifestKey : "", (next) => {
|
||||
if (next === "") return;
|
||||
setOpenSections((prev) =>
|
||||
prev.includes("conformance") ? prev : [...prev, "conformance"],
|
||||
);
|
||||
});
|
||||
|
||||
const listedIssues = useMemo(
|
||||
() =>
|
||||
issues.filter(
|
||||
|
|
|
|||
Loading…
Reference in a new issue