|
| 1 | +import { describe, expect, test } from "bun:test"; |
| 2 | +import { proberPackage } from "./package.js"; |
| 3 | + |
| 4 | +describe("proberPackage", () => { |
| 5 | + test("id matches directory / registry id", () => { |
| 6 | + expect(proberPackage.id).toBe("prober"); |
| 7 | + }); |
| 8 | + |
| 9 | + test("systemPrompt is non-empty and not a Placeholder", () => { |
| 10 | + expect(proberPackage.systemPrompt.length).toBeGreaterThan(0); |
| 11 | + expect(proberPackage.systemPrompt.startsWith("Placeholder")).toBe(false); |
| 12 | + }); |
| 13 | + |
| 14 | + test("systemPrompt identity is Prober / ProberDirector", () => { |
| 15 | + const p = proberPackage.systemPrompt; |
| 16 | + expect(p).toMatch(/ProberDirector \(Prober\)/); |
| 17 | + expect(p).toContain("PRIMARY INTENT"); |
| 18 | + expect(p).toMatch(/measure-only lane/i); |
| 19 | + }); |
| 20 | + |
| 21 | + test("systemPrompt states the measure-only lane (TTFT, latency, streaks, salvage/nudge)", () => { |
| 22 | + const p = proberPackage.systemPrompt; |
| 23 | + expect(p).toMatch(/measure latency and behavior distributions/i); |
| 24 | + expect(p).toMatch(/TTFT/); |
| 25 | + expect(p).toMatch(/per-turn latency/i); |
| 26 | + expect(p).toMatch(/tool-only streak/i); |
| 27 | + expect(p).toMatch(/salvage counts/i); |
| 28 | + expect(p).toMatch(/nudge counts/i); |
| 29 | + expect(p).toMatch(/per family\/model/i); |
| 30 | + }); |
| 31 | + |
| 32 | + test("systemPrompt forbids shipping product code and tuning prompts/policy", () => { |
| 33 | + const p = proberPackage.systemPrompt; |
| 34 | + expect(p).toMatch(/never ship product code/i); |
| 35 | + expect(p).toMatch(/never tune prompts or model-family policy/i); |
| 36 | + expect(p).toMatch(/never silent retunes/i); |
| 37 | + }); |
| 38 | + |
| 39 | + test("systemPrompt consumes the existing harness (no second harness)", () => { |
| 40 | + const p = proberPackage.systemPrompt; |
| 41 | + expect(p).toContain("bun run eval:capability"); |
| 42 | + expect(p).toContain("scripts/eval-capability.ts"); |
| 43 | + expect(p).toContain("src/perf"); |
| 44 | + expect(p).toContain("rollup.ts"); |
| 45 | + expect(p).toContain("assert-spans.ts"); |
| 46 | + expect(p).toContain("attribution-report.ts"); |
| 47 | + expect(p).toMatch(/do not build a second one/i); |
| 48 | + expect(p).toMatch(/do not hand-roll/i); |
| 49 | + }); |
| 50 | + |
| 51 | + test("systemPrompt routes findings to model-family-policy follow-ups", () => { |
| 52 | + const p = proberPackage.systemPrompt; |
| 53 | + expect(p).toContain("src/agent/model-family-policy.ts"); |
| 54 | + expect(p).toMatch(/follow-up tickets/i); |
| 55 | + expect(p).toMatch(/do not edit the policy here/i); |
| 56 | + }); |
| 57 | + |
| 58 | + test("systemPrompt points at the scaffold-owned worker report envelope (no re-spec)", () => { |
| 59 | + const p = proberPackage.systemPrompt; |
| 60 | + expect(p).toMatch(/Corbits report envelope/); |
| 61 | + expect(p).toMatch(/scaffold owns its shape/i); |
| 62 | + expect(p).not.toContain("## Summary"); |
| 63 | + expect(p).not.toContain("## Findings"); |
| 64 | + expect(p).not.toContain("## Blockers"); |
| 65 | + expect(p).not.toContain("## Paths"); |
| 66 | + expect(p).toMatch(/distributions per family\/model/i); |
| 67 | + expect(p).toMatch(/follow-up tickets for policy\/prompt owners/i); |
| 68 | + expect(p).toMatch(/DONE GATE/i); |
| 69 | + expect(p).toMatch(/BLINDERS ON/i); |
| 70 | + expect(p).toContain("success_criteria"); |
| 71 | + }); |
| 72 | + |
| 73 | + test("systemPrompt has no tool-schema restatement or fake caps", () => { |
| 74 | + const p = proberPackage.systemPrompt; |
| 75 | + expect(p).not.toMatch(/parameters?:/i); |
| 76 | + expect(p).not.toMatch(/fan-out/i); |
| 77 | + expect(p).not.toMatch(/at most \d+/i); |
| 78 | + expect(p).not.toMatch(/turn budget/i); |
| 79 | + expect(p).not.toMatch(/scheduler/i); |
| 80 | + }); |
| 81 | + |
| 82 | + test("spawn.maySpawn is false (leaf)", () => { |
| 83 | + expect(proberPackage.spawn.maySpawn).toBe(false); |
| 84 | + }); |
| 85 | + |
| 86 | + test("tier is leaf", () => { |
| 87 | + expect(proberPackage.tier).toBe("leaf"); |
| 88 | + }); |
| 89 | + |
| 90 | + test("tools.allow mounts the review surface (lane discipline in prompt)", () => { |
| 91 | + const allow = proberPackage.tools?.allow ?? []; |
| 92 | + expect(allow).toContain("read_file"); |
| 93 | + expect(allow).toContain("run_shell"); |
| 94 | + expect(allow).toContain("write_file"); |
| 95 | + expect(allow).toContain("edit_file"); |
| 96 | + expect(allow).toContain("delete_file"); |
| 97 | + }); |
| 98 | + |
| 99 | + test("modelRole is test", () => { |
| 100 | + expect(proberPackage.modelRole).toBe("test"); |
| 101 | + }); |
| 102 | + |
| 103 | + test("primaryIntent and outOfLane match the prober lane", () => { |
| 104 | + expect(proberPackage.primaryIntent).toMatch(/measure/i); |
| 105 | + expect(proberPackage.primaryIntent).toMatch(/never ship product code/i); |
| 106 | + expect(proberPackage.primaryIntent).toMatch(/never tune/i); |
| 107 | + const joined = proberPackage.outOfLane.join(" "); |
| 108 | + expect(joined).toMatch(/shipping product code/i); |
| 109 | + expect(joined).toMatch(/tuning prompts or model-family policy/i); |
| 110 | + expect(joined).toMatch(/new eval harness/i); |
| 111 | + }); |
| 112 | +}); |
0 commit comments