Skip to content

Fix quarto inspect standalone file project emission for RStudio#14307

Open
cderv wants to merge 4 commits intomainfrom
fix/inspect-rstudio-standalone
Open

Fix quarto inspect standalone file project emission for RStudio#14307
cderv wants to merge 4 commits intomainfrom
fix/inspect-rstudio-standalone

Conversation

@cderv
Copy link
Copy Markdown
Collaborator

@cderv cderv commented Apr 3, 2026

When publishing a standalone Quarto document from RStudio's publishing wizard with Quarto >= 1.9.35, the wizard crashes with "missing value where TRUE/FALSE needed".

Root Cause

Commit f6a0f89 (v1.9.35, fix for #14208) moved result.config = result.config || { project: {} } outside the if (renderOptions) block in singleFileProjectContext so Julia engine extensions resolve correctly during preview. Side effect: context.config is now always truthy for standalone files, so inspectDocumentConfig emits a project field with dir set to the file's parent directory.

RStudio's C++ bridge (SessionQuarto.cpp) reads project.dir from quarto inspect output and assumes _quarto.yml exists there. It adds the config file to the deploy list, file.info() returns NA for the non-existent file, and the size comparison crashes.

Fix

Gate project emission in inspectDocumentConfig on !(isSingleFile && isRStudio()). This preserves the "everything is a project" direction for non-RStudio consumers while maintaining compatibility with current RStudio releases.

Alternative Considered

Unconditionally suppressing project for all single-file contexts (!context.isSingleFile) would also fix the issue without RStudio detection. However, single-file projects are intentional internal behavior and other consumers may rely on the project metadata. The RStudio-specific gate is more targeted.

The RStudio-side fix is in rstudio/rstudio#17336 (merged) but will not be backported to older releases. This Quarto-side workaround protects users on older RStudio versions that upgrade Quarto independently.

Also adds _setIsRStudioForTest() override in platform.ts to avoid Deno.env.set() race conditions in parallel tests (#14218).

Test Plan

  • quarto inspect standalone.qmd with RStudio override: no project field in output
  • quarto inspect standalone.qmd without override: project field present with dir
  • Existing inspect tests pass (extensions, includes, code-cells, cleanup)

Ref: rstudio/rstudio#17333

cderv added 3 commits April 3, 2026 13:09
Also adds _setIsRStudioForTest() override to platform.ts to avoid
Deno.env.set() race conditions in parallel tests (#14218, PR #12621).
Current RStudio releases assume project.dir in quarto inspect output
implies a _quarto.yml exists. Since f6a0f89 (v1.9.35), standalone
files always get a project context for engine extension resolution,
which causes inspect to emit project.dir for standalone files. RStudio
then adds _quarto.yml to the deploy list, file.info() returns NA, and
the publishing wizard crashes.

Gate the project emission on !(isSingleFile && isRStudio()) so current
RStudio releases continue to work. The RStudio-side fix is in
rstudio/rstudio#17336.

Fixes rstudio/rstudio#17333
@cderv
Copy link
Copy Markdown
Collaborator Author

cderv commented Apr 3, 2026

@cscheid is that what you add in mind as a fix ?

I wanted to try gate this for RStudio Version, but I don't think it can be accessed easily unfortunately. So I just have a scoped build to hide project from inspect in rstudio.

But maybe you want to remove singleFile project info from inspect in all cases ?

I hesitated doing this, so happy to get your thought.

Also I have made the backport so current release 1.9 works in existing and old RStudio IDE

@cderv cderv requested a review from cscheid April 3, 2026 16:35
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