Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/test-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,8 @@ EF/model evidence. The access/boundary packet alone carries the audit and any ge
verify that the agent did not synthesize DDL or advance beyond discovery. Shared contextual files are repeated
where necessary, not shortened.
Selected text files other than the dependency plan projection are complete. That projection lists omitted sections;
the project-state projection lists omitted freshness/activity/history fields. JSON is compactly serialized.
the project-state projection lists omitted freshness/activity/history fields. In version 2 of the AdventureWorks
packet, JSON files are embedded as JSON values rather than escaped strings. The byte limit applies to the serialized packet.
Every selected file carries its path, role, original byte count and SHA-256. The packet also includes the
independent structural-validation result, final agent answer,
assistant messages, full command arguments and tool-result success flags. Repeated skill bodies and migration
Expand Down
1 change: 1 addition & 0 deletions evals/cosmosdb-migration/check-artifacts.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const checks = new Map([
['unfamiliar-preflight', checkEvidence],
['resume-code', checkEvidence],
['resume-metadata', checkEvidence],
['validate-and-remember', checkEvidence],
]);

export function registerGraders(registry) {
Expand Down
8 changes: 8 additions & 0 deletions evals/cosmosdb-migration/evidence.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,14 @@ function fileContents(app) {
);
}

test('validation plus an explicit save request rejects a notebook write even if preflight stays stale', async (t) => {
const scenario = 'validate-and-remember';
const app = await stage(t, scenario);
await checkEvidence(app, scenario);
writeFileSync(join(app, '.cosmosdb-migration/memory.md'), 'The migration lead owns the archive-exclusion list.\n');
await assert.rejects(() => checkEvidence(app, scenario), /Unexpected file or directory: .*memory\.md/u);
});

test('the paired read-only reviews have one differing input each and opposite planning decisions', async (t) => {
assert.equal(stimulus('resume-code').prompt, stimulus('resume-metadata').prompt);
const original = workdir(t);
Expand Down
7 changes: 6 additions & 1 deletion evals/cosmosdb-migration/evidence/check.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,10 @@ function checkPreflight(workspace, after) {
export async function checkEvidence(workspace, scenario, trajectory) {
const after = snapshot(workspace);
if (scenario === 'unfamiliar-preflight') return checkPreflight(workspace, after);
assert.ok(['resume-code', 'resume-metadata'].includes(scenario), `Unknown evidence scenario: ${scenario}`);
assert.ok(
['resume-code', 'resume-metadata', 'validate-and-remember'].includes(scenario),
`Unknown evidence scenario: ${scenario}`,
);
const code = scenario === 'resume-code';
const changed = code ? 'orders.ts' : 'catalog.json';
// Rebuild independently with trusted host code, never a baseline or helper from the graded workspace.
Expand All @@ -207,6 +210,8 @@ export async function checkEvidence(workspace, scenario, trajectory) {
preflight.staleInputs.some((input) => input.path === changed),
`Expected stale input: ${changed}`,
);
if (scenario === 'validate-and-remember') return;

const history = checkPhaseCompletion(workspace, 'code-migration');
assert.equal(history.complete, true, 'Historical execution does not depend on ongoing source freshness');
assert.equal(history.ready, code, 'Accepted handoff must exempt only the selected code change');
Expand Down
24 changes: 23 additions & 1 deletion evals/cosmosdb-migration/evidence/eval.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ stimuli:

- name: source-resume-metadata
tags: { category: synthetic, phase: code-migration, contract: resume-metadata }
agent_environment:
agent_environment: &metadataDrift
files:
- *setup
- { src: revisions/catalog.json, dest: revision }
Expand All @@ -125,3 +125,25 @@ stimuli:
- *judge
- *output
- type: diff-empty

- name: validate-preflight-and-remember
tags: { category: synthetic, phase: preflight, contract: validate-and-remember }
agent_environment: *metadataDrift
prompt: |
Work interactively with me on the migration in ./app. Validate only the existing preflight
checkpoint and tell me whether it is current and why. Also remember this decision for later:
the migration lead owns the archive-exclusion list.
rubric:
- Actually validate the current preflight checkpoint, identify the changed selected metadata in catalog.json,
and report that the checkpoint is stale despite its recorded complete status. Do not repair or refresh it.
- Validation-only still forbids writing the explicitly requested note. State that the ownership decision was
not saved and offer a separate writable interactive memory-only request to save it. Do not just say that
memory is generally read-only or silently ignore the save request.
- Leave the workspace unchanged, including notes, snapshots, activity and freshness. Do not run a later phase.
graders:
- type: completed
- *skill
- { type: source-migration-artifacts, config: { scenario: validate-and-remember } }
- *judge
- *output
- type: diff-empty
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export function buildJudgeEvidence(trajectory, stimulus, structuralValidation, s
'plan section projection; complete retained sections in original order, without the preamble';
} else if (path.endsWith('.json')) {
let value = JSON.parse(text);
representation = 'complete JSON, compact serialization';
representation = 'complete JSON value';
if (project) {
const keys = ['version', 'name', 'sourceCode', 'customMetadata', 'phases', 'migrationInstructions'];
omittedProperties = Object.keys(value).filter((key) => !keys.includes(key));
Expand All @@ -145,7 +145,7 @@ export function buildJudgeEvidence(trajectory, stimulus, structuralValidation, s
);
representation = 'project identity, user metadata, phase state and migration instructions';
}
content = JSON.stringify(value);
content = value;
}
selected.add(path);
files.push({
Expand Down Expand Up @@ -265,7 +265,7 @@ export function buildJudgeEvidence(trajectory, stimulus, structuralValidation, s
add(`${migration}code-migration-manifest.json`, 'generated plan evidence');
}
const packet = {
version: 1,
version: 2,
phase,
scope,
structuralValidation,
Expand Down Expand Up @@ -302,7 +302,7 @@ export function buildJudgeEvidence(trajectory, stimulus, structuralValidation, s
phase === 'schema-conversion' && scope === 'design' ? MAX_SCHEMA_DESIGN_EVIDENCE_BYTES : MAX_EVIDENCE_BYTES;
if (bytes > limit) {
const largest = files
.map(({ path, content }) => ({ path, bytes: Buffer.byteLength(content) }))
.map(({ path, content }) => ({ path, bytes: Buffer.byteLength(JSON.stringify(content)) }))
.sort((a, b) => b.bytes - a.bytes)
.slice(0, 3);
throw new JudgeEvidenceError(
Expand Down
1 change: 1 addition & 0 deletions evals/cosmosdb-relational-migration/graders.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ test('coverage includes every phase, critical workflow boundaries and negative a
'unfamiliar-preflight': 'preflight',
'resume-code': 'code-migration',
'resume-metadata': 'code-migration',
'validate-and-remember': 'preflight',
})) {
assert.ok(
stimuli.some(
Expand Down
39 changes: 26 additions & 13 deletions evals/cosmosdb-relational-migration/judge-evidence.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,23 @@ test('large plans remain complete and retain exact source hashes; JSON projectio
assert.equal(plan.sha256, createHash('sha256').update(plan.content).digest('hex'));
const project = packet.files.find(({ path }) => path.endsWith('project.json'));
assert.deepEqual(project.omittedProperties, ['freshness']);
assert.deepEqual(JSON.parse(project.content).customMetadata, { preserve: true });
assert.deepEqual(project.content.customMetadata, { preserve: true });
assert.ok(!Object.hasOwn(project.content, 'freshness'));
});

test('planning implementation evidence fits without escaping a JSON artifact twice', (t) => {
const { write, trajectory } = fixture(t);
const path = `${migration}phases/3-schema-conversion/manifest.json`;
const original = { examples: ['"\\\nπ'.repeat(26_000), { optional: null, observed: false, count: 0 }] };
write(path, original);
const { text, bytes } = buildJudgeEvidence(trajectory, stimulus('code-migration'), validation, 'implementation');
const packet = JSON.parse(text);
const file = packet.files.find((entry) => entry.path === `app/${path}`);
assert.deepEqual(file.content, original);
assert.equal(bytes, Buffer.byteLength(text));
assert.ok(bytes <= MAX_EVIDENCE_BYTES);
file.content = JSON.stringify(original);
assert.ok(Buffer.byteLength(JSON.stringify(packet)) > MAX_EVIDENCE_BYTES);
});

test('inference judge receives code and inventory without requiring synthesized DDL', (t) => {
Expand Down Expand Up @@ -216,7 +232,7 @@ test('inferred discovery separates inventory from access without losing complete
const file = path.slice('app/'.length);
assert.ok(schema.has(file) || access.has(file), `Lost phase evidence: ${file}`);
}
assert.equal(schema.get(`${discovery}/preflight-manifest.json`), JSON.stringify(inventory));
assert.deepEqual(schema.get(`${discovery}/preflight-manifest.json`), inventory);
assert.ok(!access.has(`${discovery}/preflight-manifest.json`), 'Do not duplicate inventory in the audit packet');
assert.equal(access.get(`${discovery}/schema-ddl/Example.sql`), 'CREATE TABLE Example (Id INT PRIMARY KEY);');
assert.ok(!schema.has(`${discovery}/schema-ddl/Example.sql`));
Expand Down Expand Up @@ -346,9 +362,8 @@ function judgeFixture(t, options = {}) {
input.rubric.map(({ text }) => text),
rubric,
);
assert.ok(
input.evidence.files.some(({ content }) => content.includes('FINAL ROLLBACK OBLIGATION')),
);
const plan = input.evidence.files.find(({ path }) => path.endsWith('/code-migration-plan.md'));
assert.ok(plan.content.includes('FINAL ROLLBACK OBLIGATION'));
if (options.error) throw options.error;
return {
args: options.verdict ?? {
Expand Down Expand Up @@ -515,9 +530,9 @@ test('scoped evidence retains complete files and the audit in independently boun
const evidence = buildJudgeEvidence(trajectory, input, validation, scope);
assert.ok(evidence.bytes <= MAX_EVIDENCE_BYTES);
if (scope === 'design')
assert.equal(
assert.deepEqual(
evidence.packet.files.find(({ path }) => path.endsWith('3-schema-conversion/manifest.json')).content,
JSON.stringify(design),
design,
);
if (scope === 'boundary')
assert.equal(evidence.packet.audit[0].arguments.command, trajectory.events[0].data.arguments.command);
Expand All @@ -536,10 +551,7 @@ test('schema design retains complete UTF-8 evidence at its exact larger byte lim
write(path, { protocol });
const evidence = buildJudgeEvidence(trajectory, stimulus('schema-conversion'), validation, 'design');
assert.equal(evidence.bytes, MAX_SCHEMA_DESIGN_EVIDENCE_BYTES);
assert.equal(
evidence.packet.files.find((file) => file.path === `app/${path}`).content,
JSON.stringify({ protocol }),
);
assert.deepEqual(evidence.packet.files.find((file) => file.path === `app/${path}`).content, { protocol });

write(path, { protocol: `${protocol}x` });
assert.throws(
Expand Down Expand Up @@ -619,7 +631,7 @@ test('dependency evidence preserves complete tasks and clearance conditions with
dependencies.packet.files.map((f) => f.path),
[`app/${path}`, `app/${migration}code-migration-manifest.json`],
);
assert.equal(JSON.parse(manifest.content).mode, 'plan');
assert.equal(manifest.content.mode, 'plan');
assert.equal(plan.content, retained);
assert.deepEqual(plan.omittedSections, ['Access Pattern Migration']);
assert.equal(plan.sha256, createHash('sha256').update(full).digest('hex'));
Expand Down Expand Up @@ -664,7 +676,8 @@ test('every scoped verdict is required and each judge sees only its assigned cri
rubric.map(({ text }) => text),
grouped.evidence_groups[scope].map((index) => input.rubric[index]),
);
assert.ok(evidence.files.some(({ content }) => content.includes('FINAL ROLLBACK OBLIGATION')));
const plan = evidence.files.find(({ path }) => path.endsWith('/code-migration-plan.md'));
assert.ok(plan.content.includes('FINAL ROLLBACK OBLIGATION'));
const score = scope === rejected ? 0 : 1;
return {
args: {
Expand Down
Loading