test(e2e): agent registration -> task assignment -> XP earned flow (#219) - #492
test(e2e): agent registration -> task assignment -> XP earned flow (#219)#492blippip69 wants to merge 1 commit into
Conversation
|
| include: ["__tests__/**/*.test.ts", "e2e/*.e2e.test.ts"], | ||
| exclude: [ | ||
| "**/node_modules/**", | ||
| "**/dist/**", | ||
| "packages/create-app/template/**", | ||
| "e2e/**", | ||
| ], |
There was a problem hiding this comment.
🚨 Bug: New vitest include globs silently drop ~22 test files from CI
Previously the config had no include, so vitest used its default (**/*.{test,spec}) and ran every *.test.ts in the repo except e2e/**. The new include: ["__tests__/**/*.test.ts", "e2e/*.e2e.test.ts"] is anchored to the repo root, so it only matches the top-level __tests__/ directory. All co-located and nested suites now stop running in npx vitest run / the CI "Unit tests" job: the entire tests/ tree (task-queue, task-drain, xp-leaderboard-store, webhook filters, skills versioning), co-located lib/**/*.test.ts (xp, x402, quest-store, reputation, notifications, executor, etc.), and nested __tests__ dirs (app/api/webhooks/__tests__/, lib/agent-runtime/__tests__/, lib/webhooks/__tests__/). That's roughly 22 test files silently excluded from CI — a large loss of coverage that will hide future regressions. Use a glob that matches nested locations.
Match all .test.ts anywhere (this also covers e2e/.e2e.test.ts) while excluding the create-app template via exclude, preserving the previous discovery behavior plus the new e2e suite.:
include: ["**/*.test.ts", "e2e/*.e2e.test.ts"],
exclude: [
"**/node_modules/**",
"**/dist/**",
"packages/create-app/template/**",
],
- Apply fix
Check the box to apply the fix or reply for a change | Was this helpful? React with 👍 / 👎
| const completion = await completeTask( | ||
| post(`http://localhost/api/agents/${agentId}/tasks/${assigned.taskId}`, { | ||
| status: "completed", | ||
| result: { ok: true }, | ||
| }), | ||
| taskContext(agentId, assigned.taskId), | ||
| ) |
There was a problem hiding this comment.
💡 Quality: Task-completion request built with POST but handler is PATCH
The suite imports PATCH as completeTask and the README documents completion as PATCH /api/agents/[id]/tasks/[taskId], but the requests are constructed with the post() helper (method "POST"). It works only because the handler is invoked directly and never inspects req.method, so the mismatch is silently ignored and the test does not actually exercise the real HTTP method contract it claims to. Use a patch() helper (or set method: "PATCH") so the request matches the handler being called.
Was this helpful? React with 👍 / 👎
Code Review 🚫 Blocked 0 resolved / 2 findingsAdds an end-to-end Vitest suite covering the agent registration, task assignment, and XP earning lifecycle. However, the new glob patterns silently exclude existing test files in CI and the task completion requests use POST instead of PATCH. 🚨 Bug: New vitest include globs silently drop ~22 test files from CIPreviously the config had no Match all *.test.ts anywhere (this also covers e2e/*.e2e.test.ts) while excluding the create-app template via exclude, preserving the previous discovery behavior plus the new e2e suite.💡 Quality: Task-completion request built with POST but handler is PATCH📄 e2e/agent-task-xp.e2e.test.ts:85-91 📄 e2e/agent-task-xp.e2e.test.ts:130-135 📄 e2e/agent-task-xp.e2e.test.ts:141-144 The suite imports 🤖 Prompt for agentsOptionsAuto-apply is off → Gitar will not commit updates to this branch. Comment with these commands to change the behavior for this request:
Important Your trial ends in 7 days — upgrade now to keep code review, CI analysis, auto-apply, custom automations, and more. Was this helpful? React with 👍 / 👎 | Gitar |



test(e2e): agent registration -> task assignment -> XP earned flow (#219)
EN
Adds
e2e/agent-task-xp.e2e.test.ts- a Vitest e2e suite driving the REALNext.js route handlers (no mocks) through the full lifecycle:
POST /api/agentsregister -> 201POST /api/agents/[id]/tasksassign -> 201PATCH .../tasks/[taskId]complete -> 200GET /api/agents/[id]->xpincreased,levelmatches the XP curve,tasksCompletedincrementedError paths:
Isolation: per-test in-memory stores (
resetAgentRegistryForTests,resetTaskQueue,resetAgentXpDb) + uniquee2e-agent-<uuid>ids; cleanuppurges the queue via
DELETE /api/agents/[id]/tasks. Cannot touch real data.Every assert carries a message naming the broken step.
CI:
vitest.config.tsnow includese2e/*.e2e.test.tsin the standardnpx vitest run, so it runs in the existing "Unit tests" CI job - no newworkflow needed. Playwright browser specs are unaffected.
Runtime: full flow suite finishes in ~15ms (< 10s requirement). Full repo run
green: 76 files / 471 tests passed.
README section added explaining how to run it locally and what it needs.
ES
Agrega
e2e/agent-task-xp.e2e.test.ts: suite e2e en Vitest que maneja losroute handlers REALES de Next.js por todo el ciclo de vida: registro (201) ->
asignacion de tarea (201) -> completado (200) ->
xp/level/tasksCompletedactualizados enGET /api/agents/[id]. Tambien cubre loscaminos de error: 404 para agente inexistente y doble completado rechazado sin
sumar XP dos veces. Aislamiento explicito con stores en memoria y nombres
unicos
e2e-agent-<uuid>; corre en el job de CI existente (~15ms).