Repository navigation
fix(lint): a file with markup hidden in an svg title is reported as a lint error, not a crash - #8823
miguel-heygen wants to merge 13 commits into
Conversation
…ackage budget covers it
# Conflicts: # scripts/package-size-budgets.json
# Conflicts: # packages/cli/src/capture/captureImageValidation.ts # packages/cli/src/capture/filterExtractedScripts.ts # packages/cli/src/capture/iconClassifier.ts # packages/cli/src/cloud/offload.ts # packages/cli/src/cloud/offloadTrim.ts # packages/cli/src/commands/add.ts # packages/cli/src/commands/media-treatment.ts # packages/cli/src/commands/snapshot.ts # packages/cli/src/commands/snapshotHeldVideos.ts # packages/cli/src/commands/snapshotReview.ts # packages/cli/src/commands/snapshotSampling.ts # packages/cli/src/media-use/lib/svg-sanitize.mjs # packages/cli/src/utils/checkAudio.ts # packages/cli/src/utils/compositionCensus.ts # packages/cli/src/utils/compositionFps.ts # packages/cli/src/utils/compositionViewport.ts # packages/cli/src/utils/dom.ts # packages/cli/src/utils/fileReferences.ts # packages/cli/src/utils/mediaUsedSeconds.ts # packages/cli/src/utils/publishProject.ts # packages/cli/src/utils/publishProxyBake.ts # packages/cli/src/whisper/normalize.ts # packages/core/src/compiler/htmlDocument.ts # packages/core/src/compiler/htmlParityContract.ts # packages/core/src/compiler/standaloneEntry.ts # packages/core/src/figma/sanitizeSvg.ts # packages/core/src/fonts/pageTree.ts # packages/core/src/generators/richTextHtml.ts # packages/engine/src/services/audioMixer.ts # packages/engine/src/services/videoFrameExtractor.ts # packages/parsers/package-subpaths.json # packages/parsers/package.json # packages/parsers/src/hfIds.ts # packages/parsers/src/timingMismatches.ts # packages/parsers/tsup.config.ts # packages/producer/src/services/animatedGifPrep.ts # packages/producer/src/services/compilationTester.ts # packages/producer/src/services/heifImagePrep.ts # packages/producer/src/services/htmlCompiler.ts # packages/producer/src/services/render/stages/probeStage.ts # packages/producer/src/services/render/videoFrameCoverage.ts # packages/producer/src/services/renderMediaCollector.ts # packages/studio-server/src/helpers/captureVideos.ts # packages/studio-server/src/helpers/compositionInputs.ts # packages/studio-server/src/helpers/compositionInsertion.ts # packages/studio-server/src/helpers/lazyPreviewImages.ts # packages/studio-server/src/helpers/previewReads.ts # packages/studio-server/src/helpers/sourceMutation.ts # packages/studio-server/src/helpers/subComposition.ts # packages/studio-server/src/routes/files.ts # packages/studio-server/src/routes/preview.ts # scripts/package-size-budgets.json
… lint error, not a crash
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
Edit accuracy: accurate 273 (base branch 271), smooth 53 of thoseThe gate passes. Newly passing (2)
Not banked yet, reported and not gated (bank a full-grid run's baseline.json) (2)
Quarantined, measured but not gated (0) Unstable (1)
|
terencecho
left a comment
There was a problem hiding this comment.
P2 — A parser refusal can still abort the whole lint run for a mounted file with a URL-encoded path (packages/lint/src/project.ts:359). mountedSources resolves the literal attribute with path.resolve, but the project-wide audio walk at lines 949–953 uses resolveCompositionSrc, which decodes URL paths. For example, a scene with an ordinary space in its filename can be missed by the unreadable-file preflight and still be opened by the audio walk. If the parser refuses that file, the walk throws and the CLI discards the findings collected so far.
Use the same composition path resolver for discovery and the project-wide walks. Add coverage for a mounted filename with a URL-encoded space and check that the lint report still includes the root findings.
The PR body names the fail-first tests. This finding is from static review.
— tai (automated review)
|
Fixed in b2e8757. New test in The full lint suite passes 3 runs in a row (30 files, 1364 tests), and the core, studio and scripts type checks are clean. |
terencecho
left a comment
There was a problem hiding this comment.
P2 — packages/lint/src/project.ts:357. The shared resolver closes the encoded-filename case. Mount discovery still applies the raw reference length limit while the duplicate-audio walk at line 949 resolves without that limit. The walks can disagree about which file to inspect because the resolver normalizes the reference. A parser refusal in a file skipped by discovery can still abort the report. Please share the mount eligibility check between the two walks.
Static review only. The diff check passed.
— tai (automated review)
What
hyperframes lintnow lists a file it cannot read the way a browser does as one error,html_read_unlike_browser, instead of stopping with that error. Every other file in the project is still linted. Checks that span the whole project (shared audio, missing assets, sub-composition use) are skipped while a mounted file is unreadable, because each of them reads every mounted file.Why
Since #8760, the shared HTML reader (
@hyperframes/parsers/linkedom) refuses HTML whosetitle,style,script,textareaorxmpinside an<svg>or<math>element holds tags or comments, which a browser reads as different markup. Lint reads through the same reader, so on such a filehyperframes lintprinted only the refusal and listed nothing, where before it listed the project's findings.Related work
Follows #8760, which added the refusal. This branch is stacked on it.
How
refusedFinding(html)inpackages/lint/src/hyperframeLinter.tsasks the shared reader and turns its refusal, and only that error, into an error finding. The reader still decides what is refused.lintHyperframeHtmlreturns that finding alone for such a page.lintProject(packages/lint/src/project.ts) does not read into an unreadable file (mountedSources,linkedSources, the font and composition lists). When any mounted file is unreadable, each one is reported once and the project-wide checks are skipped.docs/reference/lint-rules.mdxdescribes the new code.Visible change
hyperframes linton such a project:Before: the command prints the bare error message,
This HTML has tags or comments inside an SVG or MathML title, ..., and stops.After:
Both exit 1.
Test plan
fails without the fix: with the lint sources before this change, all 4 new tests fail: in
packages/lint/src/hyperframeLinter.test.ts,returns the refusal as its one error finding, instead of throwing; inpackages/lint/src/project.test.ts,reports a root page it cannot read as one error, instead of stopping,reports a mounted composition it cannot read, and still lints the rootandreports a mounted file outside compositions/ that it cannot read. With the fix they pass 3 runs in a row. The full lint suite passes (30 files, 1363 tests) and the lint type check is clean. The before and after output above isbun packages/cli/src/cli.ts lint <project>from source on a one-file project.