test(mode): record the plan-mode approve and keep-planning scenarios
The with-key recording session the RFC deferred. plan-mode is the 'plan' header class's pinning scenario and necessarily carries BOTH header shapes verbatim: the plan-shaped initial snapshot and the widened fallback snapshot the approved exit produces mid-turn — so the suite factory's pin guards relax from exactly-one to at-least-one header (the classmates' uniformity anchor is the pin's FIRST header; transition headers are legal only in the pin, matching the sandbox stack's precedent). plan-mode-reject pins the keep-planning branch: the corrective isError carries the reviewer's free-text feedback verbatim and the session stays in plan mode, one header, uniform with the pin. Recording notes, encoded in the prompts: the model is pinned to RELATIVE paths (a recorded absolute temp path neither replays on another host nor normalizes — the normalizers scrub the run's own cwd, not the recording's), and the recorded model never calls a filtered tool, so the gate's deny path stays pinned at the unit tier — that refusal is the behavior the soft layer exists to produce. The gen-tool-catalog meta-test pins exit_plan_mode in the harvested schema list.
This commit is contained in:
@@ -35,7 +35,7 @@ describe('gen-tool-catalog collectToolCatalog', () => {
|
||||
it('boots every shipped tool package and harvests its model-facing schemas', async () => {
|
||||
const catalog = await collectToolCatalog()
|
||||
const names = catalog.flatMap(entry => entry.schemas.map(s => s.name)).sort()
|
||||
expect(names).toEqual(['ask_user_question', 'bash', 'bash_kill', 'bash_output', 'cordis_inspect', 'cordis_mount', 'cordis_unmount', 'edit', 'read', 'run_code', 'subagent', 'todo_write', 'web_fetch', 'web_search', 'write'])
|
||||
expect(names).toEqual(['ask_user_question', 'bash', 'bash_kill', 'bash_output', 'cordis_inspect', 'cordis_mount', 'cordis_unmount', 'edit', 'exit_plan_mode', 'read', 'run_code', 'subagent', 'todo_write', 'web_fetch', 'web_search', 'write'])
|
||||
// Every tool carries a JSON-Schema `parameters` object (what the model sees).
|
||||
for (const entry of catalog) {
|
||||
for (const schema of entry.schemas) {
|
||||
|
||||
@@ -339,8 +339,10 @@ export function defineAcpSnapshotSuite(options: SnapshotSuiteOptions): void {
|
||||
const pinningScenario = classPin
|
||||
const pinnedFixture = await readFile(join(snapshotsDir, pinningScenario.name, 'session.jsonl'), 'utf8')
|
||||
const pinned = normalizedHeaders(pinnedFixture, fixtureContext(pinnedFixture))
|
||||
expect(pinned.length, `the pinning fixture (${pinningScenario.name}) must carry exactly one request/header`)
|
||||
.toBe(1)
|
||||
// The classmates' anchor is the pin's FIRST header; a pin may carry
|
||||
// further transition headers of its own (legal only there).
|
||||
expect(pinned.length, `the pinning fixture (${pinningScenario.name}) must carry at least one request/header`)
|
||||
.toBeGreaterThanOrEqual(1)
|
||||
for (const log of result.sessionLogs) {
|
||||
expect(headerDeltaCount(log.content), `session ${log.id}: a request/header-delta in a non-pinning scenario`)
|
||||
.toBe(0)
|
||||
@@ -411,17 +413,17 @@ export function defineAcpSnapshotSuite(options: SnapshotSuiteOptions): void {
|
||||
}
|
||||
})
|
||||
|
||||
it('every pinning fixture carries exactly one request/header and no deltas', async () => {
|
||||
// The live uniformity guard runs only in NON-pinning scenarios, so a
|
||||
// class made of just its pinning scenario would otherwise accept a
|
||||
// re-recorded pin with several headers or a mid-run header-delta —
|
||||
// shapes the pin design cannot represent. Assert the committed pins
|
||||
// directly.
|
||||
it('every pinning fixture carries at least one request/header', async () => {
|
||||
// The live uniformity guard runs only in NON-pinning scenarios, so the
|
||||
// committed pins are asserted directly. A pin carries the class's full
|
||||
// header content — INCLUDING mid-run transitions (a session-mode flip
|
||||
// logs a second snapshot or a delta; those are legal only here, and the
|
||||
// classmates' uniformity anchor is the pin's FIRST header) — so the
|
||||
// shape requirement is presence, not uniqueness.
|
||||
for (const scenario of pinningByClass.values()) {
|
||||
const fixture = await readFile(join(snapshotsDir, scenario.name, 'session.jsonl'), 'utf8')
|
||||
const headers = normalizedHeaders(fixture, fixtureContext(fixture))
|
||||
expect(headers.length, `${scenario.name}: a pinning fixture must carry exactly one request/header`).toBe(1)
|
||||
expect(headerDeltaCount(fixture), `${scenario.name}: a pinning fixture must carry no request/header-delta`).toBe(0)
|
||||
expect(headers.length, `${scenario.name}: a pinning fixture must carry at least one request/header`).toBeGreaterThanOrEqual(1)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user