Skip to content

docs: Guard each chunk of the work-queue vignette so that checks without a server skip it - #679

Merged
krlmlr merged 1 commit into
v1.5-quillfrom
claude/vignette-eval-guard
Nov 29, 2026
Merged

krlmlr merged 1 commit into
v1.5-quillfrom
claude/vignette-eval-guard

Conversation

@krlmlr

@krlmlr krlmlr commented Nov 29, 2026

Copy link
Copy Markdown
Member

This implements the decision on #677 ("Fix guard.", #677 (comment)).

R CMD check runs the vignette's code by tangling vignettes/work-queue.Rmd afresh with knitr::purl() in a new process. That static tangle never runs the setup chunk, so the eval = RPostgres::postgresHasDefault() set there through knitr::opts_chunk$set() has no effect, every chunk is tangled as live code, and a check without a PostgreSQL server fails at dbConnect() when it runs the vignette's code (for instance with _R_CHECK_VIGNETTES_SKIP_RUN_MAYBE_=false, as in R-hub's gcc-asan run). The commented-out inst/doc/work-queue.R in a tarball built without a server does not help, because the check does not use it.

Chunk-header options are evaluated by the static tangle too, so this PR puts eval = RPostgres::postgresHasDefault() on each chunk after the setup chunk, keeping their other options, and drops the now redundant eval entry from opts_chunk$set() so that the guard lives in one kind of place.

Verified without a server: a static knitr::purl() gives no live dbConnect(); R CMD build and then R CMD check --no-manual with _R_CHECK_VIGNETTES_SKIP_RUN_MAYBE_=false report "running R code from vignettes ... OK" and Status: OK. With a local server, the vignette still renders with its output.


Generated by Claude Code

krlmlr commented Nov 29, 2026

Copy link
Copy Markdown
Member Author

Accepted limitations

A clean review found nothing above Low. Static knitr::purl() without a server leaves 0 live dbConnect() calls, and every server-dependent chunk is guarded, the three echo = FALSE cleanup chunks included.

  • vignettes/work-queue.Rmd#L36-L285: postgresHasDefault() runs once per chunk, 14 times. Without a server, each call prints the "Could not initialise default postgres database" message into the build or check log, and an unresponsive PGHOST would wait 14 times for the connection timeout. A cached probe cannot work here, because purl() does not run the setup chunk. Relevance: low. Confidence: high.
  • Same lines: availability is now checked per chunk instead of once per document, so a server that drops out mid-render can leave later chunks running against a NULL connection. Outside pkgdown, error = TRUE keeps the render going. Relevance: low. Confidence: medium.

Generated by Claude Code

@krlmlr
krlmlr merged commit c324cdb into v1.5-quill Nov 29, 2026
8 of 9 checks passed
@krlmlr
krlmlr deleted the claude/vignette-eval-guard branch November 29, 2026 21:27
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