Skip to content

feat: evidence source provenance (EvidenceMapping) support - #840

Open
marcusburghardt wants to merge 4 commits into
complytime:mainfrom
marcusburghardt:opsx/evidence-source
Open

feat: evidence source provenance (EvidenceMapping) support#840
marcusburghardt wants to merge 4 commits into
complytime:mainfrom
marcusburghardt:opsx/evidence-source

Conversation

@marcusburghardt

@marcusburghardt marcusburghardt commented Sep 4, 2026

Copy link
Copy Markdown
Member

Summary

Plumb the Gemara #EvidenceMapping (source field) through complyctl's
entire evidence pipeline, enabling providers to report where evidence
was collected from.

Fixes #841

Context

The Gemara CUE schema (evaluationlog.cue line 73, auditlog.cue
lines 78-97) defines #Evidence with a source field of type
#EvidenceMapping that records evidence provenance -- which artifact,
which location within it, and a content digest. The go-gemara SDK already
exposes this as Evidence.Source. complyctl's proto API currently defers
this field with a comment referencing an unwritten "ADR 0023".

Changes

  • Proto API: Add EvidenceMapping message (reference_id,
    coordinate, entry_id, digest, remarks) and source field
    (field 6) on Evidence. Remove stale ADR 0023 comment.
  • Provider SDK: Add EvidenceSource struct and
    Source *EvidenceSource field on Evidence in pkg/provider/.
  • Proto mapping: internalEvidenceSourceToProto() in server.go
    and protoEvidenceMappingToInternal() in client.go.
  • Evaluator: Map provider.EvidenceSource to
    gemara.EvidenceMapping when constructing evaluation log entries.
  • Markdown: Render source provenance as source: <ref> @ <coord>
    in formatEvidenceMeta().
  • Test provider: Emit evidence with Source for E2E coverage.
  • Tests: Comprehensive coverage for both proto mapping directions,
    evaluator serialization (YAML + JSON), and markdown rendering.

Backward-compatible: providers that don't send source are unaffected.

OpenSpec Artifacts

  • openspec/changes/evidence-source/proposal.md
  • openspec/changes/evidence-source/specs/evidence-source/spec.md
  • openspec/changes/evidence-source/design.md
  • openspec/changes/evidence-source/tasks.md

Related

Comment thread openspec/changes/evidence-source/design.md Outdated
Add OpenSpec change artifacts for plumbing the Gemara EvidenceMapping
(source field) through complyctl's evidence pipeline. This enables
providers to report evidence provenance -- which artifact, location,
and content digest each evidence entry was collected from.

Artifacts:
- proposal.md: motivation and scope
- specs/evidence-source/spec.md: behavioral requirements
- design.md: technical decisions and approach
- tasks.md: implementation checklist

Assisted-by: OpenCode (claude-opus-4-6)
Signed-off-by: Marcus Burghardt <maburgha@redhat.com>
Refine Non-Goals to acknowledge go-gemara#127 tracks evidence-to-OSCAL
and evidence-to-SARIF conversion upstream. SARIF already delegates to
gemaraconv.ToSARIF() and will benefit automatically. Local OSCAL
formatter migration tracked in a separate complyctl issue.

Assisted-by: OpenCode (claude-opus-4-6)
Signed-off-by: Marcus Burghardt <maburgha@redhat.com>
Apply auto-fixes for findings from 6 Divisor spec reviewers:

- Normalize SHALL to MUST per AGENTS.md spec convention
- Add scenario for partial source fields (common real-world case)
- Add scenario for coordinate/entry_id passthrough (Gemara mutual
  exclusivity documented but not enforced by complyctl)
- Qualify YAML omission scenario with JSON serialization edge case
  (encoding/json does not omit zero-value structs)
- Add D5 design decision for passthrough model + digest format note
- Expand D3 with gemara value-type serialization note
- Task 1.1: add buf breaking check for backward-compat verification
- Task 2.2: acknowledge missing internalEvidenceToProto test coverage
- Task 3.2: add JSON serialization and YAML omission assertions
- Task 5.2: add schema validation and specific E2E assertions
- Add documentation tasks (CHANGELOG.md, AGENTS.md Recent Changes)

Assisted-by: OpenCode (claude-opus-4-6)
Signed-off-by: Marcus Burghardt <maburgha@redhat.com>
Add EvidenceMapping message to proto API and plumb the source field
through the entire evidence pipeline, enabling providers to report
where evidence was collected from.

Changes:
- Proto: add EvidenceMapping message with reference_id, coordinate,
  entry_id, digest, remarks fields; add source field (field 6) to
  Evidence message; remove stale ADR 0023 comment
- SDK: add EvidenceSource struct and Source *EvidenceSource field
  to provider.Evidence in pkg/provider/client.go
- Mapping: add internalEvidenceSourceToProto() in server.go and
  protoEvidenceMappingToInternal() in client.go for gRPC boundary
- Evaluator: map provider.EvidenceSource to gemara.EvidenceMapping
  when constructing evaluation log entries
- Markdown: render source provenance as 'source: <ref> @ <coord>'
  in formatEvidenceMeta()
- Test provider: emit evidence with Source for E2E coverage
- Tests: comprehensive coverage for both proto mapping directions,
  evaluator serialization (YAML + JSON), and markdown rendering

Backward-compatible: providers without source are unaffected.

Assisted-by: OpenCode (claude-opus-4-6)
Signed-off-by: Marcus Burghardt <maburgha@redhat.com>
@marcusburghardt
marcusburghardt marked this pull request as ready for review September 11, 2026 08:48
@marcusburghardt
marcusburghardt requested a review from a team as a code owner September 11, 2026 08:48
@marcusburghardt marcusburghardt added the enhancement New feature or request label Sep 11, 2026

@gxmiranda gxmiranda left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Clean, well-specified feature implementation that plumbs the Gemara EvidenceMapping through complyctl's entire evidence pipeline -- from proto definition through gRPC mapping, evaluator, and Markdown rendering. Comprehensive test coverage (both mapping directions, nil/partial/full cases, YAML/JSON serialization), backward-compatible design, and proper spec-first workflow with OpenSpec artifacts. All CI checks pass.

This review was generated by /review-pr (AI-assisted).

Comment thread api/plugin/plugin.proto

// Precise location within the referenced artifact (e.g. file path,
// API path, JSON path). Upstream Gemara schema documents this as
// mutually exclusive with entry_id; complyctl passes through without

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This was a documentation bug. Not mutally exclusive. Fixed in the next release.

Comment thread api/plugin/plugin.proto
// evidence was collected. Mirrors go-gemara EvidenceMapping.
message EvidenceMapping {
// Ties this evidence to a mapping-reference in the artifact's metadata
string reference_id = 1;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do plugins have awareness of a mapping reference? Would we prefer that they send us a list of their sources too?

@jpower432 jpower432 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Implementation looks good, but I see an issue with regard to reference-id. There doesn't seem to be a way to collect this actual reference from plugins and I don't think the host would have that information either.

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: support Evidence source provenance (EvidenceMapping) in provider API

4 participants