Skip to content

fix(lint): report a file the HTML parser refuses as a finding instead of failing the run - #8853

Queued
miguel-heygen wants to merge 2 commits into
mainfrom
fix/lint-refused-file-finding
Queued

miguel-heygen wants to merge 2 commits into
mainfrom
fix/lint-refused-file-finding

Conversation

@miguel-heygen

Copy link
Copy Markdown
Collaborator

What

hyperframes lint now reports a file that the HTML parser refuses as an error finding on that file. Before, the whole run failed with runtime_error and no findings.

Why

parseHTML from @hyperframes/parsers/linkedom refuses HTML that a browser would read as a different tree. One example is markup hidden in a comment inside an svg <title>. Preview and render refuse such a file, which is right. Lint parses every file through the same function, though, and never caught the refusal. So one refused file in a project ended the lint run before it reported anything, and the run named neither the file nor any other problem.

How

  • packages/lint/src/readableHtml.ts is lint's one owner for a refused file:
    • htmlReadUnlikeBrowserFinding turns the refusal into an html_read_unlike_browser error finding that carries the parser's own message.
    • parseLintHtml reads a refused file as an empty document. Every other check therefore skips that file instead of throwing.
  • lintHyperframeHtml returns that single finding for a refused file and runs no rules on it. That covers the root file, every file under compositions/, and any caller that lints one file.
  • project.ts and hevcPreviewLint.ts parse through parseLintHtml. The project-wide checks (mounted sources, linked styles and scripts, audio, assets, video) no longer throw on a refused file.
  • The sub-composition check names the refusal when a refused file is mounted, including one outside compositions/ that no per-file pass lints. Its message reads data-composition-src references "<file>", but the parser refuses it. <parser message>. This is the same check that already reports a mounted file that is empty or can't be parsed.

The rules in rules/ still call parseHTML directly. They only run on a file that has already parsed.

No visible change

Lint results for files that parse are unchanged. A refused file now shows up as one error on that file, and the rest of the project is still linted.

Test plan

  • Unit tests added/updated
  • Manual testing performed
  • Documentation updated (if applicable)
  • Comments follow CONTRIBUTING.md "Comments": they say why, not what, and a bug fix says what the code must do and how to reproduce the bug

fails without the fix: the four cases in packages/lint/src/htmlReadUnlikeBrowser.test.ts:

  • is one error finding when linted on its own;
  • is a finding on the root, not a failed run;
  • is a finding on its own file while the rest of the project is still linted;
  • is named when a scene outside compositions/ mounts it.

On main each one throws HtmlReadUnlikeBrowserError. With the fix they pass, three runs in a row.

With the fix, the whole lint suite passes (31 files, 1,363 tests), and lint tsc, oxlint, oxfmt and fallow are clean.

Manual: I ran hyperframes lint <dir> --json from the CLI source against a project whose compositions/scene.html hides markup in an svg <title> comment.

  • On main it prints {"error":{"code":"runtime_error", ...}} with no findings.
  • With the fix it reports html_read_unlike_browser on compositions/scene.html, next to the project's other findings.

@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Edit accuracy: accurate 273 (base branch 271), smooth 57 of those

The gate passes.
Smoothness is reported in the artifact, not gated. A case fails only if it fails 2 of 3 runs.

Newly passing (2)

  • seqscaletwice-scale-px-r0-nested-z100
  • seqscaletwice-scale-px-r0-root-z100

Not banked yet, reported and not gated (bank a full-grid run's baseline.json) (2)

  • seqscaletwice-scale-px-r0-nested-z100
  • seqscaletwice-scale-px-r0-root-z100

Quarantined, measured but not gated (0)

@mintlify

mintlify Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
hyperframes 🟢 Ready View Preview Nov 25, 2026, 2:44 PM

💡 Tip: Enable Automations to automatically generate PRs for you.

@miguel-heygen

Copy link
Copy Markdown
Collaborator Author

Since the body was written, dadad499 adds two things. The first is the html_read_unlike_browser entry in docs/reference/lint-rules.mdx. The second is a fifth case in htmlReadUnlikeBrowser.test.ts: leaves the report whole when the mounted file's name is URL-encoded. It fails on main and passes with the fix, three runs in a row. That makes the fails-without-the-fix list five tests, not four.

@jrusso1020 jrusso1020 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve at dadad499. The new commit adds docs and one test on top of 47577048, which I reviewed below: the lint-rules.mdx entry for html_read_unlike_browser, and a URL-encoded mounted file that keeps the rest of the report (5/5 on 3 runs).

What I checked:

  • One owner: readableHtml.ts catches only HtmlReadUnlikeBrowserError, and any other parser error still throws. lintHyperframeHtml returns the single html_read_unlike_browser error (ok: false) before running rules, so a file the parser refuses cannot pass lint silently.
  • Project checks: every non-rule parseHTML call in project.ts and hevcPreviewLint.ts now goes through parseLintHtml. grep finds no direct parseHTML( left in packages/lint/src outside rules/ and the helper. The rules only run on files that already parsed.
  • Mounted-file check: lintMissingOrEmptySubComposition names the refusal for a mounted file, including one outside compositions/.
  • CLI: lintProject and commands/lint.ts don't parse HTML themselves, so the CLI goes through the same path.

Red-first, which I ran myself: with main's hyperframeLinter.ts, project.ts and hevcPreviewLint.ts, all 4 tests named on the "fails without the fix:" line fail. At head, htmlReadUnlikeBrowser.test.ts passes 4/4 on 3 runs, and the full lint suite passes 31 files and 1,363 tests.

Nit, not blocking: every file is now parsed once more for the refusal check before the rules parse it again. It's still linear, but if the linear-time check (#8837) gets tight, return the parsed document from the check and reuse it.

Need ✅ · Size ✅ (+140/−16, half tests) · Reuse ✅ (the parser's own error class and message) · Simpler ✅ · Structure ✅ (one owner for the refusal)
Risk: low. Files that parse lint exactly as before. A refused file becomes one error and no longer aborts the run.

— Rames

@miguel-heygen
miguel-heygen added this pull request to the merge queue Nov 25, 2026
Any commits made after this event will not be merged.

This branch was successfully deployed

1 active deployment
staging - docs — dadad499 Deployed Nov 25, 2026 by mintlify[bot]
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.

2 participants