{
"meta": {
"agent": "planner",
"task_id": "13",
"title": "fix(sidebar): add unit tests for org/env view item builders",
"created_at": "2026-04-02T12:00:00Z"
},
"inputs": [
{
"name": "GitHub issue #13",
"type": "context",
"ref": "https://github.com/AgentSDE/meridian-frontend/issues/13",
"notes": "Org/Env views empty due to incorrect file tree root assumption — code fix already merged, tests needed"
},
{
"name": "sidebar.ts",
"type": "file",
"ref": "src/lib/utils/sidebar.ts",
"notes": "Contains buildOrgViewItems, buildEnvViewItems, findNodeAtPath — the functions under test"
},
{
"name": "AGENTS.md",
"type": "context",
"ref": "AGENTS.md",
"notes": "Project patterns: Next.js App Router, TypeScript, Tailwind, sidebar utils in src/lib/utils/sidebar.ts"
}
],
"outputs": [
{
"name": "plan.md",
"type": "plan",
"format": "md",
"content": "Implementation plan for test infrastructure and unit tests"
}
],
"files": [
{
"path": "package.json",
"action": "modify",
"reason": "Add vitest devDependency; update test script"
},
{
"path": "vitest.config.ts",
"action": "create",
"reason": "Vitest configuration with Next.js path alias resolution"
},
{
"path": "tsconfig.json",
"action": "modify",
"reason": "Add vitest type references if needed"
},
{
"path": "src/lib/utils/__tests__/sidebar.test.ts",
"action": "create",
"reason": "Unit tests for buildOrgViewItems, buildEnvViewItems, findNodeAtPath"
}
],
"steps": [
{
"id": "S1",
"summary": "Set up Vitest test infrastructure — install deps, create config, update test script",
"acceptance": [
"vitest is installed as a devDependency",
"vitest.config.ts resolves @/ path alias to src/",
"npm run test executes vitest (not the placeholder echo)"
],
"depends_on": []
},
{
"id": "S2",
"summary": "Write unit tests for buildOrgViewItems, buildEnvViewItems, and findNodeAtPath",
"acceptance": [
"Tests cover multi-issue scanning with deduplication by org/repo name",
"Tests cover run merging across issue directories under the same repo node",
"Tests cover env grouping under e2e and production with child merging",
"Tests cover zero issue-N directories returning empty array",
"Tests cover missing tasks/ directory inside an issue-N being silently skipped",
"All tests pass via npm run test"
],
"depends_on": [
"S1"
]
}
],
"risks": [
{
"risk": "Vitest path alias config may not resolve @/ correctly for Next.js",
"mitigation": "Use vite-tsconfig-paths plugin or manual resolve.alias in vitest.config.ts"
}
],
"assumptions": [
"The code fix in buildOrgViewItems and buildEnvViewItems is correct as merged — tests validate existing behavior, not fix new bugs",
"Vitest is the appropriate test runner for this Next.js/TypeScript project"
],
"open_questions": []
}