Skip to content

docs: document embedded viewer preview-testing harness - #14870

Merged
cderv merged 4 commits into
mainfrom
docs/preview-embedded-viewer-harness
Sep 9, 2026
Merged

cderv merged 4 commits into
mainfrom
docs/preview-embedded-viewer-harness

Conversation

@cderv

@cderv cderv commented Sep 9, 2026

Copy link
Copy Markdown
Member

Verifying #14869 needed a way to exercise code in src/webui/quarto-preview/src/frame/ that only runs inside an embedded viewer (RStudio Viewer, VS Code Simple Browser, Posit Workbench). A plain top-level preview never reaches it, and quarto-cli has no e2e test that starts quarto preview at all (tracked in #10696).

Adds a reference to the quarto-preview-test skill covering the iframe + postMessage host page pattern, a throwaway reverse proxy for reproducing a proxied deployment's browser/server origin mismatch, the server's first-request client-injection detection, and the precondition assertion needed before trusting any click result.

Related to #14869, #10696.

Adds a reference for testing code in src/webui/quarto-preview/src/frame/
that only runs inside an embedded viewer (RStudio Viewer, VS Code Simple
Browser, Posit Workbench) - a plain top-level preview never exercises it.
Covers the iframe + postMessage host page pattern, a throwaway reverse
proxy for reproducing a proxied deployment's browser/server origin
mismatch, the server's sticky first-request client-injection detection,
and the precondition assertion needed before trusting any click result.
@posit-snyk-bot

posit-snyk-bot commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

The harness reference told testers to pre-render the project and to avoid a
leading underscore on the parent page. Both were wrong: verified on a website
project that `quarto preview` copies files declared under `project.resources:`
to the output directory on its own, including `_host.html`, and serves them
without consuming the first-request client-injection detection. The underscore
exclusion applies to input-file and YAML discovery, not to explicitly declared
resources.

Also records why a static parent is safe at all (the server only injects into
output files that map back to an input) and adds --no-browser, without which
the auto-opened browser makes the unmarked first request itself.
…ness

The previous wording only warned against unmarked requests to rendered paths,
but the 404 handler in src/project/serve/serve.ts also calls injectClient.
Verified: a single unmarked request to a missing path, sent before the marked
iframe request, leaves the injected options empty (origin: "", search: "") -
the same symptom the section already documents a restart for. The control case,
requesting the already-copied static parent page first, keeps them populated.

Readiness now waits on the preview output rather than an HTTP poll, since the
poll is itself the unmarked request and the parent page's path 404s until the
first render finishes.
Nothing under .claude/ (skills, rules, commands, agent memory files) can
affect build or test outcomes, so running smoke, bundle, feature-format,
latexmk and performance jobs for those PRs burns runner time for no signal.

test-install.yml keeps its paths allowlist and already never matched.
@cderv
cderv merged commit 5437792 into main Sep 9, 2026
9 of 51 checks passed
@cderv
cderv deleted the docs/preview-embedded-viewer-harness branch September 9, 2026 11:03
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