feat(engine): add the attestation-evidence envelope seam#8551
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8551 +/- ##
=======================================
Coverage 92.51% 92.51%
=======================================
Files 794 795 +1
Lines 79551 79607 +56
Branches 24036 24055 +19
=======================================
+ Hits 73593 73645 +52
Misses 4800 4800
- Partials 1158 1162 +4
Flags with carried forward coverage won't be shown. Click here to find out more.
|
f12b1bf to
187618b
Compare
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
187618b to
92a9093
Compare
Adds packages/loopover-engine/src/calibration/attestation-envelope.ts with the three exports the attested-evaluation epic needs before any TEE infrastructure exists: the AttestationEnvelope type, buildAttestationReportData (lowercase-hex sha256 of corpusChecksum:headSha:baseSha, mirroring backtest-split.ts's createHash usage), and validateAttestationEnvelope, a structural validator that never throws and names every failing field path. Structural validation only -- no cryptographic verification of the attestation report, no new dependencies, no src/** wiring, and no changes to existing calibration modules. One barrel line, plus a root vitest mirror so the module's coverage is visible to Codecov alongside the engine's own node:test twin. Closes JSONbored#8541
|
Tip ✅ LoopOver review result - approve/merge recommendedReview updated: 2026-07-24 20:49:07 UTC
Review summary Nits — 5 non-blocking
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://loopover.ai/docs/loopover-commands 🧪 Experimental — new and may change. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
Summary
Adds the typed evidence seam the attested-evaluation epic needs before any TEE infrastructure exists, so the later runner work attaches evidence to backtest runs instead of inventing an ad-hoc object at the call site.
New file
packages/loopover-engine/src/calibration/attestation-envelope.tsexporting exactly three things:AttestationEnvelope—schemaVersion: 1(literal),teeTechnology: "sev-snp" | "tdx",runtimeClass(non-empty, ≤128),measurement(lowercase hex, 32–128),reportData(lowercase hex, exactly 64),attestationReport(base64, non-empty, ≤65536), and a discriminatedverificationunion (unverified/verified/failed).buildAttestationReportData(binding)— lowercase-hex sha256 of`${corpusChecksum}:${headSha}:${baseSha}`vianode:crypto, mirroringbacktest-split.ts's existingcreateHashusage. No new dependency.validateAttestationEnvelope(value)— structural validation returning{ valid: true, envelope }or{ valid: false, errors }, naming each failing field path. Never throws for any input —null, primitives, arrays,Symbol,BigInt, and objects with extra keys all return a result. Extra keys are rejected by name rather than ignored, since this is persisted evidence and silently dropping an unrecognized field would lose data a futureschemaVersionmay depend on.Plus one barrel line in
packages/loopover-engine/src/index.ts, matching the existing calibration exports.Scope held exactly to the issue's boundary: structural validation only — no cryptographic verification of the attestation report, no
src/**wiring, no new dependencies, and no changes to any existing calibration module. Verifying a TEE vendor's signature chain / measurement allow-list / report freshness is later maintainer work in the parent epic; implementing any of it here would bake a verification policy into what is meant to be a transport shape.Coverage
100% of the new module — lines, statements, functions, and branches (vitest
json-summary, the authoritative reporter):Every rule is exercised on both arms as the issue requires — accept at the boundary, reject just past it:
runtimeClass128 vs 129;measurement32/128 vs 31/129, plus uppercase-hex and non-hex;reportData64 vs 63/65;attestationReportat the 65536 cap vs 65537, empty, and non-base64; eachverificationvariant valid, and each with a missing/empty/invalid member; a valid envelope plus an extra key.buildAttestationReportDatais pinned against a precomputed vector (sha256("abc123:head456:base789")) so a change to the binding format — which would silently invalidate every previously-attested run — fails here rather than shipping.Coverage is Codecov-visible via the root-vitest mirror (
test/unit/attestation-envelope-engine.test.ts) importing the engine source path directly — the same seam #8438 used forsignal-tracking.ts, since the engine's ownnode:testsuite runs againstdist/and is invisible to Codecov. The companionpackages/loopover-engine/test/attestation-envelope.test.tsgates the engine workspace's ownnpm run testagainst the built barrel.Closes #8541
Scope
type(scope): short summaryConventional Commit format, for examplefix(api): restore profile access checks.CONTRIBUTING.mdand does not reintroduce GitHub Pages, VitePress,site/, orCNAME.Closes #123) — a linked open issue is required for every contributor PR.Validation
git diff --checknpm run actionlintnpm run typechecknpm run test:coveragelocally;codecov/patchrequires ≥99% coverage of the lines AND branches you changed (aim for 100% on your diff so CI variance does not fail near the threshold). Global coverage is a non-blocking trend with a loose 90% backstop, not the gate.npm run test:workersnpm run build:mcpnpm run test:mcp-packnpm run ui:openapi:checknpm run ui:lintnpm run ui:typechecknpm run ui:buildnpm audit --audit-level=moderateIf any required check was skipped, explain why:
actionlint,build:mcp/test:mcp-pack,ui:*,test:workers, andnpm auditare not exercised by it.tsc --noEmitclean, enginetsc -p packages/loopover-engine/tsconfig.jsonclean, the root vitest mirror passes (17 tests), the enginenode --testtwin passes (4 tests) against a freshnpm run build --workspace @loopover/engine, andgit diff --checkis clean.Safety
UI Evidencesection below with JPG/JPEG or PNG screenshots arranged as organized, captioned, clickable thumbnails. SVG screenshots are not used as review evidence. Review-only screenshots or recordings are not committed to the repository.UI Evidence
Not applicable — a pure engine module and its tests; no visible UI, frontend, docs, or extension change.
Notes
verifiedAtis validated by shape and parseability:Date.parsealone accepts a bare"2026-07-25"and other implementation-defined forms, while the ISO regex alone would accept"2026-13-45T99:99:99Z". Both operands are covered by tests.