Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ const artifact = await createEvaluationReceiptFromNativeReport(
);
```

Latency percentiles are optional in a receipt projection. Omit measurements the native
framework did not collect; do not use zero as a stand-in for unknown evidence.

The artifact contains aggregate metrics and content digests, not raw prompts, expected
outputs, or failure transcripts. Its SHA-256 digest can also be placed in a signed Trust
Bundle as `eval:<name>`, allowing the same eval evidence to be independently verified and
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/evals/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@stackbilt/evals",
"version": "0.2.1",
"version": "0.2.2",
"description": "Edge-native evaluation framework for AI agents and classifiers. Zero runtime dependencies beyond Zod.",
"type": "module",
"main": "./dist/index.js",
Expand Down
2 changes: 2 additions & 0 deletions packages/evals/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export {
export {
DigestSchema,
EvaluationGateSchema,
EvaluationReceiptSummarySchema,
EvaluationReportBindingSchema,
EvaluationReceiptSchema,
EvaluationReceiptArtifactSchema,
Expand All @@ -32,6 +33,7 @@ export {
} from './receipt.js';
export type {
EvaluationGate,
EvaluationReceiptSummary,
EvaluationReportBinding,
EvaluationReceipt,
EvaluationReceiptArtifact,
Expand Down
18 changes: 18 additions & 0 deletions packages/evals/src/receipt.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,24 @@ describe('evaluation receipts', () => {
expect(changed.receipt.report.digest).not.toBe(artifact.receipt.report.digest);
});

it('omits latency rather than fabricating unmeasured percentiles', async () => {
const { p50_latency_ms, p90_latency_ms, p95_latency_ms, ...summaryWithoutLatency } = report().summary;
const artifact = await createEvaluationReceiptFromNativeReport(
{ framework: 'native', result: 'pass' },
{
runId: report().run_id,
runner: 'native-framework@1.0.0',
startedAt: report().started_at,
finishedAt: report().finished_at,
summary: summaryWithoutLatency,
},
options,
);

expect(artifact.receipt.report.summary).not.toHaveProperty('p50_latency_ms');
expect(p50_latency_ms + p90_latency_ms + p95_latency_ms).toBeGreaterThan(0);
});

it('keeps the deployment gate explicit rather than deriving it from pass rate', async () => {
const blocked = await createEvaluationReceipt(report(), {
...options,
Expand Down
15 changes: 13 additions & 2 deletions packages/evals/src/receipt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,23 @@ export const EvaluationGateSchema = z.object({
reasons: z.array(z.string().min(1)).default([]),
});

/**
* Public aggregate shared across eval frameworks. Latency percentiles are
* optional because a producer must omit measurements it did not collect.
*/
export const EvaluationReceiptSummarySchema = EvalRunReportSchema.shape.summary.extend({
p50_latency_ms: z.number().nonnegative().optional(),
p90_latency_ms: z.number().nonnegative().optional(),
p95_latency_ms: z.number().nonnegative().optional(),
});

/** Public projection required to bind a framework-native private report. */
export const EvaluationReportBindingSchema = z.object({
runId: z.string().uuid(),
runner: z.string().min(1),
startedAt: z.string().datetime(),
finishedAt: z.string().datetime(),
summary: EvalRunReportSchema.shape.summary,
summary: EvaluationReceiptSummarySchema,
});

export const EvaluationReceiptSchema = z.object({
Expand All @@ -42,7 +52,7 @@ export const EvaluationReceiptSchema = z.object({
digest: DigestSchema,
started_at: z.string().datetime(),
finished_at: z.string().datetime(),
summary: EvalRunReportSchema.shape.summary,
summary: EvaluationReceiptSummarySchema,
}),
runner: z.string().min(1),
gate: EvaluationGateSchema,
Expand All @@ -59,6 +69,7 @@ export const EvaluationReceiptArtifactSchema = z.object({
});

export type EvaluationGate = z.infer<typeof EvaluationGateSchema>;
export type EvaluationReceiptSummary = z.infer<typeof EvaluationReceiptSummarySchema>;
export type EvaluationReportBinding = z.infer<typeof EvaluationReportBindingSchema>;
export type EvaluationReceipt = z.infer<typeof EvaluationReceiptSchema>;
export type EvaluationReceiptArtifact = z.infer<typeof EvaluationReceiptArtifactSchema>;
Expand Down
Loading