Skip to content

fix(attestation-envelope): bridge to audit-chain's real writeRecord() shape (v0.14.0)#31

Open
stackbilt-admin wants to merge 1 commit into
mainfrom
fix/attestation-envelope-audit-chain-bridge
Open

fix(attestation-envelope): bridge to audit-chain's real writeRecord() shape (v0.14.0)#31
stackbilt-admin wants to merge 1 commit into
mainfrom
fix/attestation-envelope-audit-chain-bridge

Conversation

@stackbilt-admin

Copy link
Copy Markdown
Member

Summary

  • AttestationEnvelope's 0.5.0 CHANGELOG entry claimed it was the "canonical shape for... audit-chain entries," but audit-chain's actual AuditRecord (record_id, namespace, event_type, hash, prev_hash, actor, timestamp, payload, metadata?) shares no field vocabulary with the envelope (traceId, tenantId, ticketRef, model, costUsd, result, sealedAt, hmac) — confirmed the claim was aspirational: zero real consumers exist, and none of the four named instances (stackd, audit-chain, reading-envelope, evals) have adopted it.
  • Adds toAuditChainWriteOptions(envelope, options?) to bridge the two as separate layers instead of forcing a field-for-field merge: the envelope becomes the record's payload, with namespace/actor defaults derived from tenantId/agentId.
  • Corrects the module doc comment so it no longer reads as already-implemented.

Surfaced while scoping a generalized rubric-contract primitive off @stackbilt/evidence-core, whose src/audit/adapter.ts independently reimplements this exact bridge (correctly, matching audit-chain's real shape) because no shared version existed to depend on.

Test plan

  • pnpm run typecheck — clean
  • pnpm run build — clean
  • pnpm run test:run — new tests/attestation-envelope.test.ts (8 tests) passes; no regressions in other suites (pre-existing unrelated timeouts in foodfiles-sql-diff.test.ts / generator-syntax.test.ts — slow cross-filesystem imports under WSL /mnt/c, not touched by this change)
  • Version bumped 0.13.0 → 0.14.0, CHANGELOG entry added

🤖 Generated with Claude Code

… shape (v0.14.0)

AttestationEnvelope's 0.5.0 CHANGELOG entry claimed it was the "canonical
shape for... audit-chain entries," but audit-chain's actual AuditRecord
(record_id, namespace, event_type, hash, prev_hash, actor, timestamp,
payload, metadata?) shares no field vocabulary with the envelope (traceId,
tenantId, ticketRef, model, costUsd, result, sealedAt, hmac) — the claim
was aspirational and had zero real consumers.

Add toAuditChainWriteOptions() to bridge the two as separate layers: the
envelope becomes the record's payload, with namespace/actor defaults
derived from tenantId/agentId rather than forcing a field-for-field merge.

Surfaced while scoping a generalized rubric-contract primitive off of
evidence-core, whose src/audit/adapter.ts independently reimplements this
same bridge (correctly) because no shared version existed to depend on.
@stackbilt-admin

Copy link
Copy Markdown
Member Author

Parent tracking issue for this initiative: Stackbilt-dev/aegis#699

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.

1 participant