Skip to content
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

Error parsing Cargo.toml file due to ZoD schema validation error #32528

Closed
rarkins opened this issue Nov 14, 2024 Discussed in #32523 · 7 comments · Fixed by #32533
Closed

Error parsing Cargo.toml file due to ZoD schema validation error #32528

rarkins opened this issue Nov 14, 2024 Discussed in #32523 · 7 comments · Fixed by #32533
Assignees
Labels
manager:cargo Cargo/Rust/crates.io priority-1-critical A bad bug or work that is holding up a lot of other important features or fixes regression Issue about a regression bug, or the PR caused it type:bug Bug fix of existing functionality

Comments

@rarkins
Copy link
Collaborator

rarkins commented Nov 14, 2024

Discussed in #32523

Originally posted by rami3l November 14, 2024

How are you running Renovate?

A Mend.io-hosted app

If you're self-hosting Renovate, tell us which platform (GitHub, GitLab, etc) and which version of Renovate.

No response

Please tell us more about your question or problem

Coming from Rustup, we are using the following configuration WRT cargo dependencies:

        {
            "matchManagers": [
                "cargo"
            ],
            "matchUpdateTypes": [
                "patch"
            ],
            "enabled": false
        },
        {
            "matchManagers": [
                "cargo"
            ],
            "matchUpdateTypes": [
                "minor"
            ],
            "matchCurrentVersion": "!/^0/",
            "enabled": false
        },

https://github.com/rust-lang/rustup/blob/c8eddcb4c1dc9aea8067fa73179ce1791aa24d1d/.github/renovate.json#L24-L41

... and we set the lock file maintenance to be executed every Monday. It used to be working alright, at least till the point of 2024/10/28 (rust-lang/rustup#4066), but after that I can no longer see cargo on the dependency dashboard (rust-lang/rustup#3142, you can refer to the editing history of that post as well). The logs say the same:

INFO: Dependency extraction complete
{
  "baseBranch": "master"
  "stats": {
    "managers": {
      "dockerfile": {
        "fileCount": 23,
        "depCount": 23
      },
      "github-actions": {
        "fileCount": 10,
        "depCount": 107
      }
    },
    "total": {
      "fileCount": 33,
      "depCount": 130
    }
  }
}

Many thanks in advance!

@rarkins rarkins added type:bug Bug fix of existing functionality priority-1-critical A bad bug or work that is holding up a lot of other important features or fixes manager:cargo Cargo/Rust/crates.io regression Issue about a regression bug, or the PR caused it labels Nov 14, 2024
@rarkins
Copy link
Collaborator Author

rarkins commented Nov 14, 2024

I added the rustup toml/lock to fixtures in #32529 so that we have a "failing" case to then fix

@rami3l
Copy link
Contributor

rami3l commented Nov 14, 2024

@rarkins Thanks a lot for the quick response!

Looking at:

It seems to be caused by a Zod validation error:

DEBUG: Error parsing Cargo.toml file (repository=rust-lang/rustup, packageFile=Cargo.toml)
...
         "issues": {"package": {"version": "Expected string, received object"}}

#32523 (comment)

The direct cause of this issue on our side seems to be the migration to workspace-wide properties (rust-lang/rustup@72e2e76).

@mkniewallner
Copy link
Contributor

Sorry for that, I've attempted a fix in #32530. This basically comes from:

[package]
version.workspace = true

The schema always expects a string for package.version, did not notice that it could also be an object.

@rami3l
Copy link
Contributor

rami3l commented Nov 14, 2024

Sorry for that, I've attempted a fix in #32530. This basically comes from:

[package]
version.workspace = true

The schema always expects a string for package.version, did not notice that it could also be an object.

@mkniewallner I'm not sure about how this project consumes manifest schemata in general, but we do have a schema for Cargo.toml right now, if it helps: https://github.com/rust-lang/cargo/blob/3ad481e749f64e43041d4c7145906b5ef1c16532/crates/cargo-util-schemas/manifest.schema.json

@viceice
Copy link
Member

viceice commented Nov 14, 2024

Sorry for that, I've attempted a fix in #32530. This basically comes from:

[package]
version.workspace = true

The schema always expects a string for package.version, did not notice that it could also be an object.

@mkniewallner I'm not sure about how this project consumes manifest schemata in general, but we do have a schema for Cargo.toml right now, if it helps: https://github.com/rust-lang/cargo/blob/3ad481e749f64e43041d4c7145906b5ef1c16532/crates/cargo-util-schemas/manifest.schema.json

Nice, @zharinov So you know a way to validate a zod schema agains a json schema? that would probably helpful

@rami3l
Copy link
Contributor

rami3l commented Nov 17, 2024

@viceice Thanks a lot for the hard work! May I ask when I am expected to get this fix on Mend.io-hosted instances though?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
manager:cargo Cargo/Rust/crates.io priority-1-critical A bad bug or work that is holding up a lot of other important features or fixes regression Issue about a regression bug, or the PR caused it type:bug Bug fix of existing functionality
Projects
None yet
4 participants