Skip to content

Nested Cargo detection reports only one root when a repo has several disjoint crate directories #148

Description

@andrew

#139 finds a nested Cargo.toml when there is no root one, but stops after the first. A repo with several independent crate roots (not workspace members of each other) reports only one in manifests[], so the bridge tools and dependencies from the others are missed.

$ brief --json https://github.com/huggingface/tokenizers | jq '[.manifests[]|select(.ecosystem=="cargo")|.path]'
["tokenizers/Cargo.toml"]
$ git -C tokenizers ls-files -- '**/Cargo.toml'
bindings/node/Cargo.toml
bindings/python/Cargo.toml
bindings/python/tools/stub-gen/Cargo.toml
tokenizers/Cargo.toml

bindings/python/Cargo.toml has pyo3 and bindings/node/Cargo.toml has napi, so tools.native_extension stays empty and dependencies[] misses both.

Repos where git ls-files -- '**/Cargo.toml' finds a root that is not under any directory brief listed:

repo brief found git ls-files also finds
https://github.com/huggingface/tokenizers tokenizers/ bindings/python/ (pyo3), bindings/node/ (napi)
https://github.com/safetensors/safetensors safetensors/ bindings/python/ (pyo3)
https://github.com/elastic/elasticsearch libs/parquet-rs/native/ x-pack/plugin/esql-datasource-parquet-rs/native/
https://github.com/datadog/dd-trace-py src/native/ src/native_heap_gotter/
https://github.com/wandb/wandb parquet-rust-wrapper/ experimental/rust-sdk/, xpu/
https://github.com/facebook/watchman watchman/cli/ watchman/rust/serde_bser/, watchman/rust/watchman_client/
https://github.com/lief-project/lief tools/ api/rust/crates/ (workspace)
https://github.com/google/flatbuffers rust/flatbuffers/ rust/flexbuffers/, rust/reflection/

Separately, https://github.com/eventual-inc/daft has a root Cargo.toml (workspace, 70+ members) that brief does not list; manifests[] contains the root Cargo.lock and three member crates but not the root Cargo.toml:

$ brief --json https://github.com/eventual-inc/daft | jq '[.manifests[]|select(.ecosystem=="cargo")|.path]'
["Cargo.lock","src/daft-ext/Cargo.toml","src/daft-ext-macros/Cargo.toml","src/daft-functions-json/Cargo.toml"]

A root manifest should always appear regardless of the nested-detection path.

The current walk seems to seed from the first .rs hit and stop once it reaches a Cargo.toml. Collecting every Cargo.toml reachable within -scan-depth and then pruning those that are workspace members of an already-found root would cover these without also listing every member manifest.

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