Browse Source

docs(22): create phase plan

Phase 22: Generate Node Dynamic Input Tests
- 1 plan created (22-01-PLAN.md)
- 3 tasks defined: ModelParameters tests, GenerateImageNode/GenerateVideoNode dynamic handle tests
- Ready for execution
handoff-20260429-1057
shrimbly 6 months ago
parent
commit
943d0f5099
  1. 8
      .planning/ROADMAP.md
  2. 4
      .planning/STATE.md
  3. 194
      .planning/phases/22-generate-node-dynamic-input-tests/22-01-PLAN.md

8
.planning/ROADMAP.md

@ -283,17 +283,17 @@ Plans:
**Goal**: Test that generate nodes properly validate and render dynamic inputs from provider schemas, and that all inputs/parameters are correctly included in API calls **Goal**: Test that generate nodes properly validate and render dynamic inputs from provider schemas, and that all inputs/parameters are correctly included in API calls
**Depends on**: Phase 21 **Depends on**: Phase 21
**Research**: Unlikely (existing test patterns from Phase 17) **Research**: Unlikely (existing test patterns from Phase 17)
**Plans**: TBD **Plans**: 1 plan
**Test coverage:** **Test coverage:**
1. Dynamic inputs from provider schemas render correctly as parameters and input handles on node creation 1. Dynamic inputs from provider schemas render correctly as parameters and input handles on node creation
2. Validation of dynamic inputs (required fields, type checking, constraints) 2. Validation of dynamic inputs (required fields, type checking, constraints)
3. Standard inputs (image, text) validate properly 3. Standard inputs (image, text) validate properly
4. On submission, all parameters and inputs are included in API call payload correctly 4. On submission, all parameters and inputs are included in API call payload correctly (covered by Phase 18)
5. Coverage across all providers (Gemini, Replicate, fal.ai) 5. Coverage across all providers (Gemini, Replicate, fal.ai)
Plans: Plans:
- [ ] 22-01: TBD (run /gsd:plan-phase 22 to break down) - [ ] 22-01: ModelParameters tests, GenerateImageNode/GenerateVideoNode dynamic handle tests
## Progress ## Progress
@ -323,4 +323,4 @@ Phases execute in numeric order: 1 → 2 → ... → 14 → 15 → 16 → 17 →
| 19. Type Refactoring | v1.2 | 0/? | Not started | - | | 19. Type Refactoring | v1.2 | 0/? | Not started | - |
| 20. Integration Tests | v1.2 | 0/? | Not started | - | | 20. Integration Tests | v1.2 | 0/? | Not started | - |
| 21. Fix Image Input & Deduplication | v1.2 | 0/? | Not started | - | | 21. Fix Image Input & Deduplication | v1.2 | 0/? | Not started | - |
| 22. Generate Node Dynamic Input Tests | v1.2 | 0/? | Not started | - | | 22. Generate Node Dynamic Input Tests | v1.2 | 0/1 | Planned | - |

4
.planning/STATE.md

@ -128,6 +128,6 @@ Recent decisions affecting current work:
## Session Continuity ## Session Continuity
Last session: 2026-01-13 Last session: 2026-01-13
Stopped at: Completed 18-05-PLAN.md (Models route tests) - Phase 18 complete Stopped at: Phase 22 planned (1 plan created)
Resume file: None Resume file: None
Next action: Plan Phase 19 (run /gsd:plan-phase 19) Next action: Execute Phase 22 (run /gsd:execute-plan .planning/phases/22-generate-node-dynamic-input-tests/22-01-PLAN.md)

194
.planning/phases/22-generate-node-dynamic-input-tests/22-01-PLAN.md

@ -0,0 +1,194 @@
---
phase: 22-generate-node-dynamic-input-tests
plan: 01
type: execute
---
<objective>
Add comprehensive tests for dynamic input handling in generate nodes, covering schema-driven handle rendering, ModelParameters component, and input validation.
Purpose: Ensure generate nodes correctly render dynamic inputs from provider schemas and pass validated inputs to API calls.
Output: Complete test coverage for dynamic input flows in GenerateImageNode, GenerateVideoNode, and ModelParameters.
</objective>
<execution_context>
~/.claude/get-shit-done/workflows/execute-phase.md
~/.claude/get-shit-done/templates/summary.md
</execution_context>
<context>
@.planning/PROJECT.md
@.planning/ROADMAP.md
@.planning/STATE.md
**Existing test files to extend:**
@src/components/__tests__/GenerateImageNode.test.tsx
@src/components/__tests__/GenerateVideoNode.test.tsx
**Component being tested:**
@src/components/nodes/GenerateImageNode.tsx (lines 464-580 for dynamic handles)
@src/components/nodes/GenerateVideoNode.tsx
@src/components/nodes/ModelParameters.tsx
**Prior Phase Summary (provides test patterns):**
@.planning/phases/17-component-tests/17-03-SUMMARY.md
**Tech stack available:** Vitest, React Testing Library, ReactFlowProvider wrapper
**Established patterns:** Zustand store mocking, fetch mocking, createPortal mocking for modals
**Constraining decisions:**
- Phase 17: ReactFlowProvider wrapper for component tests using @xyflow/react hooks
- Phase 17: Zustand store mocking with vi.mock pattern returning mocked functions
- Phase 18: API payload tests for dynamicInputs already covered in route tests
</context>
<tasks>
<task type="auto">
<name>Task 1: Add ModelParameters component tests</name>
<files>src/components/__tests__/ModelParameters.test.tsx</files>
<action>
Create comprehensive tests for ModelParameters component:
**Schema Loading:**
- Should fetch schema when modelId and non-gemini provider are set
- Should not fetch schema for gemini provider
- Should not fetch schema when modelId is empty
- Should call onInputsLoaded with inputs from schema response
- Should handle fetch errors gracefully
- Should show loading state while fetching
**Parameter Handling:**
- Should render parameter inputs based on schema
- Should call onParametersChange when parameter value changes
- Should remove parameter from object when value is cleared
- Should render number inputs for integer/number types
- Should render select inputs for enum types
- Should render boolean toggle for boolean types
**Collapse/Expand:**
- Should call onExpandChange when toggled
- Should start expanded by default
- Should show parameter count in header
Mock fetch for schema endpoint:
```typescript
mockFetch.mockResolvedValueOnce({
ok: true,
json: () => Promise.resolve({
parameters: [
{ name: "seed", type: "integer", description: "Random seed" },
{ name: "guidance_scale", type: "number", default: 7.5 },
],
inputs: [
{ name: "prompt", type: "text", required: true, label: "Prompt" },
{ name: "image_url", type: "image", required: false, label: "Image" },
],
}),
});
```
</action>
<verify>npm test -- src/components/__tests__/ModelParameters.test.tsx</verify>
<done>ModelParameters tests pass covering schema loading, parameter handling, and collapse behavior</done>
</task>
<task type="auto">
<name>Task 2: Extend GenerateImageNode dynamic handle tests</name>
<files>src/components/__tests__/GenerateImageNode.test.tsx</files>
<action>
Add tests to existing "Dynamic Input Handles" describe block:
**Multiple Image Inputs:**
- Should render multiple image handles with indexed IDs (image-0, image-1)
- Should position multiple image handles correctly (spaced evenly)
- Should show labels for each image input from schema
**Multiple Text Inputs:**
- Should render multiple text handles with indexed IDs (text-0, text-1)
- Should show labels for each text input from schema
**Placeholder Handle Variations:**
- Should show dimmed image handle (opacity 0.3) when schema has only text inputs
- Should show dimmed text handle when schema has only image inputs
- Should show "Not used by this model" description for placeholder handles
**Handle Ordering:**
- Should render image handles before text handles
- Should maintain gap between image and text handle groups
Test data patterns:
```typescript
// Multiple image inputs
inputSchema: [
{ name: "first_frame", type: "image", required: true, label: "First Frame" },
{ name: "last_frame", type: "image", required: false, label: "Last Frame" },
{ name: "prompt", type: "text", required: true, label: "Prompt" },
]
// Text-only model (placeholder image handle)
inputSchema: [
{ name: "prompt", type: "text", required: true, label: "Prompt" },
{ name: "negative_prompt", type: "text", required: false, label: "Negative" },
]
```
</action>
<verify>npm test -- src/components/__tests__/GenerateImageNode.test.tsx --testNamePattern="Dynamic"</verify>
<done>GenerateImageNode tests cover all dynamic handle variations and placeholder scenarios</done>
</task>
<task type="auto">
<name>Task 3: Extend GenerateVideoNode dynamic handle tests</name>
<files>src/components/__tests__/GenerateVideoNode.test.tsx</files>
<action>
Mirror the GenerateImageNode dynamic handle tests for video nodes:
**Multiple Image Inputs (common for video):**
- Should render multiple image handles for multi-frame video models
- Should show labels like "Start Frame", "End Frame" from schema
**Placeholder Handles:**
- Should show dimmed image handle when video model only needs text
- Should show dimmed text handle when video model only needs images
**Schema Integration:**
- Should update handles when inputSchema changes (model change)
Use similar test patterns as Task 2 but with video-specific schemas:
```typescript
// Image-to-video model
inputSchema: [
{ name: "start_image", type: "image", required: true, label: "Start Image" },
{ name: "end_image", type: "image", required: false, label: "End Image" },
{ name: "prompt", type: "text", required: true, label: "Motion Prompt" },
]
```
</action>
<verify>npm test -- src/components/__tests__/GenerateVideoNode.test.tsx --testNamePattern="Dynamic"</verify>
<done>GenerateVideoNode tests match GenerateImageNode coverage for dynamic handles</done>
</task>
</tasks>
<verification>
Before declaring plan complete:
- [ ] `npm test -- src/components/__tests__/ModelParameters.test.tsx` passes
- [ ] `npm test -- src/components/__tests__/GenerateImageNode.test.tsx` passes
- [ ] `npm test -- src/components/__tests__/GenerateVideoNode.test.tsx` passes
- [ ] No TypeScript errors
- [ ] Schema loading tested
- [ ] Dynamic handle variations tested
- [ ] Placeholder handles tested
</verification>
<success_criteria>
- All tasks completed
- All verification checks pass
- ModelParameters component fully tested
- Dynamic input handle rendering fully tested
- Placeholder handle behavior fully tested
- Phase 22 complete
</success_criteria>
<output>
After completion, create `.planning/phases/22-generate-node-dynamic-input-tests/22-01-SUMMARY.md`
</output>
Loading…
Cancel
Save