Skip to content

Use proper TOML parser for Cargo workspace parsing #13

Description

@lambda-alpha-labs

Problem

The parse_cargo_toml function in src/extract/ci.rs uses manual line-by-line string parsing to extract test targets and workspace structure. While stable for typical configurations, this approach can fail on:

  • Multiline arrays (e.g., long workspace member lists)
  • Inline tables
  • Complex nested TOML structures common in enterprise monorepos

Current code

else if trimmed.starts_with("[[test]]") {
    in_test_section = true;
    has_test_targets = true;
}

Proposal

Add the toml crate as a dependency and fall back to proper TOML deserialization when the line-based parser cannot extract a valid structure. The line-based parser should remain as the fast path for typical configurations.

Acceptance

  • Complex TOML workspace structures parse correctly
  • No regression on simple Cargo.toml files (existing tests pass)
  • Fast path (line-based) remains default for trivial cases

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions