Skip to content
This repository was archived by the owner on Sep 2, 2026. It is now read-only.

fix: resolve renamed mutest binary targets - #697

Open
pomazanbohdan wants to merge 1 commit into
mainfrom
codex/propose-fix-for-mutest-bin-name-issue
Open

pomazanbohdan wants to merge 1 commit into
mainfrom
codex/propose-fix-for-mutest-bin-name-issue

Conversation

@pomazanbohdan

Copy link
Copy Markdown
Owner

Thinking mode: STC.

Motivation

  • The mutest target selector derived --bin names for crates/*/src/main.rs from the crate directory name, which is incorrect when the Cargo manifest declares a different binary name.
  • This caused generated commands like --package docflow-cli --bin docflow-cli to fail for crates where the binary is explicitly named (e.g. docflow-cli -> docflow).

Description

  • Change Get-CargoTargetArguments to accept a Package parameter and prefer resolving the binary name from Cargo metadata by matching a target's src_path to the normalized main.rs path.
  • Add Get-WorkspaceMetadata (replacing the previous package-name-only helper) to return parsed cargo metadata JSON and populate WorkspaceMetadata/WorkspacePackages for later lookups.
  • Update Get-MutestCommand and initialization sites to pass the package into Get-CargoTargetArguments and to populate WorkspaceMetadata before selection.
  • Add a focused regression test in scripts/tests/vida-mutest-audit.tests.ps1 that asserts docflow-cli maps to --bin docflow and taskflow-cli maps to --bin taskflow while retaining the existing vida case.

Testing

  • Ran cargo metadata --no-deps --format-version 1 --locked to confirm workspace metadata and target shapes were available and correct (succeeded).
  • Executed cargo check --package docflow-cli --bin docflow --locked and cargo check --package taskflow-cli --bin taskflow --locked to verify the resolved --bin names are accepted by Cargo (both succeeded).
  • Performed git diff --check, staged the two modified files, and committed the change as 423c3de with message fix: resolve renamed mutest binary targets (succeeded).
  • PowerShell-based test runner and PR creation could not be executed in this environment because pwsh is not installed and gh is not authenticated, so the ps1 test file cannot be executed here and no pull request was opened from this environment (not run).

Codex Task

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 807338cca1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

(Normalize-RepoPath ([System.IO.Path]::GetRelativePath($RepoRoot, $_.src_path))) -eq $normalized
} |
Select-Object -First 1)
if ($mainTarget.Count -eq 1) { return @("--bin", [string]$mainTarget[0].name) }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Invalidate cached rows when target metadata changes

When a manifest renames a binary target without changing its Rust source, this metadata lookup changes the generated --bin argument, but Get-FileRegistryPlan can still resume the previous completed row because compatibility only checks the source hash and the unchanged target_selector_policy = "auto-lib-bin-v1" config hash. Cargo target renames generally do not alter the source file or Cargo.lock, so the audit may silently retain results produced for the old target instead of exercising the newly resolved target; include the relevant target metadata in the compatibility hash or otherwise invalidate these rows when the mapping changes.

Useful? React with 👍 / 👎.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant