Skip to content

Comments

feat(policies): add attestation phase lifecycle control#2765

Merged
migmartri merged 4 commits intochainloop-dev:mainfrom
migmartri:migmartri/policy-eval-lifecycle
Feb 20, 2026
Merged

feat(policies): add attestation phase lifecycle control#2765
migmartri merged 4 commits intochainloop-dev:mainfrom
migmartri:migmartri/policy-eval-lifecycle

Conversation

@migmartri
Copy link
Member

@migmartri migmartri commented Feb 20, 2026

supersedes #2762

Summary

  • Add AttestationPhase enum (INIT, PUSH) to the crafting schema proto to control when attestation policies are evaluated
  • Add attestation_phases field on PolicySpecV2 so policy authors can restrict evaluation to specific lifecycle phases
  • When no phases are specified, the policy runs at all phases (backwards compatible)
  • Policy evaluation is decoupled from the attestation status command — status is now a read-only observer that displays existing evaluations from crafting state
  • attestation init evaluates policies explicitly at INIT phase, attestation push evaluates at PUSH phase
  • Cross-phase results are preserved: PUSH-phase evaluation overwrites INIT results for the same policy, while INIT-only policies are kept intact

Closes #2764

Example

apiVersion: workflowcontract.chainloop.dev/v1
kind: Policy
metadata:
  name: final-approval-check
spec:
  policies:
    - kind: ATTESTATION
      path: approval-check.rego
      attestation_phases:
        - PUSH

…luation

Add an AttestationPhase enum (INIT, STATUS, PUSH) and an
attestation_phases field on PolicySpecV2 so policy authors can control
at which attestation lifecycle phase their policy is evaluated.

When no phases are specified the policy runs at all phases, preserving
backwards compatibility.

The init command now passes EvalPhaseInit when calling status after
initialization, so policies can distinguish between init-time and
explicit status-time evaluation.

Closes chainloop-dev#2764

Signed-off-by: Miguel Martinez <miguel@chainloop.dev>
…cross-phase results

Remove skipPolicyEvaluation in favor of eval phase hooks. Status always
evaluates and displays policy results from crafting state.
EvaluateAttestationPolicies now preserves attestation-level evaluations
from other phases instead of replacing them.

Signed-off-by: Miguel Martinez <miguel@chainloop.dev>
…cross-phase results

Remove skipPolicyEvaluation in favor of eval phase hooks. Status always
reads policy evaluations from crafting state regardless of evaluation.
EvaluateAttestationPolicies now preserves attestation-level evaluations
from other phases instead of replacing them.

Add WithSkipPolicyEvaluation to disable evaluation entirely while still
displaying existing results from state. Push uses this for its internal
status call and evaluates manually with EvalPhasePush afterward.

Signed-off-by: Miguel Martinez <miguel@chainloop.dev>
Remove the STATUS phase from the AttestationPhase enum, simplifying
the attestation lifecycle to INIT and PUSH. Policy evaluation is moved
out of the status action into the init action explicitly, following
the same pattern push already uses. The status command becomes a pure
read-only observer that displays existing evaluations from crafting state.

Signed-off-by: Miguel Martinez <miguel@chainloop.dev>
@migmartri migmartri requested a review from tknura February 20, 2026 16:03
@migmartri migmartri merged commit c1c719b into chainloop-dev:main Feb 20, 2026
13 checks passed
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.

Add attestation phase lifecycle control to policy evaluation

2 participants