Skip to content

feat(policies): inject per-evaluation project context for chainloop.* built-ins#3094

Merged
migmartri merged 1 commit intochainloop-dev:mainfrom
migmartri:feat/engine-project-context-builtins
May 5, 2026
Merged

feat(policies): inject per-evaluation project context for chainloop.* built-ins#3094
migmartri merged 1 commit intochainloop-dev:mainfrom
migmartri:feat/engine-project-context-builtins

Conversation

@migmartri
Copy link
Copy Markdown
Member

Summary

Adds engine-level project name + version that propagates into the per-evaluation context.Context so chainloop.* built-ins (e.g. chainloop.findings, chainloop.project_compliance) can scope their queries automatically without the rego author writing project metadata in the policy.

  • New engine.WithProjectContext(name, version) option, propagated to built-ins through bctx.Context via builtins.WithProjectContext / ProjectContextFromContext helpers.
  • Crafter passes project context to every NewPolicyVerifier / NewPolicyGroupVerifier call (material verification and attestation-level evaluation) by reading workflow metadata.
  • chainloop policy develop eval gains --project / --project-version flags so authors can supply the same context locally.
  • Schema relaxation and runtime fill-in for the affected built-ins themselves live in EE and will consume this OSS plumbing in a separate change.

Closes #3090

… built-ins

Adds engine-level project name + version that propagates into the
per-evaluation context.Context so chainloop.* built-ins can scope their
queries (e.g. chainloop.findings) without the rego author having to pass
project metadata explicitly.

The crafter populates the context from workflow metadata for both
material and attestation-level policy evaluation, and `chainloop policy
develop eval` gains `--project` / `--project-version` flags so authors
can supply the same context locally.

Refs: chainloop-dev#3090

Assisted-by: Claude Code
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 11 files

@jiparis
Copy link
Copy Markdown
Member

jiparis commented May 5, 2026

awesome! I managed something similar just for ATTESTATION materials (since they bring the project already). This is smarter.

@migmartri migmartri merged commit e15c8d6 into chainloop-dev:main May 5, 2026
15 checks passed
@migmartri migmartri deleted the feat/engine-project-context-builtins branch May 5, 2026 15:34
@migmartri
Copy link
Copy Markdown
Member Author

awesome! I managed something similar just for ATTESTATION materials (since they bring the project already). This is smarter.

Yep I know, I thought it was possible but then I realized is only available for attestation-type policies :)

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.

Engine-injected project context for chainloop.* built-ins

2 participants