3D engine that AI agents drive
Update error text tests and size acceptance for issue #653
Nguyen Xuan An6cba7ccea09d
diff --git a/changes/653.size.md b/changes/653.size.mdindex 4d6c37be..c43bda5d 100644--- a/changes/653.size.md+++ b/changes/653.size.md@@ -1,2 +1,2 @@-- scene:agent-scene: the field-error helper and the longer messages (path, value, example) grow the scene bundle a little; an agent that reads "emissiveColor: got [-1,0,0]; expected three numbers of 0 or more, such as [1, 0.5, 0.2]" fixes it in one retry instead of guessing.-- goal:agent-scene: the cost is message text and one 30-line module (field-error.js); no new behaviour runs outside an error.+- scene:agent-scene: error text grows by about 0.9 KB gzip (field path, received value and an example in each converted message, plus the 30-line field-error module); an agent that reads "emissiveColor: got [-1,0,0]; expected three numbers of 0 or more, such as [1, 0.5, 0.2]" fixes the input in one retry instead of guessing.+- scene:agent-scene+lazy: the same message text, 1.5 KB gzip with the lazy mesh, motion and bake modules; nothing new runs unless a recipe is rejected.diff --git a/tests/agent-motion-look.test.js b/tests/agent-motion-look.test.jsindex 800a2676..a8b575cf 100644--- a/tests/agent-motion-look.test.js+++ b/tests/agent-motion-look.test.js@@ -89,7 +89,7 @@ test('unknown lights, properties and ill-fitting targets name the valid ones', (failure({ kind: 'sun', id: 'x', property: 'intensity', keyframes: keys(1, 2) }, /Sun tracks cannot have an ID/);failure({ kind: 'environment', property: 'skyTop', keyframes: keys([0, 0, 0], [2, 0, 0]) }, /environment skyTop values from 0 to 1/);failure({ kind: 'sun', property: 'direction', keyframes: keys([0, 0, 0], [0, 1, 0]) }, /keyframes\[0\]\.value: got \[0,0,0\]; expected a direction that is not all zero/);- failure({ kind: 'effects', property: 'exposure', keyframes: keys(1, 99) }, /exposure must stay within/);+ failure({ kind: 'effects', property: 'exposure', keyframes: keys(1, 99) }, /effects exposure values from 0.01 to 16/);assert.throws(() => createAgentScene(sceneRecipe([{ kind: 'effects', property: 'focusDistance', keyframes: keys(1, 2) }],{ effects: {} })), /focusDistance needs effects.depthOfField.blur above 0/);});diff --git a/tests/mesh-edit.test.js b/tests/mesh-edit.test.jsindex e481ada1..9c4b6897 100644--- a/tests/mesh-edit.test.js+++ b/tests/mesh-edit.test.js@@ -155,7 +155,7 @@ test('edit validation names the op, field and allowed values', () => {assert.throws(() => normalizeMeshEdits([{ op: 'inset_region', thickness: 0 }]), /edits\[0\]\.thickness: got 0; expected a number above 0/);assert.throws(() => normalizeMeshEdits([{ op: 'delete' }]), /delete needs select/);assert.throws(() => normalizeMeshEdits([{ op: 'tag', select: { all: true }, name: 'bad name' }]), /edits\[0\]\.name: got "bad name"; expected 1 to 48 letters/);- assert.throws(() => normalizeMeshEdits([{ op: 'translate', offset: [0, 1, 0], falloff: { radius: 1, curve: 'wobbly' } }]), /curve must be one of smooth/);+ assert.throws(() => normalizeMeshEdits([{ op: 'translate', offset: [0, 1, 0], falloff: { radius: 1, curve: 'wobbly' } }]), /edits\[0\]\.falloff\.curve: got "wobbly"; expected one of smooth/);assert.throws(() => applyMeshEdits(cube(), [{ op: 'extrude_individual', select: { tag: 'top' }, offset: 1 }, { op: 'delete', select: { faces: [99] } }]), /Mesh edit 1 \(delete\): Face index 99/);assert.throws(() => applyMeshEdits(cube(), Array.from({ length: 8 }, () => ({ op: 'extrude_individual', offset: 0.1 })), { maxFaces: 1000 }), /over the limit/);});diff --git a/tests/mesh-sculpt-shrinkwrap.test.js b/tests/mesh-sculpt-shrinkwrap.test.jsindex 3fc85053..c66cc366 100644--- a/tests/mesh-sculpt-shrinkwrap.test.js+++ b/tests/mesh-sculpt-shrinkwrap.test.js@@ -129,7 +129,7 @@ test('sculpt refuses hostile strokes before running them', () => {{ strokes: [null] },{ strokes: [stroke], alsoThis: true },];- for (const edit of bad) assert.throws(() => normalizeMeshEdits([{ op: 'sculpt', ...edit }]), /Mesh edit 0|does not take/, JSON.stringify(edit).slice(0, 80));+ for (const edit of bad) assert.throws(() => normalizeMeshEdits([{ op: 'sculpt', ...edit }]), /Mesh edit 0|does not take|edits\[0\]\./, JSON.stringify(edit).slice(0, 80));});test('sculpt stops when the vertex visits would be too many', () => {@@ -206,7 +206,7 @@ test('shrinkwrap refuses hostile fields before running them', () => {{ translation: [1e9, 0, 0] },{ colour: 'red' },];- for (const change of bad) assert.throws(() => normalizeMeshEdits([{ ...base, ...change }]), /Mesh edit 0|does not take/, JSON.stringify(change));+ for (const change of bad) assert.throws(() => normalizeMeshEdits([{ ...base, ...change }]), /Mesh edit 0|does not take|edits\[0\]\./, JSON.stringify(change));assert.throws(() => applyMeshEdits(sheet(2, 0.5, 1.5), [base]), /target resolver/);});