Autonomous development for real products. Governed agents build from specs you approve, follow the rules you set, and nothing merges until another agent proves it. Your decisions, judgement and taste are the bar that work must clear. Declare your vision and let agents build it.
JavaScript agentic-codingai-agentsai-governanceautonomous-agentsclaude-codeclicode-reviewcodexcoding-agentsdeveloper-toolsgit-hooksllmlocal-firstmulti-agentsoftware-factoryspec-driven-developmentverificationvibe-coding
test(api): cover request envelopes and body limits [A2]
Corey Olson92f1e35631d3
diff --git a/src/json.js b/src/json.jsindex 8d297dcc..bba31a55 100644--- a/src/json.js+++ b/src/json.js@@ -65,6 +65,7 @@ export const JSON_SHAPES = {state: shape({ state: 'object' }),events: shape({ events: 'array' }),move: shape({ event: 'object', result: 'object' }),+ request: shape({ event: 'object', result: 'object' }),stream: shape({ event: 'object' }),},error: shape({ error: 'object' }),diff --git a/test/api.test.js b/test/api.test.jsindex d15da8a3..2a1a658e 100644--- a/test/api.test.js+++ b/test/api.test.js@@ -476,6 +476,8 @@ test('[A2] local HTTP v1 versions state and moves, authenticates, and preservesconst malformed = await apiFetch(api, `${boardPath}/moves`, { method: 'POST', headers: { 'content-type': 'application/json' }, body: '{bad json' });assert.equal((await apiError(malformed, 400)).code, 'BAD_REQUEST');+ const oversized = await apiFetch(api, `${boardPath}/moves`, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ verb: 'add', args: { lane: 'app', title: 'x'.repeat(100_001) } }) });+ assert.equal((await apiError(oversized, 400)).code, 'BAD_REQUEST');const unknownVerb = await apiFetch(api, `${boardPath}/moves`, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ verb: 'pretend', args: {} }) });assert.equal((await apiError(unknownVerb, 400)).code, 'BAD_REQUEST');const unknownArgument = await apiFetch(api, `${boardPath}/moves`, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ verb: 'add', args: { lane: 'app', title: 'Ignored', extra: true } }) });@@ -526,6 +528,7 @@ test('[A2] moves run as the named worktree agent and requests stay visible untilconst requestResponse = await apiFetch(api, `${path}/requests`, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ text: 'Approve the API row' }) });assert.equal(requestResponse.status, 200);const requested = await requestResponse.json();+ assertRequiredShape(requested, JSON_SHAPES.http.request.required, 'request response');const requestId = requested.result.id;assert.equal(requested.event.event_by, 'person');const state = (await (await apiFetch(api, `${path}/state`)).json()).state;