projection

package
v0.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 23, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Projection API — the language-level entry point for evidence produced in a foreign (non-CLC) format.

CLC-E is positioned as a *projection* of another evidence model, not as a competing evidence language: an external artefact (e.g. an EMILIA EP-AEC-REQUIREMENT-v1 object) is projected into the CLC decision view, and only then evaluated under CLC's own invariants (three-valued satisfaction, eligibility from natively verified facts, and so on). Projection never decides anything by itself, and everything it cannot carry is reported as a residual instead of being silently dropped.

Consumers such as a verifier or gateway call Project/ProjectAndEvaluate; the projectors themselves are registered by this package (see init.go).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(p Projector)

Register adds a projector. A nil (including a typed-nil pointer) projector or a duplicate non-empty ID is ignored: a later registration must not shadow an established mapping.

Types

type Context

type Context struct {
	Now       time.Time
	Initiator string
	Executor  string

	// RoleMap bridges a foreign role/component identifier to the CLC evidence
	// role facts are typed by.  A mapping is never guessed: the relying party
	// pins it (the same way an Action-Mapping Profile is pinned).  An entry
	// that is absent leaves the foreign identifier in place and surfaces a
	// residual instead of silently inventing a bridge.
	RoleMap map[string]string
}

Context carries the pins a projection needs.

type Options

type Options struct {
	// Now is the appraisal instant (zero means the wall clock).
	Now time.Time
	// RoleMap bridges foreign component identifiers to the CLC evidence roles
	// facts are typed by.  Without an entry the foreign name is kept and a
	// residual records the missing bridge.
	RoleMap map[string]string
	// Facts are the natively verified facts the projected requirement is
	// evaluated over.  Passing nil skips evaluation.
	Facts []semantics.EvidenceFact
}

Options carries the pins a projection needs. Nothing here is ever inferred from the document: a role bridge and the facts are both supplied by the relying party / native verifier that established them.

type ProjectedView

type ProjectedView struct {
	Action      *semantics.ActionId
	Facts       []semantics.EvidenceFact
	Requirement *semantics.Requirement
	Residuals   []string
	Meta        map[string]string
}

ProjectedView is the minimal view the CLC decision layer needs from an external evidence document.

func Normalize

func Normalize(raw []byte, ctx Context) (*ProjectedView, error)

Normalize projects raw evidence with the first projector that matches it.

type Projector

type Projector interface {
	ID() string
	Match(raw []byte) bool
	Project(raw []byte, ctx Context) (ProjectedView, error)
}

Projector recognises and projects one external evidence format.

func Find

func Find(raw []byte) Projector

func List

func List() []Projector

type Report

type Report struct {
	// ProjectorID names the mapping that recognised the document.
	ProjectorID string `json:"projectorId"`
	// SourceFormat is the foreign format the document declared.
	SourceFormat string `json:"sourceFormat,omitempty"`
	// Meta is the projector's provenance (source format, role bridges, mapping
	// timestamps).
	Meta map[string]string `json:"meta,omitempty"`
	// Requirement is the projected CLC-REQUIREMENT-v1 view.
	Requirement *semantics.Requirement `json:"requirement,omitempty"`
	// Facts are the projected evidence facts (often empty: a requirement
	// object carries no facts of its own).
	Facts []semantics.EvidenceFact `json:"facts,omitempty"`
	// Residuals lists what the projection could not carry onto a CLC axis.
	// Empty is not the goal: an honest list is more useful than a silent drop.
	Residuals []string `json:"residuals,omitempty"`
	// Satisfaction is the CLC verdict over the projected view.  It is nil when
	// no requirement was available to evaluate.
	Satisfaction *semantics.RequirementResult `json:"satisfaction,omitempty"`
}

Report is the observable result of projecting one external evidence document. It is deliberately a *report*: the projected requirement and facts, the residuals the mapping could not carry, and (when a requirement was supplied or configured) the CLC satisfaction verdict.

func Project

func Project(raw []byte, opts Options) (*Report, error)

Project recognises and projects one external evidence document. It returns an error only when no projector matches the document or the matched projector rejects it; an unmatched document is never an implicit allow.

func ProjectAndEvaluate

func ProjectAndEvaluate(raw []byte, facts []semantics.EvidenceFact, now time.Time) (*Report, error)

ProjectAndEvaluate projects a foreign document and evaluates the projected requirement over the supplied facts. Facts are passed in by the caller because eligibility belongs to the native verifier that established them — a projection never invents a verified fact.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL