test: recordE2E writes cost_case_id only for a registered label-named case

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This commit is contained in:
garrytanandcapy-ai[bot] committed 2026-10-29 04:45:28 +00:00
1 parent b889070fb9
commit 4aec7804e0
1 file changed
+18
+18
View File
@@ -11,6 +11,7 @@ import { MODEL_FREE_CASES, caseCost, junitCensus } from '../scripts/lib/paid-rep
import { anthropicUsageCostUsd, streamedUsageCostUsd } from '../lib/pricing';
import { E2E_TOUCHFILES } from './helpers/touchfiles-data';
import type { SessionLedgerRow } from './helpers/session-ledger';
import { recordE2E } from './helpers/e2e-helpers';
const ROOT = path.resolve(import.meta.dir, '..');
const session = (over: Partial<SessionLedgerRow>): SessionLedgerRow => ({ key: 'k', runner: 'agent-sdk', started_at: 't', elapsed_ms: 1, end: 'aborted', ...over });
@@ -68,6 +69,23 @@ describe('caseCost', () => {
});
});
describe('recordE2E cost_case_id', () => {
const entry = (name: string, testName?: string) => {
const tests: any[] = [];
const result: any = { toolCalls: [], browseErrors: [], exitReason: 'success', duration: 1, output: '', transcript: [], model: 'claude-opus-5-5',
costEstimate: { estimatedCost: 0.05, turnsUsed: 1, estimatedTokens: 1 }, ...(testName ? { testName } : {}) };
recordE2E({ addTest: (t: any) => tests.push(t) } as any, name, 'suite', result);
return tests[0];
};
test('a display-label record carries its registered runSkillTest testName as cost_case_id, and nothing else does', () => {
expect(entry('browse basic commands', 'browse-basic')).toMatchObject({ name: 'browse basic commands', cost_case_id: 'browse-basic' });
expect(entry('browse-basic', 'browse-basic').cost_case_id).toBeUndefined();
expect(entry('browse basic commands', 'not-a-registered-case').cost_case_id).toBeUndefined();
expect(entry('browse basic commands').cost_case_id).toBeUndefined();
});
});
describe('junitCensus cost binding', () => {
const key = 'test/skill-e2e-bws.test.ts';
const census = (records: any[], ledger: SessionLedgerRow[] = []) => {