Skip to content

Turbo: lsp/markdownit/editor builds write outside declared outputs, so cache hits don't restore them #1144

Description

@nealrichardson

Problem

turbo.json declares the build outputs as ["dist/**", "out/**"], relative to each workspace. Several builds write into another workspace instead:

Workspace Writes to
apps/lsp (build.ts) apps/vscode/out/lsp/ (lsp.js, wasm, resources)
apps/vscode-markdownit (vite.config.ts) apps/vscode/out/markdownit/
apps/vscode-editor (vite.config.ts) apps/vscode/assets/www/editor/

Turbo only caches and restores declared outputs inside the task's own package, so on a cache hit for these tasks the files in apps/vscode are not restored. After a clean checkout or rm -rf out, a cached turbo run build can report success and leave apps/vscode without the LSP, the notebook renderer or the visual editor bundle.

This is presumably why vscode:prepublish uses turbo run build --force --filter quarto... (added in 5fd360d9, "force rebuild for vsce package"). --force disables the cache for the whole graph, and local dev builds can still produce this failure.

Fix options

  1. Preferred: have each workspace build into its own dist/, and have apps/vscode's build copy them into out/ and assets/. Then turbo's outputs are accurate, and --force can be dropped.
  2. Or declare per-package outputs with a path relative to the package (e.g. "outputs": ["../vscode/out/lsp/**"] in an apps/lsp/turbo.json). Turbo 1.x has limited support for outputs outside the package, so check this against Turbo 2, which the upgrade plan moves to anyway (deps-upgrade-turbo.md).
  3. Or mark these tasks cache: false.

Note that apps/vscode/assets/www/editor isn't in any outputs at all, so that one isn't cached even conceptually.

Found during the dependency-upgrade research.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions