Files
Dragan Spiridonov 82dfa013ef chore(darwin): A8 version contract — pin ScoreCard compat, hold the dep-swap
Investigated A8 (pin @metaharness/darwin + retire the type-mirror):
- VERIFIED: AQE's DarwinScoreCard mirror is byte-identical to upstream ScoreCard
  from @metaharness/darwin@0.2.1 THROUGH the published 0.7.0 (no drift, 5 minors).
- HELD the dep-swap deliberately: upstream is fast-moving pre-1.0 with napi/wasm
  transitive deps; adding it changes every user's install + lockfile and can't be
  verified locally (host-shared-node_modules breaks native rebuilds) — negative-EV
  vs 74 stable, zero-coupling mirror lines.
- SHIPPED the version-contract half: pinned provenance (0.2.1–0.7.0) + a drift-
  guard test (darwin-version-contract.test.ts) that fails CI on any field-set
  divergence. 17 darwin tests green; tsc clean.

Swap only after upstream stabilizes (≥1.0) + a CI-verified install impact; needs OK.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 07:30:43 +00:00

40 lines
1.8 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* Darwin ScoreCard version contract (plan 05 / A8).
*
* AQE mirrors `@metaharness/darwin`'s `ScoreCard` locally (zero-coupling) instead
* of importing the fast-moving pre-1.0 package. This guards the contract: if the
* mirror's field set drifts, this fails — forcing a re-verification against
* upstream before the change ships. The pinned set was confirmed identical to
* upstream ScoreCard @ 0.2.1–0.7.0 on 2026-06-25.
*/
import { describe, it, expect } from 'vitest';
import type { DarwinScoreCard } from '../../../src/integrations/darwin/types.js';
// The agreed contract: upstream @metaharness/darwin ScoreCard fields (0.2.1–0.7.0).
const SCORECARD_CONTRACT = [
'variantId',
// positive weighted terms
'taskSuccess', 'testPassRate', 'traceQuality', 'costEfficiency', 'latencyEfficiency', 'safetyScore',
// hard penalties
'secretExposure', 'destructiveAction', 'hallucinatedFile', 'toolLoop', 'costOverrun',
// result
'baseScore', 'finalScore', 'promoted', 'reason',
].sort();
describe('Darwin ScoreCard — version contract (A8)', () => {
it('should expose exactly the upstream ScoreCard field set (no drift)', () => {
// A fully-populated mirror instance — TS enforces the type; we assert the keys.
const card: DarwinScoreCard = {
variantId: 'v1',
taskSuccess: 1, testPassRate: 1, traceQuality: 1, costEfficiency: 1, latencyEfficiency: 1, safetyScore: 1,
secretExposure: 0, destructiveAction: 0, hallucinatedFile: 0, toolLoop: 0, costOverrun: 0,
baseScore: 0.9, finalScore: 0.9, promoted: true, reason: 'ok',
};
expect(Object.keys(card).sort()).toEqual(SCORECARD_CONTRACT);
});
it('should keep the contract at 16 fields (6 terms + 5 penalties + 5 meta/result)', () => {
expect(SCORECARD_CONTRACT).toHaveLength(16);
});
});