Commit 0a45a4d
committed
chore: make initial_tasks NULL by default to indicate 'unknown yet' (#215)
### TL;DR
Changed `initial_tasks` from hardcoded "1" to `NULL` for dependent map steps, improving semantic correctness.
### What changed?
- Modified the database schema to allow `NULL` values for `initial_tasks` in the `step_states` table
- Added a constraint to ensure `initial_tasks` is not `NULL` when a step is started
- Updated SQL functions to:
- Set `initial_tasks = NULL` for dependent map steps during flow creation
- Resolve the `NULL` value to the actual array length when dependencies complete
- Prevent steps with `NULL` initial_tasks from starting
- Moved the implementation plan from `pkgs/core/PLAN_use_null_for_map_initial_tasks.md` to the root directory
- Updated the PLAN.md to prioritize this change before other map-related work
- Added new tests to verify the NULL behavior works correctly
### How to test?
- Run the new test files:
- `pkgs/core/supabase/tests/initial_tasks_null/dependent_maps_null.test.sql`
- `pkgs/core/supabase/tests/start_flow/dependent_map_initial_tasks_null.test.sql`
- Verify that dependent map steps start with `NULL` initial_tasks
- Verify that when dependencies complete, `NULL` is resolved to the correct array length
- Verify that steps cannot start with `NULL` initial_tasks
### Why make this change?
This change improves semantic correctness in the system:
- `NULL` correctly represents "unknown until dependencies complete"
- The previous approach of using "1" as a placeholder was misleading
- This change makes the code more explicit about the state of map steps
- It's an important foundation for upcoming map features like array distribution and output aggregation1 parent 846f800 commit 0a45a4d
File tree
17 files changed
+1290
-260
lines changed- .claude
- pkgs/core
- schemas
- src
- supabase
- migrations
- tests
- initial_tasks_null
- start_flow
17 files changed
+1290
-260
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
113 | 128 | | |
114 | 129 | | |
115 | 130 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
90 | 97 | | |
91 | 98 | | |
92 | 99 | | |
| |||
102 | 109 | | |
103 | 110 | | |
104 | 111 | | |
| 112 | + | |
| 113 | + | |
105 | 114 | | |
106 | 115 | | |
107 | 116 | | |
| |||
124 | 133 | | |
125 | 134 | | |
126 | 135 | | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | 136 | | |
138 | 137 | | |
139 | 138 | | |
140 | 139 | | |
141 | 140 | | |
142 | 141 | | |
143 | 142 | | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
144 | 171 | | |
145 | 172 | | |
146 | 173 | | |
| |||
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
46 | 49 | | |
47 | 50 | | |
48 | 51 | | |
| |||
Lines changed: 18 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
11 | 15 | | |
12 | | - | |
| 16 | + | |
13 | 17 | | |
14 | 18 | | |
15 | 19 | | |
16 | 20 | | |
17 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
18 | 25 | | |
19 | | - | |
| 26 | + | |
| 27 | + | |
20 | 28 | | |
21 | 29 | | |
22 | 30 | | |
| |||
32 | 40 | | |
33 | 41 | | |
34 | 42 | | |
| 43 | + | |
| 44 | + | |
35 | 45 | | |
36 | | - | |
37 | 46 | | |
38 | 47 | | |
39 | 48 | | |
40 | 49 | | |
41 | 50 | | |
42 | 51 | | |
43 | | - | |
44 | | - | |
| 52 | + | |
| 53 | + | |
45 | 54 | | |
46 | 55 | | |
47 | | - | |
| 56 | + | |
48 | 57 | | |
49 | 58 | | |
50 | 59 | | |
| |||
62 | 71 | | |
63 | 72 | | |
64 | 73 | | |
| 74 | + | |
65 | 75 | | |
66 | | - | |
67 | 76 | | |
68 | 77 | | |
69 | 78 | | |
| |||
80 | 89 | | |
81 | 90 | | |
82 | 91 | | |
| 92 | + | |
83 | 93 | | |
84 | 94 | | |
85 | | - | |
| 95 | + | |
86 | 96 | | |
87 | 97 | | |
88 | 98 | | |
| |||
0 commit comments