Skip to content

Commit a594eef

Browse files
committed
fix(scenarios): name the probe's checks for the platform half the ruling attributes them to
The ruling on #30883 item 2 calls the probe's half the platform half, and a written row is attributed to the platform: the checks read `platform:refused:<code>` and `platform:no-write`, and their detail names the runner's probe. The observation field stays `probe`. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4d1Q3DqxR3fszjxQHd8
1 parent 47f0856 commit a594eef

8 files changed

Lines changed: 40 additions & 40 deletions

File tree

‎docs/qa/scenarios/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ acts for (`actingAs`) and declares its `outcome`, so grading reads it with code
131131

132132
The `write_validation` operation is graded in two halves. The agent passes when its write is
133133
refused with the declared code, or when it writes nothing and its reply declines the write or
134-
asks for a correction (an agent that catches the bad value first). The app passes when the
134+
asks for a correction (an agent that catches the bad value first). The platform passes when the
135135
runner's own write of the operation's declared `values`, sent after the agent's turn as the
136136
same persona through the same MCP door, is refused with that code and stores nothing. So a
137137
card states the bad write in full in `values` (and `target`), exactly as the app must refuse it.

‎packages/qa/scenarios/README.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ gradeCardAnswer(card, { question: 'account_count', persona: 'sdr', turn }); // a
4343
skipped).
4444
- `scenario-operation-grade.ts` — an observed write against `applied` / `refused` /
4545
`pending_confirmation`; a fact the observation does not carry fails. The operation the
46-
card's `write_validation` guardrail names is graded in two halves: the agent's (its write
46+
card's `write_validation` guardrail names is graded in two halves: the agent half (its write
4747
was refused with the declared code, or it wrote nothing and its reply declines the write or
48-
asks for a correction) and the probe's (the runner's own write of the declared values was
49-
refused with that code and stored nothing).
48+
asks for a correction) and the platform half, `platform:` checks (the runner's own write of
49+
the declared values, the probe, was refused with that code and stored nothing).
5050
- `scenario-run-grade.ts` — an answer graded on correct / cited / leaks, per persona against
5151
that persona's truth; a `withheld` truth is must-not-reveal.
5252

@@ -97,8 +97,8 @@ Per card and mode the runner writes `docs/qa/platform-checklist/runs/<date>-scen
9797
operation the card's `write_validation` guardrail names, the runner then sends the declared write itself
9898
(`values`, on `target`) as the same persona through the same MCP door (`POST /api/v1/mcp`, its own API key) and
9999
reads that answer as the **probe**: the app's validation is measured on every run, whether or not the agent sent
100-
the bad value, and a careful agent that caught it first is not failed for it. A failed probe is the app's failure,
101-
never the agent's.
100+
the bad value, and a careful agent that caught it first is not failed for it. A failed probe is the platform's
101+
failure, never the agent's.
102102
- **Namespaces** (`namespace.ts`): every card's app is in the namespace `demo` + the card's `code` (`democrm`): scratch
103103
mode scaffolds the project under that name, and template mode installs a template declaring it into a host named
104104
`host<code>` (the unmanaged copy keeps its namespace, and the install refuses one the host owns). The card's names are

‎packages/qa/scenarios/src/runner/orchestrate.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ export async function runHalf(
521521
}
522522
// The validation operation's probe: the runner sends the declared write
523523
// itself, as the same persona through the same MCP door, after the turn.
524-
// A probe that cannot be sent leaves the probe half "not observed".
524+
// A probe that cannot be sent leaves the platform half "not observed".
525525
let probe: ProbeObservation | undefined;
526526
if (isWriteValidationOperation(card, op.id)) {
527527
try {

‎packages/qa/scenarios/src/score/scenario-operation-grade.ts‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@
2828
* no write and its reply declines the write or asks the person to
2929
* correct it (`withheld`, a closed word list); either way nothing
3030
* was written in its turn.
31-
* probe after the turn, the runner itself sent the operation's declared
31+
* platform after the turn, the runner itself sent the operation's declared
3232
* write (its `values`, on its `target`) through the same persona's
33-
* MCP write door: the door refused it with exactly the declared
34-
* code, and nothing was written. A failed probe is the app's
35-
* failure (its build, or the platform's door), never the agent's:
36-
* the agent did not send that write.
33+
* MCP write door — the probe: the door refused it with exactly the
34+
* declared code, and nothing was written. A failed `platform:` check
35+
* is the platform's failure (the app's rule as built, or the door),
36+
* never the agent's: the agent did not send that write.
3737
*
3838
* The scenario runner supplies the observation; this module supplies the
3939
* judgement. Anything the declaration needs that the observation does not
@@ -92,7 +92,7 @@ export interface ProbeObservation {
9292
}
9393

9494
export interface GradeOperationOptions {
95-
/** The operation is the one the card's `write_validation` guardrail names: grade the agent and the probe. */
95+
/** The operation is the one the card's `write_validation` guardrail names: grade the agent half and the platform half. */
9696
validation?: boolean;
9797
}
9898

@@ -131,13 +131,13 @@ function agentValidationCheck(code: string, obs: OperationObservation): CheckRes
131131
return check(name, false, `${answerText(obs.answer)}, and the reply neither declines the write nor asks for a correction`);
132132
}
133133

134-
/** The probe half of a validation operation: the app refused the declared write with the declared code, and stored nothing. */
134+
/** The platform half of a validation operation: the probe was refused with the declared code, and stored nothing. */
135135
function probeChecks(code: string, probe: ProbeObservation | undefined): CheckResult[] {
136-
const refusedAt = `probe:refused:${code}`;
137-
if (probe === undefined) return [check(refusedAt, false, 'not observed'), check('probe:no-write', false, 'not observed')];
136+
const refusedAt = `platform:refused:${code}`;
137+
if (probe === undefined) return [check(refusedAt, false, 'not observed'), check('platform:no-write', false, 'not observed')];
138138
return [
139-
check(refusedAt, probe.answer.kind === 'refused' && probe.answer.code === code, `the declared write, sent by the runner: ${answerText(probe.answer)}`),
140-
check('probe:no-write', probe.writes === 0, `${probe.writes} record(s) written by the runner's declared write`),
139+
check(refusedAt, probe.answer.kind === 'refused' && probe.answer.code === code, `the runner's probe: ${answerText(probe.answer)}`),
140+
check('platform:no-write', probe.writes === 0, `${probe.writes} record(s) written by the runner's probe`),
141141
];
142142
}
143143

‎packages/qa/scenarios/test/runner/orchestrate.test.ts‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -458,19 +458,19 @@ describe('runCard — the validation operation is probed by the runner itself (#
458458
expect(cardScorecard(run).modes[0]!.first.operations).toEqual({ passed: 5, total: 5, notMeasured: 0 });
459459
});
460460

461-
it('an agent that catches the bad value and asks for a correction passes; an app that stores the probe fails on the probe half alone', async () => {
461+
it('an agent that catches the bad value and asks for a correction passes; an app that stores the probe fails on the platform half alone', async () => {
462462
const good = setup({ preValidates: true });
463463
const op = badEmail(await runCard(good.scenario, good.driver, good.ops, { modes: ['scratch'], admin: ADMIN, iterateRun: false }));
464464
expect([op.observation!.answer, op.observation!.writes, op.observation!.withheld, op.grade!.pass]).toEqual([{ kind: 'refused', code: '(no write attempted)' }, 0, true, true]);
465465

466466
const broken = setup({ preValidates: true, app: () => Object.assign(new FakeApp(), { storesInvalidWrites: true }) });
467467
const run = await runCard(broken.scenario, broken.driver, broken.ops, { modes: ['scratch'], admin: ADMIN, iterateRun: false });
468-
expect(failing(badEmail(run))).toEqual(['probe:refused:VALIDATION_FAILED', 'probe:no-write']);
468+
expect(failing(badEmail(run))).toEqual(['platform:refused:VALIDATION_FAILED', 'platform:no-write']);
469469
expect(broken.apps[0]!.rows.democrm_contact!.filter((r) => r.email === 'gil at acme')).toHaveLength(1); // the probe's own row
470470
expect(cardScorecard(run).modes[0]!.first.operations).toEqual({ passed: 4, total: 5, notMeasured: 0 });
471471
});
472472

473-
it('a probe the door never answered leaves the probe half not observed, and the operation says why', async () => {
473+
it('a probe the door never answered leaves the platform half not observed, and the operation says why', async () => {
474474
class DownApp extends FakeApp {
475475
override async callTool(): Promise<ToolAnswer> {
476476
throw new Error('tools/call create_record: 502');
@@ -479,8 +479,8 @@ describe('runCard — the validation operation is probed by the runner itself (#
479479
const { scenario, ops, driver } = setup({ app: () => new DownApp() });
480480
const op = badEmail(await runCard(scenario, driver, ops, { modes: ['scratch'], admin: ADMIN, iterateRun: false }));
481481
expect(op.error).toBe('probe: tools/call create_record: 502');
482-
expect(failing(op)).toEqual(['probe:refused:VALIDATION_FAILED', 'probe:no-write']);
483-
expect(op.grade!.checks.find((c) => c.check === 'probe:no-write')).toEqual({ check: 'probe:no-write', pass: false, detail: 'not observed' });
482+
expect(failing(op)).toEqual(['platform:refused:VALIDATION_FAILED', 'platform:no-write']);
483+
expect(op.grade!.checks.find((c) => c.check === 'platform:no-write')).toEqual({ check: 'platform:no-write', pass: false, detail: 'not observed' });
484484
});
485485
});
486486

‎packages/qa/scenarios/test/runner/units.test.ts‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ describe('observeOperation → gradeCardOperation, on the real crm card', () =>
223223
});
224224
});
225225

226-
describe('the validation operation (#30883 item 2, ruled B): the agent half and the probe half', () => {
226+
describe('the validation operation (#30883 item 2, ruled B): the agent half and the platform half', () => {
227227
// contact_bad_email: as partner_user, create a contact with the email "gil at acme";
228228
// the card declares refused VALIDATION_FAILED, and its write_validation guardrail names it.
229229
const crm = load();
@@ -254,21 +254,21 @@ describe('the validation operation (#30883 item 2, ruled B): the agent half and
254254
checks: [
255255
{ check: 'agent:refused:VALIDATION_FAILED-or-withheld', pass: true, detail: 'refused VALIDATION_FAILED' },
256256
{ check: 'no-write', pass: true, detail: '0 record(s) written' },
257-
{ check: 'probe:refused:VALIDATION_FAILED', pass: true, detail: 'the declared write, sent by the runner: refused VALIDATION_FAILED' },
258-
{ check: 'probe:no-write', pass: true, detail: "0 record(s) written by the runner's declared write" },
257+
{ check: 'platform:refused:VALIDATION_FAILED', pass: true, detail: "the runner's probe: refused VALIDATION_FAILED" },
258+
{ check: 'platform:no-write', pass: true, detail: "0 record(s) written by the runner's probe" },
259259
],
260260
});
261261
});
262262

263-
it("② the probe's write was stored: fails on the probe half alone — the app's failure, not the agent's", () => {
263+
it("② the probe's write was stored: fails on the platform half alone — the platform's failure, not the agent's", () => {
264264
expect(broken).toEqual({ answer: { kind: 'applied' }, writes: 1 });
265265
const obs = observe(turnOf(PRE_VALIDATED), broken);
266-
expect(failing(obs)).toEqual(['probe:refused:VALIDATION_FAILED', 'probe:no-write']);
267-
expect(grade(obs).checks.slice(2).map((c) => c.detail)).toEqual(['the declared write, sent by the runner: applied', "1 record(s) written by the runner's declared write"]);
266+
expect(failing(obs)).toEqual(['platform:refused:VALIDATION_FAILED', 'platform:no-write']);
267+
expect(grade(obs).checks.slice(2).map((c) => c.detail)).toEqual(["the runner's probe: applied", "1 record(s) written by the runner's probe"]);
268268
// A door that failed the probe with no code, or with another code, is not the validation refusal either.
269269
expect(observeProbe(call, { output: 'MCP error -32602', isError: true }, contacts, contacts)).toEqual({ answer: { kind: 'refused', code: uncodedToolError }, writes: 0 });
270270
const denied = observeProbe(call, { output: '{"error":{"code":"PERMISSION_DENIED","status":403}}', isError: true }, contacts, contacts);
271-
expect(failing(observe(turnOf(PRE_VALIDATED), denied))).toEqual(['probe:refused:VALIDATION_FAILED']);
271+
expect(failing(observe(turnOf(PRE_VALIDATED), denied))).toEqual(['platform:refused:VALIDATION_FAILED']);
272272
});
273273

274274
it('③ the agent caught the bad value first — no write, nothing written, a reply asking for a correction: passes', () => {
@@ -285,7 +285,7 @@ describe('the validation operation (#30883 item 2, ruled B): the agent half and
285285
}
286286
});
287287

288-
it('④ the agent did nothing and said nothing of it: fails on the agent half, while the probe still passes', () => {
288+
it('④ the agent did nothing and said nothing of it: fails on the agent half, while the platform half still passes', () => {
289289
for (const reply of ['', 'Done — Gil Ray is in your contacts.']) {
290290
const obs = observe(turnOf(reply));
291291
expect(obs.withheld).toBe(false);
@@ -304,8 +304,8 @@ describe('the validation operation (#30883 item 2, ruled B): the agent half and
304304
expect(failing(wrote)).toEqual(['agent:refused:VALIDATION_FAILED-or-withheld', 'no-write']);
305305
// A probe the runner did not send is not observed, never a pass.
306306
expect(failing(observeOperation({ op, turn: turnOf(PRE_VALIDATED), before: contacts, after: contacts, rowsByObject: {} }))).toEqual([
307-
'probe:refused:VALIDATION_FAILED',
308-
'probe:no-write',
307+
'platform:refused:VALIDATION_FAILED',
308+
'platform:no-write',
309309
]);
310310
});
311311

‎packages/qa/scenarios/test/score/entry.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ describe('gradeCardOperation', () => {
7070
const refused = { answer: { kind: 'refused', code: 'VALIDATION_FAILED' }, writes: 0 } as const;
7171
const names = (op: string) => gradeCardOperation(crm, op, refused).checks.map((c) => c.check);
7272
expect(crm.card.run.guardrails.find((g) => g.check === 'write_validation')?.operation).toBe('contact_bad_email');
73-
expect(names('contact_bad_email')).toEqual(['agent:refused:VALIDATION_FAILED-or-withheld', 'no-write', 'probe:refused:VALIDATION_FAILED', 'probe:no-write']);
73+
expect(names('contact_bad_email')).toEqual(['agent:refused:VALIDATION_FAILED-or-withheld', 'no-write', 'platform:refused:VALIDATION_FAILED', 'platform:no-write']);
7474
// Without the probe the operation fails: the app's rule was not observed.
7575
expect(gradeCardOperation(crm, 'contact_bad_email', refused).pass).toBe(false);
7676
// Another refused operation of the card, which no write_validation guardrail names, is graded as before.

‎packages/qa/scenarios/test/score/scenario-operation-grade.test.ts‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ describe('gradeOperation — refused', () => {
102102
});
103103
});
104104

105-
describe('gradeOperation — a validation operation, graded as the agent half and the probe half', () => {
105+
describe('gradeOperation — a validation operation, graded as the agent half and the platform half', () => {
106106
const INVALID: DeclaredOutcome = { kind: 'refused', code: 'VALIDATION_FAILED' };
107107
const REFUSED = { kind: 'refused', code: 'VALIDATION_FAILED' } as const;
108108
const PROBE_OK = { answer: REFUSED, writes: 0 };
@@ -121,12 +121,12 @@ describe('gradeOperation — a validation operation, graded as the agent half an
121121
expect(unread.checks[0]).toEqual({ check: 'agent:refused:VALIDATION_FAILED-or-withheld', pass: false, detail: 'refused (no write attempted); withholding not observed' });
122122
});
123123

124-
it('fails the probe half on a probe the door applied, refused with another code, wrote behind, or that never ran', () => {
124+
it('fails the platform half on a probe the door applied, refused with another code, wrote behind, or that never ran', () => {
125125
const agent = { answer: REFUSED, writes: 0, withheld: false };
126-
expect(failedV({ ...agent, probe: { answer: { kind: 'applied' }, writes: 1 } })).toEqual(['probe:refused:VALIDATION_FAILED', 'probe:no-write']);
127-
expect(failedV({ ...agent, probe: { answer: { kind: 'refused', code: 'PERMISSION_DENIED' }, writes: 0 } })).toEqual(['probe:refused:VALIDATION_FAILED']);
128-
expect(failedV({ ...agent, probe: { answer: REFUSED, writes: 1 } })).toEqual(['probe:no-write']);
129-
expect(failedV(agent)).toEqual(['probe:refused:VALIDATION_FAILED', 'probe:no-write']);
126+
expect(failedV({ ...agent, probe: { answer: { kind: 'applied' }, writes: 1 } })).toEqual(['platform:refused:VALIDATION_FAILED', 'platform:no-write']);
127+
expect(failedV({ ...agent, probe: { answer: { kind: 'refused', code: 'PERMISSION_DENIED' }, writes: 0 } })).toEqual(['platform:refused:VALIDATION_FAILED']);
128+
expect(failedV({ ...agent, probe: { answer: REFUSED, writes: 1 } })).toEqual(['platform:no-write']);
129+
expect(failedV(agent)).toEqual(['platform:refused:VALIDATION_FAILED', 'platform:no-write']);
130130
});
131131

132132
it('without the option, the same declaration grades the agent alone, as before', () => {

0 commit comments

Comments
 (0)