Skip to content

feat(training): write attest:* tags through the evidence kernel (closes #38) - #39

Merged
scttfrdmn merged 1 commit into
mainfrom
feat/training-evidence-kernel
Jun 9, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
feat/training-evidence-kernel

Conversation

@scttfrdmn

Copy link
Copy Markdown
Collaborator

Closes #38. Phase-two Stream A, step 2 of ADR 0001 — epic hub provabl/evidence#2 — following the merged vet#7 (#9).

What changes

Training completion no longer becomes IAM tags via a mechanical moduleID → attest:* key map. The verdict is produced by running a Copland term Seq(Nonce, Seq(Meas, Sig)) through the evidence kernel's CVM, appraising it, and lowering the verdict to the attest:* attributes written via the same iamTagWriter.TagRole interface. The facts attest's principal resolver trusts are now appraised, not unconditional writes.

Design (Option B, mirrors vet)

qualify defines its own (ASP, appraiser) pair in-repo: internal/evidence (package qualifyasp), ASP id training, target scheme principal://. One PR; new dep github.com/provabl/evidence v0.1.0.

  • internal/evidence/provider.go — completion event injected via Provider(Input). Unmapped module → ev.NotApplicable (the kernel-native form of the old if !ok return nil). Appraiser judges score >= passingScore: pass emits attest:<module> + -expiry claims, fail emits none. Drift guard: keys arrive pre-resolved from tags.go (TagForModule/ModuleExpiryTag) and flow verbatim through lower — the appraiser never types an attest:* literal.
  • internal/evidence/trust.go — ephemeral per-run ed25519 AM (Signer+Store), as in vet.
  • internal/training/service.go — CompleteModule gains a passingScore param; writeAttestTags drives the CVM and funnels through tagsFromAttrs (the single attrs→[]iamtypes.Tag chokepoint, filtering on the attest: prefix so synthetic attested/training.* never leak).
  • tags.go — DefaultPassingScore = 80 (backend default; CLI overrides per-module). Tag constants + moduleTagMap unchanged.
  • call sites — CLI passes mc.PassingScore; backend passes DefaultPassingScore.

⚠️ Behavior change (deliberate, strictly safer)

A failing score now writes NO tags. Previously the backend handler called CompleteModule unconditionally and wrote attest:* tags even for failing scores — a latent false-attestation bug this fixes. The pass-case attest:* tag set + RFC3339 expiry on the wire is unchanged (the contract attest reads).

Tests

Provider: pass / fail-emits-nothing / unmapped-NotApplicable / freshness nonce-mismatch / expiry-format (golden key set). Service-level via mock tagger: pass-writes-tags / fail-writes-nothing / unmapped-writes-nothing. make check (gofmt + vet + staticcheck + short tests) green.

Relationships

  • Relates to Version the attest:* IAM tag schema shared between qualify and attest #32 (versioning the shared attest:* tag schema): this PR routes all key emission through the tags.go constants, lowering future drift cost; it does not implement versioning.
  • Follow-up to file: route SetIdentityTags (lab-id, admin-level) and RecordCountryCheck (country, coc-*) through the kernel too — out of scope here (training modules only).

#38)

Phase-two Stream A, step 2 of ADR 0001, following the merged vet#7. Training
completion no longer becomes IAM tags via a mechanical moduleID->key map: the
verdict is produced by running a Copland term Seq(Nonce, Seq(Meas, Sig)) through
the evidence kernel's CVM, appraising it, and lowering the verdict to the
attest:* attributes written via the same iamTagWriter.TagRole interface. The
facts attest's principal resolver trusts are now appraised, not unconditional.

Design (Option B, mirrors vet): qualify defines its own (ASP, appraiser) pair
in-repo (internal/evidence, package qualifyasp, ASP id 'training', target scheme
principal://). One PR; new dep github.com/provabl/evidence v0.1.0.

- internal/evidence/provider.go: the training pair. Completion event injected via
  Provider(Input). Unmapped module -> ev.NotApplicable (the kernel-native form of
  the old 'if !ok return nil'). Appraiser judges score>=passingScore: on pass emits
  the attest:<module> + -expiry claims, on fail emits none. Keys arrive pre-resolved
  from tags.go (TagForModule/ModuleExpiryTag) and flow verbatim through lower — the
  appraiser never types an attest:* literal (drift guard).
- internal/evidence/trust.go: ephemeral per-run ed25519 AM (Signer+Store), as in vet.
- service.go: CompleteModule gains a passingScore param; writeAttestTags drives the
  CVM and funnels through tagsFromAttrs (the single attrs->[]iamtypes.Tag chokepoint,
  filtering on the attest: prefix so synthetic 'attested'/'training.*' never leak).
- tags.go: add DefaultPassingScore=80 (backend default; CLI overrides per-module).
- call sites: CLI passes mc.PassingScore; backend passes DefaultPassingScore.

Behavior change (deliberate, documented): a failing score now writes NO tags.
Previously the backend handler called CompleteModule unconditionally and wrote
tags for failing scores — a latent false-attestation bug this fixes. The pass-case
attest:* tag set + RFC3339 expiry on the wire is unchanged (the contract attest
reads). Tag key strings remain sourced solely from tags.go (relates to #32).

Tests: provider pass/fail/unmapped-NotApplicable/freshness/expiry-format (golden
key set); service-level pass-writes / fail-none / unmapped-none via mock tagger.
make check (gofmt+vet+staticcheck+short tests) green.
@scttfrdmn
scttfrdmn merged commit d2ffc14 into main Jun 9, 2026
4 of 5 checks passed
@scttfrdmn
scttfrdmn deleted the feat/training-evidence-kernel branch June 9, 2026 02:04
@scttfrdmn
scttfrdmn restored the feat/training-evidence-kernel branch June 9, 2026 19:53
@scttfrdmn
scttfrdmn deleted the feat/training-evidence-kernel branch June 9, 2026 19:55
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.

Re-point training-tag writing onto provabl/evidence (qualify ASP: principal:// records)

1 participant