Repository navigation
web: a document without <html>/<body> extracts with no browser (board #142); load-independent harness tests - #380
Merged
Merged
Conversation
…the harness tests wait for their fake claude Board #142. linkedom builds only the structure a document's tags spell out, and HTML lets a page leave out <html> or <body>. When it does, linkedom makes the page's first element the root and sets the rest of the page beside it, or leaves the content beside an empty body. For rfc-editor's RFCs, a run of bare <pre> blocks, Defuddle then found 0 words. Only the Chromium render recovered them, so a host without Chromium saved an empty page. Such a document is now rebuilt with the tags a browser supplies. Its parsed nodes move into a fresh document with importNode: the leading head elements into <head>, the rest into <body>. The <html> and <body> attributes are copied. Nothing is written out and parsed again. A document whose content is all in its <body> is parsed once, as before. The branch's first cut serialized the nodes and parsed the result. The review found that lossy, because linkedom writes a title's decoded text and attribute values unescaped. An escaped "</title><script>" in a title opened a script that swallowed the page. Across 50 saved documents only RFC 8439 changes, from 0 words to 14,648, the render's count. Live under WEB_CHROME=none it saves with no render. The eval harness tests: test_a_process_deaf_to_the_interrupt_is_killed and its sibling sent SIGINT at a 1 s limit counted from Popen. On a loaded machine the signal could reach the fake claude before it had set up its SIGINT handling, and the test failed. Popen now returns once the fake claude writes to a ready pipe, so the limit runs from there. With a 3 s start simulated, the old tests fail every time and the new ones pass. Sminos-Session: web-fetch-plugin#700c5e84 (doperpowers on macbook)
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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.
This PR covers board #142, a fix for the eval harness test flake, and a tech-debt entry. It ships at web 0.2.2, rebased onto main after #375 (render driver) and #377 (fetch hardening). The design's Decision Log (
docs/doperpowers/specs/2026-10-25-web-fetch-design.md) has the decision and its evidence.What behaves differently
A document without
<html>/<body>extracts with no browser (board #142). linkedom builds only the structure a document's tags spell out, and HTML lets a page leave those tags out.<pre>blocks, Defuddle then found 0 words. Only the Chromium render recovered them, so a host without Chromium saved an empty page.importNode: the leading head elements into<head>and the rest into<body>. The<html>and<body>attributes (lang) are kept. Nothing is written out and parsed again.<body>is parsed once, as before, even with scripts or styles outside it.WEB_CHROME=none node web/bin/clip.mjs fetch https://www.rfc-editor.org/rfc/rfc8439.htmlnow saves 14,648 words, not rendered, with no note. main's bundle saves 0 words with the note "rendering unavailable on this machine".The eval harness timing tests no longer depend on machine load.
test_a_process_deaf_to_the_interrupt_is_killedand its siblingtest_the_limit_interrupts_so_the_result_line_is_writtensent SIGINT at a 1 s limit counted fromPopen. On a loaded machine that signal could reach the fakeclaudebefore it had set up its SIGINT handling. The fix is in the test only, with the harness unchanged:ReadyPopenreturns once the fake child writes to a ready pipe, so the limit runs from there.The sibling had the same race, so I fixed both. The Chromium render tests' 30 s limit is unchanged, since it is the product's limit.
Decisions and alternatives
<html><body>would put<title>and<meta>in the body. It would also nest a second<html>for a page that has<html>but no<body>. Walking the top-level nodes is what a browser's parser does with omitted tags.<title>How </title><script></title>opened a script that swallowed the article (93 words became 0), and&copy;in an attribute became©. The nodes now move instead.<html>, or content outside<head>/<body>other than scripts, styles, comments and whitespace. On the first cut, a page with a script after</html>(blog.cloudflare.com, eval synthesis-5) took the rebuild path with identical output; it now parses once, as before.Verified
bash web/tests/run.shon the rebased commit 8add3cb: exit 0. That is 137 clipper tests with 0 skipped (Chromium present), the bundle matching its source, 53 mod tests, and 55 eval tests.ci-gateon 8add3cb is GREEN: https://github.com/SSFSKIM/doperpowers/actions/runs/40234402909fixtures/bare-pre.html(the opening of RFC 8439 as served) underWEB_CHROME=none.<body>; no<head>/<body>; no tags at all; no<html>) give the same body, title, description and language as the full page. The page carries the review's escaped title and&attribute. All four variants take the rebuild path. The test fails on the serializing first cut.extract.ts.WEB_CHROME=none, as above, with the rebased bundle.Also
<span>near the top of a page can still be cut out of its sentence ("Package metadata as of."). I checked this on the registry fixture with the<time>swapped for a<span>.Sminos-Session: web-fetch-plugin#700c5e84 (doperpowers on macbook)