Skip to content

Preserve Cargo workspace members' explicit authors - #5421

Open
Shrashti1234 wants to merge 1 commit into
aboutcode-org:developfrom
Shrashti1234:preserve-cargo-workspace-member-authors
Open

Shrashti1234 wants to merge 1 commit into
aboutcode-org:developfrom
Shrashti1234:preserve-cargo-workspace-member-authors

Conversation

@Shrashti1234

Copy link
Copy Markdown

Cargo workspace assembly currently replaces every member's authors with workspace.package.authors, even when the member has not requested inheritance. This can erase a member's explicit authors or attribute the workspace authors to a member that declares none.

For example, a member declaring authors = ["Member Author"] is reported with no authors when workspace.package only supplies version metadata. After this change its original author is preserved; authors.workspace = true continues to inherit the workspace authors, as specified in the Cargo workspace documentation.

Only update parties when the member's parsed metadata contains the authors inheritance marker. Add five end-to-end CLI cases covering explicit, inherited, and omitted authors with and without workspace authors. Update the existing boring workspace scan expectation to retain the authors already declared in its member manifests; all other expected fields are unchanged.

Validation on Windows / Python 3.14:

  • Original implementation: three of the five new cases fail; two pass.
  • Cargo suite excluding the separately failing Rust binary inspector case: 34 passed.
  • Full Cargo suite has one remaining failure, test_scan_works_on_rust_binary_with_inspector. This also fails before this change and produces no compiled packages in this local environment.
  • Ruff passed with the pre-existing D401 violation in get_parties excluded; git diff --check passed.

Signed-off-by: Shrashti1234 <sharishhtia@gmail.com>
@knowprasad

Copy link
Copy Markdown

Took a look through \src/packagedcode/cargo.py\ and the updated test fixtures.

Checking 'authors' in extra_data\ before overwriting \parties\ fixes the workspace inheritance logic nicely. Without that check, member crates were having their defined authors replaced by the workspace level package data even when they never set \�uthors.workspace = true.

The updated fixture expectations in \�oring.expected.json\ show the concrete difference clearly, restoring the individual crate authors across the member crates. The parametrized matrix in \ est_cargo.py\ covers the inheritance combinations well.

Clean fix and tests look solid!

This branch has not been deployed

No deployments
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