Skip to content

fix(skill-creator): eval-viewer HTML breakout + metadata search depth#959

Open
john-savepoint wants to merge 1 commit intoanthropics:mainfrom
john-savepoint:fix/eval-viewer-script-breakout-and-metadata-search
Open

fix(skill-creator): eval-viewer HTML breakout + metadata search depth#959
john-savepoint wants to merge 1 commit intoanthropics:mainfrom
john-savepoint:fix/eval-viewer-script-breakout-and-metadata-search

Conversation

@john-savepoint
Copy link
Copy Markdown

Summary

Two bugs in skills/skill-creator/eval-viewer/generate_review.py:

  • HTML breakout via </script> in user content. json.dumps() doesn't escape /, so when eval outputs contain </script> (common in code samples showing gtag.js, GTM snippets, etc.), the embedded <script> block terminates prematurely, corrupting the entire viewer. Fix: .replace("</", r"<\/") after json.dumps() — valid JSON per RFC 8259 §7, standard XSS-safe-embed pattern.

  • eval_metadata.json not found at canonical depth. The viewer searches run_dir and run_dir.parent for metadata, but the workspace layout documented in SKILL.md places it at eval-N/eval_metadata.json — two levels above eval-N/with_skill/run-1/. All prompts render as "(No prompt found)". Fix: add run_dir.parent.parent to the search path.

Test plan

  • Generated eval viewer with code-sample outputs containing literal </script> — renders correctly after fix
  • Prompts now populate from eval_metadata.json at the eval-N/ level
  • Verified <\/ round-trips through JSON.parse() identically to </ (RFC 8259 permits both)

🤖 Generated with Claude Code

Two bugs in generate_review.py:

1. User-generated outputs containing `</script>` (e.g. code samples
   showing gtag.js integration) break out of the embedded `<script>`
   block, corrupting the entire viewer HTML. Fix: escape `</` to `<\/`
   after `json.dumps()` — both forms are valid JSON (RFC 8259 §7) and
   the browser's HTML parser no longer sees a premature script
   terminator.

2. `eval_metadata.json` is only searched 1 level up from `run_dir`,
   but the canonical workspace layout places it 2 levels up
   (`eval-N/eval_metadata.json` vs `eval-N/with_skill/run-1/`).
   This causes all prompts to show as "(No prompt found)" in the
   viewer. Fix: add `run_dir.parent.parent` to the search path.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant