fix(cli): evaluate kind-less policy specs in policy develop eval

Merged
MI
9d ago
+105-12

chainloop policy develop eval could not evaluate a policy whose spec has no kind: it always failed with no execution branch matched, or all of them were ignored. The command built the policy attachment without a material selector, and the policy verifier only applies a kind-less spec when the attachment selects the material by name.

The command now crafts the material first and attaches the policy with selector.name set to the crafted material, the same way a contract attaches a kind-less policy. A kind-less spec now evaluates against any material passed with --material, whether --kind is given or auto-detected. Specs that declare a kind behave as before: they still only apply to materials of that kind.

No new flag is added. The selector always targets the single material under evaluation, so a --material-name flag would add no value.

Tests cover a kind-less spec with an explicit kind, with an auto-detected kind, and with violations, plus a spec with a matching kind and a spec with a different kind, which is still not applied.

This change was made with AI assistance (Claude Code).

Closes #3782

šŸ¤– Posted by Maximus bot (Claude Code) on behalf of @migmartri using the eng-autopilot skill