Repository navigation
fix: inert bounds how far text directives read, and counts a ::: closer only where it closes - #111
Merged
Merged
Conversation
…er only where it closes From review R7 of #102. Text directives: the limit counted where one could start (`:` before a letter), not how far each read. - 200 `:a{#` before 990,000 characters passed it and took 2.4 s a reading. Behind a fence inside an HTML block, which opens nothing, 2,000 took 3 s. - A table of `/pages/:page_id` routes, `std::` code and log lines turned a whole page into a code block. - Now each `:name{` reads on to its `}`, or to its paragraph's end, across lines. What they all read is bounded in the whole text (2,000,000), in code too. Asides: a `:::` closer indented four spaces, or in another quote, closed nothing in micromark but was counted as closing. 10,000 nested ran about 100 s. A closer now counts only under four spaces of indent, in the same quote as its opener. Co-Authored-By: Truong Le Vinh Phuc <truonglevinhphuc2006@gmail.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes R7-1 (High), R7-2 (High) and R7-5 from the review of #102–#104. All of it is in the cost guard in
packages/core/src/inert.ts, which publishes a page as one inert code block rather than spend seconds parsing it.Text directives (R7-1, R7-5)
:::nested inside a quote or never closed, are too costly to parse #102 counted where a text directive could start::before a letter, 200 a paragraph. Timing micromark shows the cost is how far each one reads. A:name{scans its attributes on to the}, or to the end of its paragraph, across lines and through#,.and{. Per reading::a{#×10,000: 11.5 s:a{#+ 990,000 chars: 2.4 s, passed the old limit<div>+ fence, which opens nothing: 3 s:name[, a bare:name,std::, CSSa:hover{…}, and a:page_idtable: milliseconds, though the old count turned the table into a code block:name{adds what it reads, up to its}or its paragraph's end, and the whole text is bounded at 2,000,000. It's counted in code too, because of the HTML-block fence trick.:-count limits are gone. A table of 300:page_idroutes, 2,500 lines of C++std::, 2,500 CSS:hover{…}rules, 3,000INFO:root:lines, and 100 paragraphs each with an unclosed:kbd{#…are all parsed normally.Asides (R7-2)
:::closer indented four or more spaces is code, and one inside a quote can't close an aside opened outside it. Both were counted as closing, so":::a\n :::\n" ×10,000nested 10,000 deep (about 100 s) while the guard saw depth 1.Evals: the reviewer's inputs and the variants above, in the costly and normal sets. 6 new mutants; the 2 count mutants removed and 1 aside mutant repointed (404). All inert.ts mutants are red.
Gate: typecheck clean, 776 evals passed.
Co-Authored-By: Truong Le Vinh Phuc truonglevinhphuc2006@gmail.com