fix(author): the 2026-11-09 skill eval's and code review's findings

Merged
AL
11d ago
+231-82

Closes #162: every finding of the 2026-11-09 skill eval and code review, in one PR as asked.

The skill (skills/h5p-author/SKILL.md)

  • Step 3: build in a working folder of one's own, rebuild a failed source under the same name, and copy the package handed over to the asked name; never delete a file to free a name. One eval run had rm -rf'd the user's file to reuse its name.
  • Step 4: says where the report lands (<name>.verify/, --out), what to read in it, and that one run is enough: --untrusted finds nothing more, the design's call of 2026-11-01.
  • Step 5: --no-open only with a browser tool the agent already has, never a script of its own. One run spent four of its six minutes writing one.
  • The hand-over paragraph is a list now, without the over-long line.
  • "Never read a library's semantics" gives its reason.

The code (packages/author), each with a test that fails on main

  • in followed the prototype chain: a field named toString or constructor went unreported, and a file named x.constructor passed as a known type. Object.hasOwn now (generator.mjs, media.mjs).
  • A multiple of a fractional step is accepted within a rounding error. The editor's % refuses 0.3 in steps of 0.1. No library in the pack has such a step, and the content check checks none, so the departure is recorded in generator.mjs and design/author.md.
  • A downloaded address with a broken escape (%zz) keeps its name as written, instead of ending the build with a bare URIError.
  • sync-skill refuses a type file whose markers are broken (one only, either twice, the end first) instead of appending a second section. The logic moved to lib/schema.mjs (withSection) so the test can import it without running the script.
  • A source's type with a version, "H5P.Blanks 1.14", is refused with the reason: the version is the pack's newest. loadLibraries takes one because saved content names one. The pack holds no two majors of any content type, so pinning one would pin nothing.
  • The CLI parses with node:util parseArgs, as h5p-verify and h5p-embed do: --libraries=dir, -h and -v work.

The five the review raised without checking

  • Confirmed and fixed: the page's build wrote the install-only libraries before the media. writePackage now takes the media and writes them between the content and those libraries, in both builds, and the page's result has install as Node's does.
  • Confirmed and fixed: the media cache was keyed by source alone. The same file named in an image field and in a file field got the first kind's folder, type and size. It is keyed by kind and source now.
  • Dropped: a non-object copyright turning into U silently. The generator already reports it, and MediaStore is not exported.
  • Dropped: schema of an unknown type opening every part. It takes 0.39 s against 0.11 s for a known type.
  • Left as is: the page holding a download of up to 1 GiB as a Blob. Chromium keeps a large Blob on disk rather than in the page's memory, and most hosts refuse a page's download under CORS anyway. Firefox and Safari were not measured.

After the AI review (ddd94df, all four of its findings)

  • The fractional step's bound is four Number.EPSILON of the quotient, the error of three roundings. The first cut's 1e-9 let 50000000.05 pass in steps of 0.1. No on-step decimal among 800,000 sampled up to 1e9 is refused, and no half-step one passes.
  • The skill copies the package with cp -n. Where the asked name is taken, it asks, or takes a new name and says so.
  • It reads the report's reasons, where a failed run may be the only field that says why.
  • It hands over the report, screenshot and revision of the run that passed, or none, with the package called unverified, where the verifier could not run.

Checks

  • pnpm typecheck and pnpm test in packages/author, the Chromium page test included.
  • apps/skills' tests.
  • sync-skill --check: 0 files out of date.
  • All ten changed or new tests fail with the library code of main.

The page build's result type gains a field and the CLI accepts more forms, so the release is an h5p-author minor. Not bumped here.