Skip to content

fix(engine): look a host up again after a failed lookup instead of refusing it for the whole page - #7751

Open
miguel-heygen wants to merge 2 commits into
mainfrom
fix/render-page-lookup-retry
Open

miguel-heygen wants to merge 2 commits into
mainfrom
fix/render-page-lookup-retry

Conversation

@miguel-heygen

Copy link
Copy Markdown
Collaborator

What

With PRODUCER_RESTRICT_PAGE_NETWORK=true, a host whose name lookup fails is refused for that request and looked
up again on the next one. Before, the failure was cached as a refusal for the rest of the page.

Why

Stacked on #7748, from its review. One transient DNS failure on a public host (a web font, a remote video, a CDN
script) would otherwise block every later request to that host for the rest of a long render, while Chrome on its
own would have retried. The asset would go missing from the output without the render failing.

Related work

Refs #7748 (base of this PR; GitHub retargets it to main when #7748 merges).

How

  • pageNetworkPolicy.ts: the host check returns "public" | "non-public" | "unresolved" instead of a boolean.
    Answers about resolved addresses stay cached for the page. An "unresolved" answer is dropped from the cache
    once it settles, so the next request to that host asks again. A request already waiting on the same lookup
    shares its answer.

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

New test in pageNetworkPolicy.browser.test.ts (real headless Chrome): a name whose first lookup fails is
refused once, then allowed when the next lookup answers with a public address. The second request reaches the
target server; the first does not.

Fails without the fix: with the cache-drop line removed, the new test fails (1 of 1). With restrictPageNetwork
replaced by a no-op, the file fails 6 of 8.

Both test files pass 10 of 10, three runs in a row on Linux; tsc, oxlint and oxfmt --check pass.

Not exercised: Windows and macOS hosts; a real DNS failure (the test injects one through the resolver).

@heygengenesis heygengenesis Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Verdict: REQUEST CHANGES · 1 blocker · 0 important · 0 nits · head 4da32b17

The fix itself is right: only a failed lookup is forgotten, and requests already waiting share it. The one blocker is the red Comments run (inline).

Scope

Reviewed the delta on #7748 (a6037e14..4da32b17, 2 files). This PR is stacked, so the CI workflow (lint, typecheck, tests) has not run on it. Locally against chrome-headless-shell 157, both test files pass 10/10, three runs in a row. With the cache-drop line removed, the new test fails (1 of 1), which matches the fails-without-the-fix line.

verdicts.set(target.hostname, verdict);
const asked = hostVerdict(host, resolveHost);
verdicts.set(host, asked);
// A failed lookup can be a passing blip, so only answers about resolved addresses are kept.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

blocker: this line fails the Comments workflow's ratchet: RAISED comment share: packages/engine/src/services/pageNetworkPolicy.ts is 5.3% (4/76), at the base 4.5% (3/66). Drop it (that gives 3/75), or carry the reason in a name instead, e.g. a forgetFailedLookup helper. The test name already pins the behaviour.

Suggested change
// A failed lookup can be a passing blip, so only answers about resolved addresses are kept.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in 9d5edce: the comment is gone and the reason lives in a forgetFailedLookup helper. comment-ratchet.mjs with COMMENT_CHECK_BASE at a6037e1 now reports the file at or under its share. Both test files pass 10/10 three runs in a row, and the retry test fails with the helper body removed.

Base automatically changed from fix/render-page-address-rules to main November 14, 2026 16:58
@mintlify

mintlify Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

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

Project Status Preview Updated
hyperframes 🟢 Ready View Preview Nov 14, 2026, 5:05 PM

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

This branch was successfully deployed

1 active deployment
staging - docs — b1d3b1dc Deployed Nov 14, 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.

1 participant