这是indexloc提供的服务,不要输入任何密码
Skip to content

fix(turbo_json): avoid workspace validation errors #10211

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

chris-olszewski
Copy link
Member

Description

#10083 introduced a bug where we swallow validation errors and end up silently ignoring these workspace turbo.json files. This PR fixes that by distinguishing a missing turbo.json from a failed read.

The bug stems from the fact that a missing file and a failed read were both errors so turbo_json.or(turbo_jsonc) could choose a missing turbo.json error (which is fine, not all workspaces need turbo.jsons) over a validation error for the file that is present. We replace .or with an extremely explicit match that goes through all the possible combinations.

Testing Instructions

Added unit test

Quick manual verification

[0 olszewski@macbookpro] /Users/olszewski/code/vercel/turborepo $ turbo_dev build   
 WARNING  No locally installed `turbo` found. Using version: 2.4.5-canary.6.
turbo 2.4.5-canary.6

turbo_json_parse_error

  × Failed to parse turbo.json.
  ╰─▶   × Found an unknown key `lol`.
          ╭─[cli/turbo.json:9:7]
        8 │     "rust-src": {
        9 │       "lol": true,
          ·       ─────
       10 │       "env": [
          ╰────

@chris-olszewski chris-olszewski requested a review from a team as a code owner March 21, 2025 15:33
Copy link

vercel bot commented Mar 21, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
examples-basic-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 21, 2025 3:33pm
examples-designsystem-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 21, 2025 3:33pm
examples-gatsby-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 21, 2025 3:33pm
examples-kitchensink-blog ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 21, 2025 3:33pm
examples-native-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 21, 2025 3:33pm
examples-nonmonorepo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 21, 2025 3:33pm
examples-svelte-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 21, 2025 3:33pm
examples-tailwind-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 21, 2025 3:33pm
examples-vite-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 21, 2025 3:33pm
turbo-site ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 21, 2025 3:33pm

Copy link
Contributor

@anthonyshew anthonyshew left a comment

Choose a reason for hiding this comment

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

Good find. Thanks, Chris!

@chris-olszewski chris-olszewski merged commit f063969 into main Mar 31, 2025
38 checks passed
@chris-olszewski chris-olszewski deleted the chrisolszewski/turbo-4606-look-into-task-definition-being-parsed-loose branch March 31, 2025 12:18
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